.386 .model flat, stdcall option casemap:none include \code\winasm\include\windows.inc include \code\winasm\include\kernel32.inc include \code\winasm\include\user32.inc includelib \code\winasm\lib\kernel32.lib includelib \code\winasm\lib\user32.lib OFFSET_CHEAT_VAR equ 08ACA89h ; cheat variable. OFFSET_CHEAT_CHK equ 0660CE7h ; cheat check opcode. ;------------ CONST --------- .const g_szWindowTitle db "Hitman Blood Money 1.2 cheat enabler - by ZoiD", 0h g_szHitmanWindowName db "Hitman Blood Money", 0h g_szHitmanClassName db "ZSystemClass000",0h g_szSuccessMsg db "Cheats have been enabled.", 0dh, "Press 'C' ingame to bring up the cheat menu.", 0dh, "You can close this window.", 0h g_szAlreadyEnabled db "Cheats are already enabled,", 0dh, "to disable them you must restart the game.", 0h g_szFailureMsg db "There was a problem enabling Hitman Blood Money 1.2 cheats.", 0h g_szNoWindow db "Hitman Blood Money 1.2 was not found.", 0h ;------------ DATA ---------- .data ;------------ DATA? ---------- .data? ;------------ CODE ---------- .code main: push ESI push EDI push ECX xor EDI, EDI mov ESI, ESP invoke FindWindow, offset g_szHitmanClassName, offset g_szHitmanWindowName .if EAX == EDI mov EAX, offset g_szNoWindow jmp @F .endif invoke GetWindowThreadProcessId, EAX, ESI invoke OpenProcess, PROCESS_ALL_ACCESS, EDI, dword ptr [ ESI ] push EAX invoke ReadProcessMemory, EAX, OFFSET_CHEAT_CHK, ESI, 2, EDI pop EAX .if word ptr [ ESI ] == 09090h mov EAX, offset g_szAlreadyEnabled jmp @F .endif mov word ptr [ ESI ], 09090h invoke WriteProcessMemory, EAX, OFFSET_CHEAT_CHK, ESI, 2, EDI .if EAX != EDI mov EAX, offset g_szSuccessMsg .else mov EAX, offset g_szFailureMsg .endif @@: invoke MessageBox, EDI, EAX, offset g_szWindowTitle, MB_ICONINFORMATION pop ECX pop EDI pop ESI ret end main