Hi brauche Hilfe von den Profis!
Also vorweg dies ist kein Bot. Ich will damit auch keinen Bot schreiben sondern nur meine Kentnisse bezüglich Memory erweitern.
Ich hab von einem Prozess [TRose.exe]
per CheatEngine einen Pointer gefunden [0x006936A8]
dazu natürlich auch die/den Offset [36]
Jetzt will ich, wie im Titel beschrieben, den Pointer + Offset in die Adresse umwandeln, wo er hinzeigt und den Wert auslesen. Das Problem hierbei ist, dass ich nicht auf die Adresse komme, auf der der Pointer eigentlich zeigt.
Wenn ich in CheatEngine nämlich den Prozess anvisiere und den Pointer + Offset eintrage kommt er auf eine richtige Adresse, bei Autoit nicht.
Hier mein Code:
Spoiler anzeigen
$Offset = 140
$pid = ProcessExists("TRose.exe");Returns the PID (3020)
$openmem = _MemoryOpen($pid);Returns nothing in MsgBox
[/autoit] [autoit][/autoit] [autoit]$baseADDR = _MemoryGetBaseAddress($openmem,1);Returns base address (3342336)
$Action_Address = "0x" & Hex($baseADDR + Dec("6936A8")); Returns 0x009C36A8
$Action_Read = _MemoryPointerRead($Action_Address, $openmem, $Offset);Returns 0 (but it's not 0)
[/autoit] [autoit][/autoit] [autoit]MsgBox(64,"Info","Address: "&$Action_Address&@CRLF&"Value: "&$Action_Read)
[/autoit]UDF's (erweiterte NomadMemory.au3)
Spoiler anzeigen
Func _MemoryOpen($iv_Pid, $iv_DesiredAccess = 0x1F0FFF, $if_InheritHandle = 1)
If Not ProcessExists($iv_Pid) Then
SetError(1)
Return 0
EndIf
Local $ah_Handle[2] = [DllOpen('kernel32.dll')]
If @Error Then
SetError(2)
Return 0
EndIf
Local $av_OpenProcess = DllCall($ah_Handle[0], 'int', 'OpenProcess', 'int', $iv_DesiredAccess, 'int', $if_InheritHandle, 'int', $iv_Pid)
If @Error Then
DllClose($ah_Handle[0])
SetError(3)
Return 0
EndIf
$ah_Handle[1] = $av_OpenProcess[0]
Return $ah_Handle
EndFunc
;==================
[/autoit] [autoit][/autoit] [autoit]Func _MemoryGetBaseAddress($ah_Handle, $iHexDec = 0)
Local $iv_Address = 0x00100000
Local $v_Buffer = DllStructCreate('dword;dword;dword;dword;dword;dword;dword')
Local $vData
Local $vType
If Not IsArray($ah_Handle) Then
SetError(1)
Return 0
EndIf
DllCall($ah_Handle[0], 'int', 'VirtualQueryEx', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer))
If Not @Error Then
$vData = Hex(DllStructGetData($v_Buffer, 2))
$vType = Hex(DllStructGetData($v_Buffer, 3))
While $vType <> "00000080"
DllCall($ah_Handle[0], 'int', 'VirtualQueryEx', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer))
$vData = Hex(DllStructGetData($v_Buffer, 2))
$vType = Hex(DllStructGetData($v_Buffer, 3))
If Hex($iv_Address) = "01000000" Then ExitLoop
$iv_Address += 65536
WEnd
If $vType = "00000080" Then
SetError(0)
If $iHexDec = 1 Then
Return Dec($vData)
Else
Return $vData
EndIf
Else
SetError(2)
Return 0
EndIf
Else
SetError(3)
Return 0
EndIf
EndFunc
;=================================================
[/autoit] [autoit][/autoit] [autoit]Func _MemoryPointerRead ($iv_Address, $ah_Handle, $av_Offset, $sv_Type = 'dword')
If IsArray($av_Offset) Then
If IsArray($ah_Handle) Then
Local $iv_PointerCount = UBound($av_Offset) - 1
Else
SetError(2)
Return 0
EndIf
Else
SetError(1)
Return 0
EndIf
Local $iv_Data[2], $i
Local $v_Buffer = DllStructCreate('dword')
For $i = 0 to $iv_PointerCount
If $i = $iv_PointerCount Then
$v_Buffer = DllStructCreate($sv_Type)
If @Error Then
SetError(@Error + 2)
Return 0
EndIf
$iv_Address = '0x' & hex($iv_Data[1] + $av_Offset[$i])
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If @Error Then
SetError(7)
Return 0
EndIf
$iv_Data[1] = DllStructGetData($v_Buffer, 1)
ElseIf $i = 0 Then
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If @Error Then
SetError(7)
Return 0
EndIf
$iv_Data[1] = DllStructGetData($v_Buffer, 1)
Else
$iv_Address = '0x' & hex($iv_Data[1] + $av_Offset[$i])
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If @Error Then
SetError(7)
Return 0
EndIf
$iv_Data[1] = DllStructGetData($v_Buffer, 1)
EndIf
Next
$iv_Data[0] = $iv_Address
Return $iv_Data
EndFunc
[/autoit]Wäre dankbar wenn mir jemand den Fehler nennen könnte bzw wie ich sonst noch die Adresse bzw den Pointer auslesen kann. Hab mal gesehen, dass Xeno sich damit beschäftigt hat vielleicht hast du ja noch was informatives für mich.