how to see what is ordinal x in my dll

回眸只為那壹抹淺笑 提交于 2019-12-11 16:54:35

问题


The client has reported me that my dll gives "ordinal 5 not located" error when loading it. To see what ordinal 5 is, I have found this:

How can I call a exported function using ordinal number

But the example in the answer of there gives me error.

#include <windows.h>
#include <winuser.h>
#include <winbase.h>

int main()
{
    const wchar_t str[200] = 
    L"D:\\mydll.dll";
    HANDLE mydll = LoadLibrary(str);

    int ordinal = 5;
    FARPROC fn = GetProcAddress(mydll, MAKEINTRESOURCE(ordinal));

    return 0;
}

The error is:

main.cpp:15: error: invalid conversion from 'HANDLE {aka void*}' to 'HMODULE {aka HINSTANCE__*}' [-fpermissive] FARPROC fn = GetProcAddress(mydll, MAKEINTRESOURCE(ordinal));

main.cpp:15: error: cannot convert 'LPWSTR {aka > wchar_t*}' to 'LPCSTR {aka const char*}' for argument '2' to 'int (attribute((stdcall)) * GetProcAddress(HMODULE, LPCSTR))()' FARPROC fn = GetProcAddress(mydll, MAKEINTRESOURCE(ordinal));

Any idea on what I am trying to do? How can I find what is problem with loading my dll? What is ordinal 5?

来源:https://stackoverflow.com/questions/47282845/how-to-see-what-is-ordinal-x-in-my-dll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!