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位无证件的功能。
答案 0 :(得分:3)
我担心kernel32.dll中没有16位函数。 可以找到的功能是
LoadLibraryA
LoadLibraryExA
LoadLibraryExW
LoadLibraryW
一个有用的工具是依赖,你可以从中找到它 http://www.dependencywalker.com/
答案 1 :(得分:1)
kernel32.dll中不存在LoadLibrary16和GetProcAddress16
请参阅
答案 2 :(得分:0)
只有Windows 95/98 / ME上的kernel32.dll具有LoadLibrary16和GetProcAddress16,并且不会按名称导出它们。