add some more error checks to IAT hooker

This commit is contained in:
FunkyFr3sh 2023-10-20 10:19:46 +02:00
parent af861ff2ee
commit ecc56d4cbc
3 changed files with 40 additions and 28 deletions

View file

@ -11,6 +11,31 @@
#include "config.h"
BOOL util_is_bad_read_ptr(void* p)
{
MEMORY_BASIC_INFORMATION mbi = { 0 };
if (VirtualQuery(p, &mbi, sizeof(mbi)))
{
DWORD mask = (
PAGE_READONLY |
PAGE_READWRITE |
PAGE_WRITECOPY |
PAGE_EXECUTE_READ |
PAGE_EXECUTE_READWRITE |
PAGE_EXECUTE_WRITECOPY);
BOOL b = !(mbi.Protect & mask);
if (mbi.Protect & (PAGE_GUARD | PAGE_NOACCESS))
b = TRUE;
if (!b)
return b;
}
return TRUE;
}
BOOL util_is_minimized(HWND hwnd)
{
RECT rc = { 0 };