When invoking WriteProcessMemory, how can you get it to patch decimal instead of heximal. I have tried writing it all diffrent ways. I've tried to get it to write in hex; but for some reason it patches 32 to the offset instead of the 66 66.. I figure I can sole this by writing it in decimal, which is '26214';but it won't patch at all when I do that. If someone would be so kind to help I would appreciate it..... writebytes db '66,66' address equ 0079A688h invoke WriteProcessMemory,gameprocess,address,offset writebytes,1,NULL invoke CloseHandle, phandle
Posted on 2001-05-02 01:56:00 by Mr. Ying
There are two ways you could do this... Either write: writebytes db '66h,66h' ; h means hex value or writebytes db '102,102' ; dec equivalent of 66h
Posted on 2001-05-02 02:27:00 by JimmyClif
Thank you, I was able to get my program to patch memory somewhat correctly now. However, I have run into a diffrent problem..... I have 2 bytes, A3 and A6. When ever I try to compile my program it gives me this error. error A2006, undefined symbol A3h error A2006, undefined symbol A6h what does this mean and how can I fix it???? writebytes1 db 66h writebytes2 db 66h writebytes3 db A3h writebytes4 db 88h writebytes5 db A6h writebytes6 db 79h writebytes7 db 00h address1 equ 0079A688h address2 equ 0079A689h address3 equ 0044CA9Ch address4 equ 0044CA9Dh address5 equ 0044CA9Eh address6 equ 0044CA9Fh address7 equ 0044CAA0h address8 equ 0044CAA1h
Posted on 2001-05-02 11:36:00 by Mr. Ying
Any given piece of text in the file starts with an ascii character. Each piece of text is either a reserved word, or some user defined value (or label). Because hex values may start with an ascii character they are assumed to be a label instead (you can have a variable called A6 if you wanted right?), so all hex values must start with a number, so in your case you need to precede it with a '0' in order that the compiler can evaluate it as a number not some label or variable. Basically change: "writebytes3 db A3h" -> "writebytes3 db 0A3h" "writebytes5 db A6h" -> "writebytes5 db 0A6h" Then masm will realise you mean a number (and the h at the end means its hex). Mirno
Posted on 2001-05-02 12:01:00 by Mirno
....BTW if you use "t" after a number, MASM knows it's decimal... Just My 2¢,
Posted on 2001-05-03 00:06:00 by *unknown*
Thanks everyone, I rewrote the source code as everyone suggested and it works perfectly. If anyone else has any suggestions on how I can improve this please post ;). It's going to become an anti-cheat memory patch... .386 .model flat, stdcall option casemap :none include \masm32\include\windows.inc include \masm32\include\kernel32.inc include \masm32\include\user32.inc includelib \masm32\lib\kernel32.lib includelib \masm32\lib\user32.lib checkforgame proto WriteValue proto DlgProc proto :DWORD,:DWORD,:DWORD,:DWORD Winmain proto :DWORD,:DWORD,:DWORD,:DWORD .data memname db "Delta Force 2, V1.06.15",0 ACPPATCH db "Deltaforcer Anti Cheat",0 TSPY db "TRAINER SPY",0 PEDREZ db "DF2 THE MEGA TRAINER",0 found db "trainer found, shutting down df2",0 error db "Error !!!!!",0 func db "RegisterServiceProcess", 0 szClassName db "Naughty!!!!!",0 CHEATER db "Naughty,Naughty... Don't be a CHEATER!! ;)",0 writebytes1 db 66h writebytes2 db 66h writebytes3 db 0A3h writebytes4 db 88h writebytes5 db 0A6h writebytes6 db 79h writebytes7 db 00h address1 equ 0079A688h address2 equ 0079A689h address3 equ 0044CA9Ch address4 equ 0044CA9Dh address5 equ 0044CA9Eh address6 equ 0044CA9Fh address7 equ 0044CAA0h address8 equ 0044CAA1h ID_TIMER equ 1 TIMER_INTERRUPT equ 1000 pid dd ? phandle dd ? gamewnd dd ? dwprocessid dd ? gameprocess dd ? hDlg HWND ? RSP dd ? IsWin dd ? statClass db "STATIC",0 hInstance dd 0 kernel32 db "kernel32.dll", 0 hWnd dd 0 Kernel BYTE "Kernel32.dll",0 RegServiceProc BYTE "RegisterServiceProcess",0 .const IDD_DIALOG1 equ 101 .code start: invoke GetModuleHandle, NULL mov hInstance, eax Invoke DialogBoxParam, hInstance, IDD_DIALOG1, NULL, NULL, NULL invoke ShowWindow ,hWnd,SW_HIDE Invoke FindWindow, NULL, ADDR memname invoke GetWindowThreadProcessId, eax, offset dwprocessid invoke OpenProcess,PROCESS_VM_WRITE OR PROCESS_VM_OPERATION,NULL,dwprocessid mov gameprocess, eax invoke WriteValue invoke GetModuleHandle ,ADDR Kernel invoke GetProcAddress ,eax,ADDR RegServiceProc push TRUE push NULL call dword ptr eax invoke DialogBoxParamA,hInstance,eax,0,addr DlgProc,0 invoke ExitProcess,0 WinMain proc hInst:DWORD,hPrevInst:DWORD,CmdLine:DWORD,CmdShow:DWORD LOCAL wc :WNDCLASSEX LOCAL msg :MSG invoke RegisterClassEx,ADDR wc invoke CreateWindowEx,WS_EX_LEFT,ADDR szClassName,NULL,WS_ICONIC, NULL,NULL,NULL,NULL,NULL,NULL,hInst,NULL mov hWnd,eax WinMain endp WriteValue Proc patchloop: Invoke FindWindow, NULL, ADDR ACPPATCH .if (eax==0) ;if eax = 0 then its not running ret 0 .elseif (eax==1) jmp looptyloop .endif Invoke FindWindow, NULL, ADDR TSPY .if (eax==0) ;if eax = 0 then its not running jmp looptyloop .elseif (eax==1) jmp looptyloop .endif invoke FindWindow,ADDR PEDREZ,NULL mov IsWin, eax .if IsWin != NULL invoke MessageBox,hWnd,ADDR CHEATER,ADDR szClassName,MB_OK mov eax, 0 ret .endif looptyloop: invoke GetModuleHandle ,ADDR Kernel invoke GetProcAddress ,eax,ADDR RegServiceProc push TRUE push NULL call dword ptr eax invoke WriteProcessMemory,gameprocess,address1,offset writebytes1,1,NULL invoke WriteProcessMemory,gameprocess,address2,offset writebytes2,1,NULL invoke WriteProcessMemory,gameprocess,address3,offset writebytes3,1,NULL invoke WriteProcessMemory,gameprocess,ad
Posted on 2001-05-03 00:23:00 by Mr. Ying