Quote:
Originally posted by stillnoob@Dec 7 2006, 09:25
Nice topic. Congratz...
Can you make an MemWrite function in AutoIt3 ?
|
Here is a modified version of the MemWrite function from the UDF that Christoph_ had mentioned earlier. It is meant to be compatible with my previous memory functions.
Code:
;Write to a Process Handle Returned by MemOpen at a Certain Address with an Injection and Type
Func MemWrite( $ah_Mem, $i_Address, $v_Inject, $s_Type )
If $s_Type = '' Then
$v_Inject = StringSplit($v_Inject, '')
Local $v_Struct = DllStructCreate('byte[' & $v_Inject[0] + 1 & ']')
For $i = 1 To $v_Inject[0]
DllStructSetData($v_Struct, 1, Asc($v_Inject[$i]), $i)
Next
Else
Local $v_Struct = DllStructCreate($s_Type)
DllStructSetData($v_Struct, 1, $v_Inject, 1)
EndIf
$av_Call = DllCall($ah_Mem[0], 'int', 'WriteProcessMemory', 'int', $ah_Mem[1], 'int', $i_Address, 'ptr', DllStructGetPtr($v_Struct), 'int', DllStructGetSize($v_Struct), 'int', '')
Return $av_Call[0]
EndFunc
[Only registered and activated users can see links. Click Here To Register...]
Here is an example usage (using the previous memory functions):
Code:
;Get the Process ID of Conquer.exe
$pid=ProcessExists("Conquer.exe")
;Check if Conquer.exe is Running
If $pid Then
;Open the Process for memory Handling
$mem=MemOpen($pid)
If Not @error Then
;Set the Amount of Gold (Client Side) to 100,190
MemWrite($mem, 0x004FF1E0, 100190, "int")
;Close the Memory Access and Process Handle
MemClose($mem)
EndIf
EndIf