gpt4 book ai didi

c++ - 未记录的 WinAPI : LoadLibrary16 and GetProcAddress16

转载 作者:行者123 更新时间:2023-11-27 23:24:20 26 4
gpt4 key购买 nike

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 位未记录的函数。

最佳答案

我担心 kernel32.dll 中没有 16 位函数。可以查到的函数有

LoadLibraryA
LoadLibraryExA
LoadLibraryExW
LoadLibraryW

一个有用的工具是依赖,你可以从 http://www.dependencywalker.com/

关于c++ - 未记录的 WinAPI : LoadLibrary16 and GetProcAddress16,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10465307/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com