Problem mit Memory auslesen..

08/04/2014 12:10 MrBlubZ0r#1
Hallo,
Also mein Problem besteht darin, ich weiß nicht wie ich pointer wie z.B "nostaleX.dat"+Adresse auslesen kann.. Die normalen pointer sind kein Problem.
Ich möchte include nomadmemory behalten... Also keine pointer.au3

normalerweise trage ich es so ein...

Hoffe mir kann jemand helfen :3


EDIT: LOL wenn ihr den Thread ließt dann seht ihr in der ersten Zeile einen Fehler...
Reloaded die Page und der fehler ist weg :O
08/04/2014 15:00 YatoDev#2
_MemoryModuleGetBaseAdress()

der satz ist schwachsin : "Ich möchte include nomadmemory behalten... Also keine pointer.au3"
08/04/2014 15:22 MrBlubZ0r#3
Wieso?...
Wenn ich #include NomadMemory.au3 habe kann ich keine #include Pointer.au3 haben...
Könntest du mir kurz Zeigen wie das mit dem _MemoryModuleGetBaseAdress() funktioniert mit dem Beispiel was ich im Spoiler habe?
08/04/2014 15:28 alpines#4
Natürlich kannst du die haben. Die OriginalNomadMemory hatte die Pointer-Funktionen noch nicht, deshalb ist sie überall mit den Pointer funktionen zu finden.
08/04/2014 15:32 YatoDev#5
Quote:
Originally Posted by alpines View Post
Natürlich kannst du die haben. Die OriginalNomadMemory hatte die Pointer-Funktionen noch nicht, deshalb ist sie überall mit den Pointer funktionen zu finden.
ob die datei nun pointer.au3 oder nomadmemory.au3 heist ist völlig egal. die funktionen wurden ja nur verbessert(bugfixes) und pointer funktionen hinzugefügt.

@TE
doppelklick auf die Memorywieauchimmer.au3 zur MemoryModuleGetBaseAdress funktion scrollen und lesen

Modul == z.B "nostaleX.dat"
08/04/2014 16:04 alpines#6
Zu Debugzwecken kannst du die Standard-Imagebase nehmen oder nimm die Imagebase aus dem CE Debugger. Im Script musst du dann _MemoryModuleGetBaseAddress verwenden.
08/04/2014 16:24 MrBlubZ0r#7
Okay ich versuch einfach mal :DDD
Ich guck mir jetzt erstmal die NomadMemory an ob meine schon die Function hat :D
Sou Dankeschön schonmal ;)

also ich habe in meiner nomadmemory.au3 keine function wie _MemoryModuleGetBaseAddress
naja Wenn ihr wollt stelle ich mal für kurze zeit mein Script online...
und ihr könnt mir sagen ob ich das so lassen kann wenn ich die nomadmemory durch eine pointer.au3 ersetze..
08/04/2014 16:50 alpines#8
Code:
Func _MemoryModuleGetBaseAddress($iPID, $sModule)
    If Not ProcessExists($iPID) Then Return SetError(1, 0, 0)

    If Not IsString($sModule) Then Return SetError(2, 0, 0)

    Local   $PSAPI = DllOpen("psapi.dll")

    ;Get Process Handle
    Local   $hProcess
    Local   $PERMISSION = BitOR(0x0002, 0x0400, 0x0008, 0x0010, 0x0020) ; CREATE_THREAD, QUERY_INFORMATION, VM_OPERATION, VM_READ, VM_WRITE

    If $iPID > 0 Then
        Local $hProcess = DllCall("kernel32.dll", "ptr", "OpenProcess", "dword", $PERMISSION, "int", 0, "dword", $iPID)
        If $hProcess[0] Then
            $hProcess = $hProcess[0]
        EndIf
    EndIf

    ;EnumProcessModules
    Local   $Modules = DllStructCreate("ptr[1024]")
    Local   $aCall = DllCall($PSAPI, "int", "EnumProcessModules", "ptr", $hProcess, "ptr", DllStructGetPtr($Modules), "dword", DllStructGetSize($Modules), "dword*", 0)
    If $aCall[4] > 0 Then
        Local   $iModnum = $aCall[4] / 4
        Local   $aTemp
        For $i = 1 To $iModnum
            $aTemp =  DllCall($PSAPI, "dword", "GetModuleBaseNameW", "ptr", $hProcess, "ptr", Ptr(DllStructGetData($Modules, 1, $i)), "wstr", "", "dword", 260)
            If $aTemp[3] = $sModule Then
                DllClose($PSAPI)
                Return Ptr(DllStructGetData($Modules, 1, $i))
            EndIf
        Next
    EndIf

    DllClose($PSAPI)
    Return SetError(-1, 0, 0)

EndFunc
08/04/2014 17:17 MrBlubZ0r#9
Genial Danke.
Eine Frage hab ich noch auf Lager..
Kann ich jetzt dein Script einfach in meine NomadMemory.au3 kopieren?
Super Forum hier. :)

Naja richtig mieß...
Ich bekomme es einfach nicht hin..

Könnte mir jemand ein Beispiel machen?..
08/04/2014 18:04 alpines#10
Hier mal für Solitaire.

Code:
#include <NomadMemory.au3>
#AutoIt3Wrapper_UseX64=y
#RequireAdmin
#include <Array.au3>

$iPID = ProcessExists("solitaire.exe")
Local $aOffsets[3] = [0, 0x50, 0x14]

$hOpen = _MemoryOpen($iPID)
$sBase = _MemoryModuleGetBaseAddress($iPID, "solitaire.exe")
$a = _MemoryPointerRead($sBase + 0xBAFA8, $hOpen, $aOffsets)
_ArrayDisplay($a)
_MemoryClose($hOpen)

Func _MemoryModuleGetBaseAddress($iPID, $sModule)
    If Not ProcessExists($iPID) Then Return SetError(1, 0, 0)

    If Not IsString($sModule) Then Return SetError(2, 0, 0)

    Local   $PSAPI = DllOpen("psapi.dll")

    ;Get Process Handle
    Local   $hProcess
    Local   $PERMISSION = BitOR(0x0002, 0x0400, 0x0008, 0x0010, 0x0020) ; CREATE_THREAD, QUERY_INFORMATION, VM_OPERATION, VM_READ, VM_WRITE

    If $iPID > 0 Then
        Local $hProcess = DllCall("kernel32.dll", "ptr", "OpenProcess", "dword", $PERMISSION, "int", 0, "dword", $iPID)
        If $hProcess[0] Then
            $hProcess = $hProcess[0]
        EndIf
    EndIf

    ;EnumProcessModules
    Local   $Modules = DllStructCreate("ptr[1024]")
    Local   $aCall = DllCall($PSAPI, "int", "EnumProcessModules", "ptr", $hProcess, "ptr", DllStructGetPtr($Modules), "dword", DllStructGetSize($Modules), "dword*", 0)
    If $aCall[4] > 0 Then
        Local   $iModnum = $aCall[4] / 4
        Local   $aTemp
        For $i = 1 To $iModnum
            $aTemp =  DllCall($PSAPI, "dword", "GetModuleBaseNameW", "ptr", $hProcess, "ptr", Ptr(DllStructGetData($Modules, 1, $i)), "wstr", "", "dword", 260)
            If $aTemp[3] = $sModule Then
                DllClose($PSAPI)
                Return Ptr(DllStructGetData($Modules, 1, $i))
            EndIf
        Next
    EndIf

    DllClose($PSAPI)
    Return SetError(-1, 0, 0)

EndFunc

;=================================================================================================
; Function:   _MemoryPointerRead ($iv_Address, $ah_Handle, $av_Offset[, $sv_Type])
; Description:    Reads a chain of pointers and returns an array containing the destination
;               address and the data at the address.
; Parameter(s):  $iv_Address - The static memory address you want to start at. It must be in
;                          hex format (0x00000000).
;               $ah_Handle - An array containing the Dll handle and the handle of the open
;                         process as returned by _MemoryOpen().
;               $av_Offset - An array of offsets for the pointers.  Each pointer must have an
;                         offset.  If there is no offset for a pointer, enter 0 for that
;                         array dimension.
;               $sv_Type - (optional) The "Type" of data you intend to read at the destination
;                         address.  This is set to 'dword'(32bit(4byte) signed integer) by
;                         default.  See the help file for DllStructCreate for all types.
; Requirement(s):   The $ah_Handle returned from _MemoryOpen.
; Return Value(s):  On Success - Returns an array containing the destination address and the value
;                         located at the address.
;               On Failure - Returns 0
;               @Error - 0 = No error.
;                      1 = $av_Offset is not an array.
;                      2 = Invalid $ah_Handle.
;                      3 = $sv_Type is not a string.
;                      4 = $sv_Type is an unknown data type.
;                      5 = Failed to allocate the memory needed for the DllStructure.
;                      6 = Error allocating memory for $sv_Type.
;                      7 = Failed to read from the specified process.
; Author(s):        Nomad
; Note(s):      Values returned are in Decimal format, unless a 'char' type is selected.
;               Set $av_Offset like this:
;               $av_Offset[0] = NULL (not used)
;               $av_Offset[1] = Offset for pointer 1 (all offsets must be in Decimal)
;               $av_Offset[2] = Offset for pointer 2
;               etc...
;               (The number of array dimensions determines the number of pointers)
;=================================================================================================
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   ;==>_MemoryPointerRead
08/04/2014 18:19 MrBlubZ0r#11
Wenn ich das so versuche auszuführen bekomme ich folgenden Error:

error: _MemoryModulGetBaseAddress() already defined.

Hab jetzt _MemoryModulGetBaseAddress() wieder aus meiner Nomadmemory gelöscht jetzt funzt das ...
08/04/2014 18:20 alpines#12
Dann nimm die ausm Script raus, die ist vermutlich schon in deiner NomadMemory.au3 drinne.
Errorhandling ist bei dir fehl am Platze oder?
08/04/2014 18:34 MrBlubZ0r#13
[Only registered and activated users can see links. Click Here To Register...]
Super jetzt wird schonmal mein Level ausgelesen :D
Die 40 EGold hast du dir schonmal verdient ;)
Mach bitte eine Treasure auf die 40 EGOLD kostet ;)
naja ich habs ja grade selbst geregelt :D ohne deine nachricht zu lesen :D
08/08/2014 13:03 MrBlubZ0r#14
Kann geclosed werden.