mike
November 29th, 2002, 06:10
I'm trying to write some thunk code in C, but I'm having trouble loading some of the undocumented functions from kernel32 by ordinal:
I want to load LoadLibrary16 (35), FreeLibrary16 (36), and GetProcAddress16 (37). I tried using
But it always fails. Am I doing that wrong?
I forced it to work by adding the offset (0x2AF46) to hKernel and casting it into a function.
I'm also looking for a 16-bit version of GetModuleFileName. Does GetModuleFileNameA work?
I want to load LoadLibrary16 (35), FreeLibrary16 (36), and GetProcAddress16 (37). I tried using
Code:
typedef HANDLE (__cdecl *LL16)(char *);
static LL16 LoadLibrary16 = NULL;
static HANDLE hKernel;
...
hKernel = GetModuleHandle("KERNEL32";
LoadLibrary16 = (LL16)GetProcAddress(hKernel, (LPCSTR)35);
But it always fails. Am I doing that wrong?
I forced it to work by adding the offset (0x2AF46) to hKernel and casting it into a function.
I'm also looking for a 16-bit version of GetModuleFileName. Does GetModuleFileNameA work?