Closed rxznve closed 1 year ago
Hello. I can't install the EAT hook on MessageBoxW. What am I doing wrong?
#include <Windows.h> #include <iostream> using std::cout, std::endl; #include "PolyHook 2/Include/polyhook2/PE/EatHook.hpp" #pragma comment(lib, "PolyHook 2/Library/PolyHook_2.lib") decltype(&MessageBoxW) fpMessageBoxW = nullptr; int WINAPI myMessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType) { return fpMessageBoxW(hWnd, L"Hooked!", lpCaption, uType); } int main() { PLH::EatHook msgHook("MessageBoxW", L"user32.dll", (uint64_t)myMessageBoxW, (uint64_t*)&fpMessageBoxW); if (!msgHook.hook()) cout << "[EAT] EAT hooking MessageBoxW failed!" << endl; MessageBoxW(nullptr, L"Hello World!", L"Notify", MB_OK); return 0; }
Hello. I can't install the EAT hook on MessageBoxW. What am I doing wrong?