tnok85 Newbie cheater
Reputation: 0
Joined: 12 Feb 2011 Posts: 14
|
Posted: Tue Mar 01, 2011 6:27 pm Post subject: Pointer and NomadMemory.au3 (Autoit) |
|
|
Edit: Dur... the variable is working...
MsgBox(4096, "Test", $Write)
Changed to:
MsgBox(4096, "Test", $Write[1])
Displaying properly now.
===== Original post below =====
Having a problem... Thanks to DrJohn20 for putting a tutorial up that I've been using to learn NomadMemory with CE.
I'm having a really hard time with this one though... See bottom for picture of the pointer I'm trying to read from in AutoIt, and the full code.
I can't seem to get the pointer to read correctly. "$FinalAddress" is calculating correctly, now I'm wondering if there isn't something wrong with the offsets calculating.
| Code: | ;Calculate and Write
Local $Offset[6]
$Offset[0] = 0
$Offset[1] = Dec("B4")
$Offset[2] = Dec("A8")
$Offset[3] = Dec("A4")
$Offset[4] = Dec("120")
$Offset[5] = Dec("0") |
Reversed order.. see picture. [0] is always 0.
| Code: | $StaticOffset = Dec("1C60EE8") - Dec($BaseAddress)
$FinalAddress = "0x" & Hex(Dec($BaseAddress) + $StaticOffset) |
This is calculating properly. I'm getting the same address for $FinalAddress as the address of the first pointer.
| Code: | $Write = _MemoryPointerRead($FinalAddress, $hMemory, $Offset)
;$Write = _MemoryRead("0x20A1C760", $hMemory, "wchar[10]")
MsgBox(4096, "Test", $FinalAddress)
MsgBox(4096, "Test", $Write) |
Just to make sure all the code was working right, I did a read on the address my pointer is pointing to (as you can see, it's commented out) and it's returning the value I'm looking for. So that's not the problem. (Ignore the $write variable name, I never changed it to read)
The problem (I think) is the _MemoryPointerRead and the offsets. I just cannot figure out why it's returning blank. Anybody have any idea?
Full code:
| Code: | #RequireAdmin ;User Account must have Administrator privlidges
#include <NomadMemory.au3> ;Include the NomadMemory functions in this script
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $hMemory ;A global variable
#Region ### START Koda GUI section ###
$hGUI = GUICreate("CE Tutorial Trainer", 259, 75, 192, 124)
$hAttach = GUICtrlCreateButton("Attach", 8, 8, 75, 25, $WS_GROUP)
$hDetach = GUICtrlCreateButton("Detach", 88, 8, 83, 25, $WS_GROUP)
GUICtrlSetState($hDetach, $GUI_DISABLE)
$hStep2 = GUICtrlCreateButton("Patch Step2", 8, 40, 243, 25, $WS_GROUP)
$hQuit = GUICtrlCreateButton("Quit", 176, 8, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Switch GUIGetMsg()
Case $hAttach
$hMemory = _MemoryOpen(ProcessExists("SwgClient_r.exe"))
GUICtrlSetState($hDetach,$GUI_ENABLE)
GUICtrlSetState($hAttach,$GUI_DISABLE)
Case $hDetach
_MemoryClose($hMemory)
GUICtrlSetState($hAttach,$GUI_ENABLE)
GUICtrlSetState($hDetach,$GUI_DISABLE)
Case $hStep2
_PatchStep2()
Case $hQuit
Exit
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _PatchStep2()
;Get Base Address
$BaseAddress = _MemoryGetBaseAddress($hMemory, 1)
If $BaseAddress = 0 Then
Select
Case @error = 1
MsgBox(0, "Error", "Error getting base address: " & @CRLF & "Invalid handle to open process")
Case @error = 2
MsgBox(0, "Error", "Error getting base address: " & @CRLF & "Failed to find correct allocation address")
Case @error = 3
MsgBox(0, "Error", "Error getting base address: " & @CRLF & "Failed to read from the specified process")
EndSelect
EndIf
;Calculate and Write
Local $Offset[6]
$Offset[0] = 0 ; Is ALWAYS 0.
$Offset[1] = Dec("B4")
$Offset[2] = Dec("A8")
$Offset[3] = Dec("A4")
$Offset[4] = Dec("120")
$Offset[5] = Dec("0")
$StaticOffset = Dec("1C60EE8") - Dec($BaseAddress)
$FinalAddress = "0x" & Hex(Dec($BaseAddress) + $StaticOffset)
$Write = _MemoryPointerRead($FinalAddress, $hMemory, $Offset)
;$Write = _MemoryRead("0x20A1C760", $hMemory, "wchar[10]")
MsgBox(4096, "Test", $FinalAddress)
MsgBox(4096, "Test", $Write)
EndFunc |
| Description: |
|
| Filesize: |
70.68 KB |
| Viewed: |
14331 Time(s) |

|
|
|