Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I call a exported function using ordinal number

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.

like image 648
Benjamin Avatar asked Aug 30 '10 05:08

Benjamin


1 Answers

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));
like image 76
Dean Harding Avatar answered Nov 15 '22 14:11

Dean Harding