#251 hook GetMessage for Enemy Infestation

This commit is contained in:
FunkyFr3sh 2023-10-07 09:03:11 +02:00
parent 43aa290d1e
commit 24a73ccc6d
6 changed files with 32 additions and 7 deletions

View file

@ -593,11 +593,9 @@ HHOOK WINAPI fake_SetWindowsHookExA(int idHook, HOOKPROC lpfn, HINSTANCE hmod, D
return real_SetWindowsHookExA(idHook, lpfn, hmod, dwThreadId);
}
BOOL WINAPI fake_PeekMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg)
BOOL HandleMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
{
BOOL result = real_PeekMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
if (result && g_ddraw && g_ddraw->width && g_config.hook_peekmessage)
if (g_ddraw && g_ddraw->width)
{
switch (lpMsg->message)
{
@ -690,10 +688,30 @@ BOOL WINAPI fake_PeekMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT w
break;
}
}
}
return TRUE;
}
BOOL WINAPI fake_GetMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
{
BOOL result = real_GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
if (result && g_config.hook_getmessage)
HandleMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
return result;
}
BOOL WINAPI fake_PeekMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg)
{
BOOL result = real_PeekMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
if (result && g_config.hook_peekmessage)
HandleMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
return result;
}