Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool InitScanner()
- {
- ClientBytes = new BYTE[ClientSize];
- EngineBytes = new BYTE[EngineSize];
- if (!ReadProcessMemory(hProcess, (LPVOID)ClientBase, ClientBytes, ClientSize, NULL))
- {
- ClearBytes();
- return false;
- }
- if (!ReadProcessMemory(hProcess, (LPVOID)EngineBase, EngineBytes, EngineSize, NULL))
- {
- ClearBytes();
- return false;
- }
- return true;
- }
- void ClearBytes()
- {
- delete [] ClientBytes;
- delete [] EngineBytes;
- }
- DWORD Client_FindPattern( BYTE Pattern[], const size_t& PatternSize) const
- {
- for (DWORD i = 0; i < ClientSize; i++)
- {
- bool DoesMatch = true;
- for (DWORD j = 0; j < PatternSize; j++)
- {
- if (Pattern[j]==0) continue;
- if (Pattern[j] == ClientBytes[i+j])
- {
- DoesMatch = false;
- break;
- }
- }
- if (DoesMatch) return i;
- }
- return 0;
- }
- DWORD Engine_FindPattern( BYTE Pattern[], const size_t& PatternSize) const
- {
- for (DWORD i = 0; i < EngineSize; i++)
- {
- bool DoesMatch = true;
- for (DWORD j = 0; j < PatternSize; j++)
- {
- if (Pattern[j]==0) continue;
- if (Pattern[j] == EngineBytes[i+j])
- {
- DoesMatch = false;
- break;
- }
- }
- if (DoesMatch) return i;
- }
- return 0;
- }
- DWORD Client_GetOffset( DWORD Offset ) const
- {
- DWORD Buffer = NULL;
- memcpy(&Buffer, &ClientBytes[Offset], sizeof(DWORD));
- return Buffer;
- }
- DWORD Engine_GetOffset( DWORD Offset ) const
- {
- DWORD Buffer = NULL;
- memcpy(&Buffer, &EngineBytes[Offset], sizeof(DWORD));
- return Buffer;
- }
- DWORD Client_GetOffset( BYTE Pattern[], const size_t& PatternSize, DWORD ShiftAmount )
- {
- return Client_GetOffset( Client_FindPattern(Pattern, PatternSize) + ShiftAmount );
- }
- DWORD Engine_GetOffset( BYTE Pattern[], const size_t& PatternSize, DWORD ShiftAmount )
- {
- return Engine_GetOffset( Engine_FindPattern(Pattern, PatternSize) + ShiftAmount );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement