Public feed #377034

Unnamed

public text v1 · immutable
Raw Edit
·published 2007-03-01 12:07 UTC
rendered paste body
;======================================;
;---General Purpose Trainer Template---;
;======================================;
;Originally written in MASM by _masta_ ;
;For Starcraft, All i did was convert  ;
;to FASM and use invoke :)             ;
;-Aaron "Lugz" Ankiel                  ;
;======================================;


include 'win32ax.inc'

PROCESS_VM_WRITE    equ 020h		; Flags for the write-access
PROCESS_VM_OPERATION	equ 008h	; to the process

; add addresses here
; in this format:
; <label> equ (address)h
; example :

example_Add	  equ 04efe08h

; data section starts here
.data

;Startup window Caption
MBTitle db 'Trainer Template',0

;Startup window Text
MBText db 'Hello Hit Ok To Do Memory Write',13,10
       db 'Credits : _masta_',0

; Caption for Errormessages
err_cap  db "ERROR",0

; Error if Process isn't running
notrun	 db "Sorry, Process is not running",0

; Error if problem writing to mem
no_write db "There was a problem writing",13,10
	 db "to Process memory",13,10,0

; Caption for "ready"
readycap db "Ready",0

; Text for "ready"
readytxt db "Ok, variable is now changed.",0

; Add the number u are changing the address to
numchangeto dd 100

; Name of the Process window
wnd_name db "Untitled - Notepad",0

; Class of the Process window
cls_name db "Notepad",0

; Here we save the PID ...
pid_sc	 db ?

; and here the handle to the process
p_hand	 db ?

; Heres where the code section starts
.code

;program start
start:

	;Starting it up
	invoke MessageBox,0,MBText,MBTitle,MB_OK

is_process_run:

	;Find the window
	invoke FindWindowA,cls_name,wnd_name

	cmp  eax,0	    ; if 0, window is not existing
	jz   isnt_run_end; --> Process is not launched

	;Determines PID with Windowhandle and saves it
	invoke GetWindowThreadProcessId,eax,pid_sc

open_the_process:

	;Get handle
	; PUSH PID, only used when building new processes, activate write-access
	invoke OpenProcess,PROCESS_VM_WRITE OR PROCESS_VM_OPERATION,0,pid_sc

	mov  eax,p_hand     ; Save handle to p_hand

change_Minerals:

	;Changing the address of minerals
	; Can be zero mostly, Write 8 Bytes (2 Dwords),How much ?,
	; Memoryaddress, Handle to the process
	invoke WriteProcessMemory,p_hand,example_Add,numchangeto,8,0

	cmp  eax,0
	jz   error_on_write    ; If any error while writing (eax=0) -> end

Trainer_ready:

	;everything is ok
	invoke MessageBoxA,0,readytxt,readycap,MB_OK


close_the_PID_Handle:

	;Close handle
	invoke CloseHandle,p_hand
	jmp _end

error_on_write:

	;if error when writing
	invoke MessageBoxA,0,no_write,err_cap,MB_OK
	 ; Close handle before quit
	jmp  close_the_PID_Handle

isnt_run_end:

	;nothing running =(
	invoke MessageBoxA,0,notrun,err_cap,MB_OK

_end:
	;Exit
	invoke ExitProcess,0


.end start