Modifier of Red Alert 2 Written by win32asm

Source: Internet
Author: User

From http://zerray.com/

 

Because the locations where money is stored in Red Police 2 are different each time they are loaded, it is not possible to simply writeprocessmemory. However, there are still some solutions. Find the address once, and then click the next breakpoint at the address. After dynamic tracking, you will find that the Code contains a push eax address that is used to save money. At this point, the value of each eax plus 2e8h is the address for saving money. Hey, you just need to do something here? Find a free place in the process space, such as address a and B not far away from it, and change the place where push eax is pushed to jmp B and write mov A in B, in this way, eax stores the value in a fixed place, then writes several corrupted commands behind B, and finally returns JMP to the original address. Okay. Now we only need to get the address at location a and get the money address at 2e8h. Then we can change the money. Haha! As for the change, I did not try it. The methods are similar.

The following code applies only to WINXP and is used for Yuli's revenge. Each time you press Alt + 1 plus 50000 of the money.

. 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

Wm_shellnotify equ wm_user + 5
Idi_tray equ 0
Yuriicon equ 10000
Hotkeyid equ 0abc0h

. Const
Appmutex dB 'fixyurimutex ', 0
Alreadyrun dB 'fixyuri is already running! ', 0
Appname dB 'xyuri ', 0
Classname dB 'xyuriclass ', 0
Targettitle dB 'yuri's revenge', 0
Hinttext dB 'Press Alt + 1 add 50000 $ ', 0
Yurinotfound dB 'yuri's revenge is not running! ', 0
Addr1 dd 004a2593h; Address of push eax, which may be different on other machines
Addr2 dd 00b78f10h; location where the code is saved
Addr3 dd 00b78f00h; location of the saved address
Data1 dB 0e9h, 078 H, 069 H, 06dh, 000 h, 090 h; JMP 00b78f10h machine code
Data2 dB 0a3h, 000 h, 08fh, 0b7h, 000 h, 050 H, 0ffh, 051 H, 018 H, 033 H, 0d2h, 0e9h, 079 H, 096 H, 092 H, 0ffh; MoV [00b78f10h], eax; push eax; call dword ptr ds: [ECx + 18]; XOR edX, EDX; JMP 004a2599h machine code

. Data
PID dd 0
HD dd 0

. Data?
Inst hinstance?
CMD lpstr?
Note policyicondata <?>
ICO dd?
TMP dd?
Addr4 dd?
Dwflag dd?

. 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 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
Local hwnd: hwnd

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 + 1
MoV WC. lpszmenuname, null
MoV WC. lpszclassname, offset classname
Invoke loadicon, hinst, yuriicon
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 ,/
50 ,/
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
Local HDC: HDC
Local PS: paintstruct
Local rect: rect
. If umsg = wm_create
Invoke registerhotkey, hwnd, hotkeyid, mod_alt, vk_1
. Elseif umsg = wm_paint
Invoke beginpaint, hwnd, ADDR PS
MoV HDC, eax
Invoke getclientrect, hwnd, ADDR rect
Invoke drawtext, HDC, ADDR hinttext,-1, ADDR rect ,/
Dt_center or dt_vcenter or dt_singleline
. 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_hotkey
. If wparam = hotkeyid
. 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
. If HD! = 0
Invoke writeprocessmemory, HD, addr1, ADDR data1, sizeof data1, null
Invoke writeprocessmemory, HD, addr2, ADDR data2, sizeof data2, null
Invoke sleep, 1000
. Else
Invoke setforegroundwindow, hwnd
Invoke MessageBox, hwnd, ADDR yurinotfound, ADDR appname, mb_ OK or mb_iconwarning
. Endif
. Else
Invoke readprocessmemory, HD, addr3, addr tmp, sizeof TMP, null
. If eax
Push TMP
Pop addr4
Add addr4, 02e8h
Invoke readprocessmemory, HD, addr4, addr tmp, sizeof TMP, null
Add TMP, 50000
Invoke writeprocessmemory, HD, addr4, addr tmp, sizeof TMP, null
. Else
MoV HD, 0
. Endif
. Endif
. Endif
. Elseif umsg = wm_destroy
Invoke unregisterhotkey, hwnd, hotkeyid
Invoke postquitmessage, null
. Else
Invoke defwindowproc, hwnd, umsg, wparam, lparam
RET
. Endif
XOR eax, eax
RET
Wndproc endp

End start

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.