im making a small anti-cheat, and i want to check if functions are patched.
Code:
bool cAntiCheat::IsFuncValid( DWORD dwAddress, char* szMemMatch, int iSize )
{
BYTE* szMemOrig;
DWORD dwOldProtection, dwDummy;
VirtualProtect( ( PVOID )dwAddress, iSize, PAGE_EXECUTE_READWRITE, &dwOldProtection );
memcpy( ( BYTE* )szMemOrig, ( BYTE* )dwAddress, iSize );
VirtualProtect( ( PVOID )dwAddress, iSize, dwOldProtection, &dwDummy );
if( !memcmp( ( BYTE* )szMemOrig, ( BYTE* )szMemMatch , iSize ))return true;
return false;
}
you use it like this:
Code:
if( !cAC.IsFuncValid( 0x7428E6, "\xFF\x4E\x0C\x8B\x46\x08", 6 ) )
KICKTYPE = KICK_AMMO;
but it always crashes (also by this point i should mention im making an anti-cheat without source code access ( hacky ) )
thanks.