How can I call a exported function using ordinal number

心已入冬 提交于 2019-11-27 18:03:08

问题


If a dll exports some functions and the functions have only ordinal numbers, how can I call the functions?

Give me a short example please.


回答1:


The documentation for GetProcAddress explains that you pass the integer ordinal in the low-order word of the lpProcName parameter. The MAKEINTRESOURCE macro can actually be used to make this a little easier:

int ordinal = 123;
HANDLE dll = LoadLibrary("MyDLL.dll");
FARPROC fn = GetProcAddress(dll, MAKEINTRESOURCE(ordinal));


来源:https://stackoverflow.com/questions/3598108/how-can-i-call-a-exported-function-using-ordinal-number

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