提问人:ThanaKit Thanha 提问时间:11/8/2023 更新时间:11/8/2023 访问量:8
错误:没有用于调用“MH_CreateHookApi”的匹配函数
error: no matching function for call to 'MH_CreateHookApi'
问:
#include <Windows.h>
#include <stdio.h>
#include <MinHook.h>
//Hook MessageBoxA
typedef int(WINAPI* MessageBoxA_t)(HWND, LPCSTR, LPCSTR, UINT);
int WINAPI MessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType)
{
printf("Hooked\n");
return ((MessageBoxA_t)GetProcAddress(GetModuleHandleA("user32.dll"), "MessageBoxA"))(hWnd, "Hooked", lpCaption, uType);
}
DWORD WINAPI ThreadAttach(LPVOID lpParam)
{
if (MH_Initialize() != MH_OK)
{
return 0;
}
//Hook MessageBoxA
MH_CreateHookApi(L"user32.dll", "MessageBoxA", &MessageBoxA, NULL);
return 0;
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
{
AllocConsole();
freopen("CONOUT$", "w", stdout);
DisableThreadLibraryCalls(hModule);
CreateThread(NULL, NULL, ThreadAttach, NULL, NULL, NULL);
}
return TRUE;
}
clang++ -m32 -shared -o Hook.dll main.cpp -LC:\msys64\clang32\lib -lMinHook
没有用于调用“MH_CreateHookApi”的匹配函数
请帮帮我某人。
答: 暂无答案
评论