From http://zerray.com/
I wrote it some time ago and it feels perfect. It can lock money, power and power usage, and increase the construction speed. It can also work on WIN98 and WINXP platforms.
. 386
. Model flat, stdcall
Option Casemap: None
Include/masm32/include/Windows. inc
Include/masm32/include/kernel32.inc
Include/masm32/include/user32.inc
Include/masm32/include/shell32.inc
Includelib/masm32/lib/kernel32.lib
Includelib/masm32/lib/user32.lib
Includelib/masm32/lib/shell32.lib
Winmain proto: DWORD,: DWORD
Keyproc proto: DWORD,: DWORD,: DWORD
Getosversion proto
Wm_shellnotify equ wm_user + 5
Idi_tray equ 0
Raicon equ 10000
Timerid equ 1
Buttonid1 equ 1
Buttonid2 equ 2
Buttonid3 equ 3
Buttonid4 equ 4
Hotkeyid1 equ 0abc1h
Hotkeyid2 equ 0abc2h
Hotkeyid3 equ 0abc3h
Hotkeyid4 equ 0abc4h
. Const
Appmutex dB 'racheatmutex ', 0
Alreadyrun dB 'ra cheater is already running! ', 0
Appname dB 'ra cheater ', 0
Classname dB 'racheaterclass', 0
Targettitle dB 'Red alert ', 0
Buttonclass dB 'button ', 0
Button1 dB 'lock money (Alt + 1) ', 0
Button2 dB 'lock used power (Alt + 2) ', 0
Button3 dB 'lock power (Alt + 3) ', 0
Button4 dB 'speed up (Alt + 4) ', 0
Value1 dd 30000.
Value2 dd 0
Value3 dd 500.
Value4 dd 0f0h
. Data
Flag1 db 0
Flag2 db 0
Flag3 db 0
PID dd 0
HD dd 0
. Data?
Inst hinstance?
CMD lpstr?
Note policyicondata <?>
ICO dd?
Osver dd?
Hhook dd?
Addr1 dd?
Addr2 dd?
Addr3 dd?
Addr4 dd?
Hwnd?
. Code
Start:
Invoke createmutex, null, false, ADDR appmutex
Invoke getlasterror
. If eax = error_already_exists
Invoke MessageBox, null, ADDR alreadyrun, ADDR appname, mb_ OK or mb_iconwarning
Invoke exitprocess, 0
. Endif
Invoke getosversion; determines the system type
MoV osver, eax
. If osver = ver_platform_win32_nt; assign different addresses based on the system type. Maybe it is different from my address on your machine. FPE can search for it.
MoV addr1, 0a431d17h
MoV addr2, 0a431d67h
MoV addr3, 0a431d63h
MoV addr4, 0a431d53h
. Else
MoV addr1, 01c31d17h
MoV addr2, 01c31d67h
MoV addr3, 01c31d63h
MoV addr4, 0a431d53h
. Endif
Invoke getmodulehandle, null
MoV inst, eax
Invoke getcommandline
MoV cmd, eax
Invoke winmain, inst, null, CMD, sw_minimize
Invoke exitprocess, eax
Winmain proc hinst: hinstance, hprevinst: hinstance, using line: lpstr, cmdshow: DWORD
Local WC: wndclassex
Local MSG: msg
MoV WC. cbsize, sizeof wndclassex
MoV WC. style, cs_hredraw or cs_vredraw
MoV WC. lpfnwndproc, offset wndproc
MoV WC. cbclsextra, null
MoV WC. cbwndextra, null
Push hinst
Pop WC. hinstance
MoV WC. hbrbackground, color_window
MoV WC. lpszmenuname, null
MoV WC. lpszclassname, offset classname
Invoke loadicon, hinst, raicon
MoV WC. hicon, eax
MoV WC. hiconsm, eax
MoV ICO, eax
Invoke loadcursor, null, idc_arrow
MoV WC. hcursor, eax
Invoke registerclassex, ADDR WC
Invoke createmediawex, null ,/
ADDR classname ,/
ADDR appname ,/
Ws_overlappedwindow and not ws_maximizebox and not ws_sizebox ,/
Cw_usedefault ,/
Cw_usedefault ,/
200 ,/
225 ,/
Null ,/
Null ,/
Hinst ,/
Null
MoV hwnd, eax
Invoke showwindow, hwnd, cmdshow
Invoke updatewindow, hwnd
. While true
Invoke getmessage, addr msg, null, 0, 0
. Break. If (! Eax)
Invoke translatemessage, ADDR msg
Invoke dispatchmessage, ADDR msg
. Endw
MoV eax, MSG. wparam
RET
Winmain endp
Wndproc proc hwnd: hwnd, umsg: uint, wparam: wparam, lparam: lparam
. If umsg = wm_create
Invoke settimer, hwnd, timerid, 500, null
. If osver = ver_platform_win32_nt
Invoke registerhotkey, hwnd, hotkeyid1, mod_alt, vk_1
Invoke registerhotkey, hwnd, hotkeyid2, mod_alt, vk_2
Invoke registerhotkey, hwnd, hotkeyid3, mod_alt, vk_3
Invoke registerhotkey, hwnd, hotkeyid4, mod_alt, vk_4
. Else; since the shortcut key registered under Win98 becomes invalid after entering the game, you have to use a hook to implement the shortcut key.
Invoke setwindowshookex, wh_journalrecord, ADDR keyproc, inst, null
MoV hhook, eax
. Endif
Invoke createmediawex, null, ADDR buttonclass, ADDR button1 ,/
Bs_pushbutton or ws_visible or ws_child, 0, 0,195, 50 ,/
Hwnd, buttonid1, inst, null
Invoke createmediawex, null, ADDR buttonclass, ADDR button2 ,/
Bs_pushbutton or ws_visible or ws_child, 0, 50,195, 50 ,/
Hwnd, buttonid2, inst, null
Invoke createmediawex, null, ADDR buttonclass, ADDR button3 ,/
Bs_pushbutton or ws_visible or ws_child, 0,100,195, 50 ,/
Hwnd, buttonid3, inst, null
Invoke createmediawex, null, ADDR buttonclass, ADDR button4 ,/
Bs_pushbutton or ws_visible or ws_child, 0,150,195, 50 ,/
Hwnd, buttonid4, inst, null
. Elseif umsg = wm_size
. If wparam = size_minimized
MoV note. cbsize, sizeof policyicondata
Push hwnd
Pop note. hwnd
MoV note. uid, idi_tray
MoV note. uflags, nif_icon or nif_message or nif_tip
MoV note. ucallbackmessage, wm_shellnotify
Push ICO
Pop note. hicon
Invoke lstrcpy, ADDR note. sztip, ADDR appname
Invoke showwindow, hwnd, sw_hide
Invoke shell_policyicon, nim_add, ADDR note
. Endif
. Elseif umsg = wm_shellnotify
. If wparam = idi_tray
. If lparam = wm_lbuttondown
Invoke shell_policyicon, nim_delete, ADDR note
Invoke showwindow, hwnd, sw_restore
Invoke setforegroundwindow, hwnd
. Endif
. Endif
. Elseif umsg = wm_timer
. If Hd = 0
Invoke findwindow, 0, ADDR targettitle
. If eax! = 0
Invoke getwindowthreadprocessid, eax, ADDR PID
Invoke OpenProcess, process_all_access, false, PID
MoV HD, eax
. Endif
. Endif
. If flag1 = 1
Invoke writeprocessmemory, HD, addr1, ADDR value1, sizeof value1, null
. If eax = 0
MoV HD, 0
. Endif
. Endif
. If flag2 = 1
Invoke writeprocessmemory, HD, addr2, ADDR value2, sizeof value2, null
. If! Eax
MoV HD, 0
. Endif
. Endif
. If flag3 = 1
Invoke writeprocessmemory, HD, addr3, ADDR value3, sizeof value3, null
. If! Eax
MoV HD, 0
. Endif
. Endif
. Elseif umsg = wm_command
MoV eax, wparam
. If AX = buttonid1
XOR flag1, 1
. Elseif AX = buttonid2
XOR flag2, 1
. Elseif AX = buttonid3
XOR flag3, 1
. Elseif AX = buttonid4
. If HD
MoV edX, addr4
Invoke writeprocessmemory, HD, EDX, ADDR value4, sizeof value4, null
Add edX, 4
Invoke writeprocessmemory, HD, EDX, ADDR value4, sizeof value4, null
Add edX, 4
Invoke writeprocessmemory, HD, EDX, ADDR value4, sizeof value4, null
Add edX, 4
Invoke writeprocessmemory, HD, EDX, ADDR value4, sizeof value4, null
. Endif
. Endif
. Elseif umsg = wm_hotkey
. If wparam = hotkeyid1
XOR flag1, 1
. Elseif wparam = hotkeyid2
XOR flag2, 1
. Elseif wparam = hotkeyid3
XOR flag3, 1
. Elseif
. If HD
MoV edX, addr4
Invoke writeprocessmemory, HD, EDX, ADDR value4, sizeof value4, null
Add edX, 4
Invoke writeprocessmemory, HD, EDX, ADDR value4, sizeof value4, null
Add edX, 4
Invoke writeprocessmemory, HD, EDX, ADDR value4, sizeof value4, null
Add edX, 4
Invoke writeprocessmemory, HD, EDX, ADDR value4, sizeof value4, null
. Endif
. Endif
. Elseif umsg = wm_syskeydown
. If lparam = vk_1
XOR flag1, 1
. Elseif lparam = vk_2
XOR flag2, 1
. Elseif lparam = vk_3
XOR flag3, 1
. Endif
. Elseif umsg = wm_destroy
. If osver = ver_platform_win32_nt
Invoke unregisterhotkey, hwnd, hotkeyid1
Invoke unregisterhotkey, hwnd, hotkeyid2
Invoke unregisterhotkey, hwnd, hotkeyid3
. Else
Invoke unhookwindowshookex, hhook
. Endif
Invoke postquitmessage, null
. Else
Invoke defwindowproc, hwnd, umsg, wparam, lparam
RET
. Endif
XOR eax, eax
RET
Wndproc endp
Keyproc proc ncode: DWORD, wparam: wparam, lparam: lparam
. If ncode = hc_action
MoV edX, lparam
Assume edX: PTR eventmsg
. If [edX]. Message = wm_syskeydown
MoV eax, [edX]. paraml
. If Al = vk_1
Invoke postmessage, hwnd, wm_syskeydown, null, vk_1
. Elseif Al = vk_2
Invoke postmessage, hwnd, wm_syskeydown, null, vk_2
. Elseif Al = vk_3
Invoke postmessage, hwnd, wm_syskeydown, null, vk_3
. Endif
. Endif
. Endif
Invoke callnexthookex, hhook, ncode, wparam, lparam
RET
Keyproc endp
Getosversion proc
Local OVI: osversioninfo
MoV OVI. dwosversioninfosize, sizeof osversioninfo
Invoke getversionex, ADDR OVI
MoV eax, Ovi. dwplatformid
RET
Getosversion endp
End start
Because the address of money and other information in Red Police 98 is fixed every time it is loaded, this program can be successful. If it is changed to Red Police 2, it will use another method.