Хочу поделиться кодом радара хака на игру cs:s, думаю тут и без слов понятно что и как, вообщем забирайте бесплатно! :).
Код
#include <Windows.h>
BOOL DataCompare( BYTE pData, BYTE bMask, char * szMask )
{
for( ; *szMask; ++szMask, ++pData, ++bMask )
if( szMask == 'x' && pData != *bMask )
return FALSE;
return ( *szMask == NULL );
}
DWORD FindPattern( DWORD dwAddress, DWORD dwLen, BYTE bMask, char szMask )
{
for( DWORD i = 0; i < dwLen; i++ )
if( DataCompare( (BYTE*)( dwAddress + i ), bMask, szMask ) )
return (DWORD)( dwAddress + i );
return 0;
}
DWORD MainThread( LPVOID lpArgs )
{
HMODULE hClient = GetModuleHandleA( "client.dll" );
while(hClient == NULL) { hClient = GetModuleHandleA( "client.dll" ); }
DWORD dwDrawOnRadar = FindPattern((DWORD)hClient, 0x005E5000, (BYTE*)"\xA1\x00\x00\x00\x00\x85\xC0\x74\x06\x05", "x????xxxxx") + 1;
dwDrawOnRadar = *(DWORD*)dwDrawOnRadar;
while(1)
{
// Loop through all indexes in the array
for(int i = 0;i < 0x4F;i++) // at 0x50 seems to be start of clan name
{
// Short explanation, in the code we reversed,
// ESI is dwDrawOnRadar (pointer)
// EDI is i (player index)
BYTE* pDrawOnRadar = (BYTE*)((*(DWORD*)dwDrawOnRadar) + 0xD1D + i);
// 1 = draw on radar
*pDrawOnRadar = 1;
}
}
return 0;
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
{
if(dwReason == DLL_PROCESS_ATTACH)
{
DWORD dwThreadID = 0;
HANDLE hThread = CreateThread( NULL, NULL, (LPTHREAD_START_ROUTINE)MainThread, NULL, NULL, &dwThreadID );
}
return TRUE;
}