typedef void (WINAPI *voidfunc)(void);
typedef HMODULE (WINAPI *strfunc1)(char*);
typedef HMODULE (WINAPI *strfunc2)(void*,char*);
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
HMODULE kernel=GetModuleHandleA("kernel32.dll");
if(!kernel)return 1;
strfunc1 LoadLibrary16=(strfunc1)GetProcAddress(kernel,"LoadLibrary16");
if(!LoadLibrary16){
MessageBoxA(0,"LoadLibrary16 is not imported","err",0);
return 1;
}
HMODULE user=LoadLibrary16("user.exe");
if(!user){
MessageBoxA(0,"user.exe is not loaded","err",0);
return 1;
}
strfunc2 GetProcAddress16=(strfunc2)GetProcAddress(kernel,"GetProcAddress16");
if(!GetProcAddress16){
MessageBoxA(0,"GetProcAddress16 is not imported","err",0);
return 1;
}
voidfunc enable=(voidfunc)GetProcAddress16(user,"EnableOemLayer");
voidfunc disable=(voidfunc)GetProcAddress16(user,"DisableOemLayer");
if(!(enable&&disable))return 1;
disable();
Sleep(5000);
enable();
return 0;
}
不工作。
PS我的操作系统是Win 7。
PPS 首先我简单地尝试了 LoadLibraryA,得到了错误,读了一点,明白我需要 16 位未记录的函数。