Wert an Speicheradresse senden,wie im Tutorial beschrieben.

  • Hallo erstmal, bin neu hier.

    Ich habe versucht, das Beispiel mit "Pinball 3D" wie im Tutorial
    beschrieben nachzumachen, krieg das aber nicht hin.

    Auch weiß ich nicht wie man das Skript aus der "memory.3au" in das
    "Pinball 3D Skript" einbindet.

    Kann mir jemand das fertige Skript posten?

    Link zum Abschnitt im Tutorial:
    http://wiki.autoit.de/wiki/index.php…_.2F_bearbeiten

    Im voraus dankend,

    Osterhase

  • Willkommen an Bo(a)rd. *g*

    Es ist ganz einfach. Du brauchst die Memory.au3 in deinem Include-Verzeichnis.
    Dann kopierst Du das "pinball"-Skript und schreibst ganz oben hin:
    #include <memory.au3>.

    Spoiler anzeigen
    [autoit]


    #include <memory.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $pidm = WinGetProcess("MineSweeper")
    $infom = _MemoryOpen($pidm)
    $readm = _MemoryRead(0x0100579C, $infom)
    MsgBox(0, "", $readm) ; aktueller Punktestand wird angezeigt

    [/autoit] [autoit][/autoit] [autoit]

    Func _Reset()
    $newm = 0
    _MemoryWrite(0x0100579C, $infom, $newm) ; Gebrauchte Zeit wird auf 0 resettet
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _weniger()
    $neweniger = $readm - 1
    _MemoryWrite(0x0100579C, $infom, $neweniger) ; gebrauchte Zeit wird um 1 Sekunde verringert.
    EndFunc

    [/autoit]


    Das sollte dann schon von alleine funktionieren.

    Einmal editiert, zuletzt von penta.phoenix (27. Oktober 2007 um 20:40)

  • Moin!

    kann sein, dass mein script (memory eintrag is von mir) net klappt, da Microsoft die speicherwerte hin und wieder ändert - bei bedarf aktualisier ich das tutorial :D

  • Hi

    ich würde sagen hole dir CheatEngine damit kannste alle Speicheraddressen auslesen dann musste nur noch die die huggy genommen hat durch deine ersetzen und schon klappts ich habe das auch vor einiger Zeit mal gemacht sollte eig kein Prob darstellen

    Gruß Redclaw

  • Hi!

    Wie ich im tutorial geschrieben habe: Ich habe auch CheatEngine benutzt (Link @ Tutorial).

    Die Speicheradressen ändern sich eben, und das herausfinden der Speicheradresse ist je nachSpiel auch nicht so einfach :)

  • Danke für die schnelle Hilfe,
    leider funktioniert das so noch nicht.

    Geänderte Speicheradressen sind in meinem Fall aber nicht die Ursache des Problems.
    Auch meinte ich "Pinnball" und nicht "Minesweeper" aber das ist ja im Prinzip egal.http://www.autoit.de/images/smilies/smile.gif
    smile

    In meinem Ordner "AutoIt3" befindet sich unter anderen ein Ordner "Include" und darin u.a. die Datei "Memory.au3", und die sieht so aus:

    Spoiler anzeigen
    [autoit]

    #include-once
    ; ====================================================================================================
    ; AutoIt Version : 3.2.+++
    ; Author ........: Paul Campbell
    ; Modified.......: Gary Frost
    ; Description ...: Memory management routines
    ; Notes .........:
    ; ====================================================================================================

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; MEMMAP Definition
    ; ====================================================================================================

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $MEM_MAP = "uint;uint;ptr"

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; MemMap Position Constants
    ; ====================================================================================================

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $MEM_MAP_HPROC = 1
    Global Const $MEM_MAP_ISIZE = 2
    Global Const $MEM_MAP_PMEM = 3

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; VirtualAlloc Allocation Type Constants
    ; ====================================================================================================

    [/autoit] [autoit][/autoit] [autoit]

    ;Global Const $MEM_COMMIT = 0x00001000
    ;Global Const $MEM_RESERVE = 0x00002000
    ;Global Const $MEM_TOP_DOWN = 0x00100000
    ;Global Const $MEM_SHARED = 0x08000000

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; VirtualFree FreeType Constants
    ; ====================================================================================================

    [/autoit] [autoit][/autoit] [autoit]

    ;Global Const $MEM_DECOMMIT = 0x00004000
    ;Global Const $MEM_RELEASE = 0x00008000

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; VirtualAlloc Protection Constants
    ; ====================================================================================================

    [/autoit] [autoit][/autoit] [autoit]

    ;Global Const $PAGE_NOACCESS = 0x00000001
    ;Global Const $PAGE_READONLY = 0x00000002
    ;Global Const $PAGE_READWRITE = 0x00000004
    ;Global Const $PAGE_EXECUTE = 0x00000010
    ;Global Const $PAGE_EXECUTE_READ = 0x00000020
    ;Global Const $PAGE_EXECUTE_READWRITE = 0x00000040
    ;Global Const $PAGE_GUARD = 0x00000100
    ;Global Const $PAGE_NOCACHE = 0x00000200

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; OpenProcess Access Constants
    ; ====================================================================================================

    [/autoit] [autoit][/autoit] [autoit]

    ;Global Const $PROCESS_TERMINATE = 0x00000001
    ;Global Const $PROCESS_CREATE_THREAD = 0x00000002
    ;Global Const $PROCESS_VM_OPERATION = 0x00000008
    ;Global Const $PROCESS_VM_READ = 0x00000010
    ;Global Const $PROCESS_VM_WRITE = 0x00000020
    ;Global Const $PROCESS_DUP_HANDLE = 0x00000040
    ;Global Const $PROCESS_CREATE_PROCESS = 0x00000080
    ;Global Const $PROCESS_SET_INFORMATION = 0x00000200
    ;Global Const $PROCESS_QUERY_INFORMATION = 0x00000400
    ;Global Const $SYNCHRONIZE = 0x00100000
    ;Global Const $PROCESS_ALL_ACCESS = 0x001F0FFF

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; Description ..: Releases a memory map structure
    ; Parameters ...: $rMemMap - The MEM_MAP structure to release
    ; Return values : True - Success
    ; False - Function failed
    ; Notes ........: $rMemMap must have first been initialized with a call to _MemInit
    ; ====================================================================================================
    Func _MemFree(ByRef $rMemMap)
    Local $hProcess
    Local $pMemory
    Local $bResult
    Local $MEM_RELEASE = 0x00008000

    [/autoit] [autoit][/autoit] [autoit]

    $hProcess = DllStructGetData($rMemMap, $MEM_MAP_HPROC)
    $pMemory = DllStructGetData($rMemMap, $MEM_MAP_PMEM)
    Switch @OSVersion
    Case "WIN_ME", "WIN_98", "WIN_95"
    $bResult = _VirtualFree($pMemory, 0, $MEM_RELEASE)
    Case Else
    $bResult = _VirtualFreeEx($hProcess, $pMemory, 0, $MEM_RELEASE)
    EndSwitch
    _CloseHandle($hProcess)
    $rMemMap = 0
    Return $bResult
    EndFunc ;==>_MemFree

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; Description ..: Closes an open object handle
    ; Parameters ...: $hObject - Handle of object to close
    ; Return values : Success - True
    ; Failure - False
    ; ====================================================================================================
    Func _CloseHandle($hObject)
    Local $aResult = DllCall("Kernel32.dll", "int", "CloseHandle", "int", $hObject)
    If @error Or Not IsArray($aResult) Then Return SetError(-1, -1, 0)
    Return $aResult[0]
    EndFunc ;==>_CloseHandle

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; Description ..: Reserves or commits a region of pages in the virtual address space of the calling
    ; process. Memory allocated by this function is automatically initialized to zero.
    ; Parameters ...: $pAddress - Specifies the desired starting address of the region to allocate.
    ; If the memory is being reserved, the specified address is rounded down to the next
    ; 64-kilobyte boundary. If the memory is already reserved and is being committed,
    ; the address is rounded down to the next page boundary. To determine the size of a
    ; page on the host computer, use the GetSystemInfo function. If this parameter is
    ; 0, the system determines where to allocate the region.
    ; $iSize - Specifies the size, in bytes, of the region. If the $pAddress
    ; parameter is 0, this value is rounded up to the next page boundary. Otherwise, the
    ; allocated pages include all pages containing one or more bytes in the range from
    ; $pAddress to ($pAddress + $iSize). This means that a 2-byte range straddling a
    ; page boundary causes both pages to be included in the allocated region.
    ; $iAllocation - Specifies the type of allocation:
    ; MEM_COMMIT - Allocates physical storage in memory or in the paging file on disk
    ; for the specified region of pages. An attempt to commit an already committed
    ; page will not cause the function to fail. This means that a range of committed
    ; or decommitted pages can be committed without having to worry about a failure.
    ; MEM_RESERVE - Reserves a range of the process's virtual address space without
    ; allocating any physical storage. The reserved range cannot be used by any other
    ; allocation operations until it is released. Reserved pages can be committed in
    ; subsequent calls to VirtualAlloc.
    ; MEM_TOP_DOWN - Allocates memory at the highest possible address.
    ; $iProtect - Type of access protection:
    ; PAGE_READONLY - Enables read access to the committed region of pages. An
    ; attempt to write to the committed region results in an access violation.
    ; PAGE_READWRITE - Enables read and write access to the committed region
    ; PAGE_EXECUTE - Enables execute access to the committed region
    ; PAGE_EXECUTE_READ - Enables execute and read access to the committed region
    ; PAGE_EXECUTE_READWRITE - Enables execute, read, and write access to the committed
    ; region of pages.
    ; PAGE_GUARD - Pages in the region become guard pages. Any attempt to
    ; read from or write to a guard page causes the operating system to raise a
    ; STATUS_GUARD_PAGE exception and turn off the guard page status.
    ; PAGE_NOACCESS - Disables all access to the committed region of pages
    ; PAGE_NOCACHE - Allows no caching of the committed regions of pages. The
    ; hardware attributes for the physical memory should be specified as "no cache."
    ; Return values : Memory address pointer
    ; ====================================================================================================
    Func _VirtualAlloc($pAddress, $iSize, $iAllocation, $iProtect)
    Local $aResult = DllCall("Kernel32.dll", "ptr", "VirtualAlloc", "ptr", $pAddress, "int", $iSize, "int", $iAllocation, "int", $iProtect)
    If @error Or Not IsArray($aResult) Then Return SetError(-1, -1, 0)
    Return $aResult[0]
    EndFunc ;==>_VirtualAlloc

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; Description ..: Reserves a region of memory within the virtual address space of a specified process
    ; Parameters ...: $hProcess - Handle to a process. The function allocates memory in the virtual
    ; address space of this process. You must have PROCESS_VM_OPERATION access to the
    ; process. If you do not, the function fails.
    ; $pAddress - Same as VirtualAlloc
    ; $iSize - Same as VirtualAlloc
    ; $iAllocation - Same as VirtualAlloc
    ; $iProtect - Same as VirtualAlloc
    ; Return values : Memory address pointer
    ; ====================================================================================================
    Func _VirtualAllocEx($hProcess, $pAddress, $iSize, $iAllocation, $iProtect)
    Local $aResult = DllCall("Kernel32.dll", "ptr", "VirtualAllocEx", "int", $hProcess, "ptr", $pAddress, "int", $iSize, "int", $iAllocation, "int", $iProtect)
    If @error Or Not IsArray($aResult) Then Return SetError(-1, -1, 0)
    Return $aResult[0]
    EndFunc ;==>_VirtualAllocEx

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; Description ..: Releases a region of pages within the virtual address space of a process
    ; Parameters ...: $pAddress - Points to the base address of the region of pages to be freed. If
    ; the $iFreeType parameter includes MEM_RELEASE this parameter must be the base
    ; address returned by VirtualAlloc when the region of pages was reserved.
    ; $iSize - Specifies the size, in bytes, of the region to be freed. If the
    ; $iFreeType parameter includes the MEM_RELEASE flag, this parameter must be zero.
    ; Otherwise, the region of affected pages includes all pages containing one or more
    ; bytes in the range from the $pAddress parameter to ($pAddress + $iSize). This
    ; means that a 2-byte range straddling a page boundary causes both pages to be freed.
    ; $iFreeType - Specifies the type of free operation:
    ; MEM_DECOMMIT - Decommits the specified region of committed pages. An attempt to
    ; decommit an uncommitted page will not cause the function to fail. This means
    ; that a range of committed or uncommitted pages can be decommitted without
    ; having to worry about a failure.
    ; MEM_RELEASE - Releases the specified region of reserved pages. If this flag is
    ; specified, the $iSize parameter must be zero or the function fails.
    ; Return values : Success - True
    ; Failure - False
    ; ====================================================================================================
    Func _VirtualFree($pAddress, $iSize, $iFreeType)
    Local $aResult = DllCall("Kernel32.dll", "ptr", "VirtualFree", "ptr", $pAddress, "int", $iSize, "int", $iFreeType)
    If @error Or Not IsArray($aResult) Then Return SetError(-1, -1, 0)
    Return $aResult[0]
    EndFunc ;==>_VirtualFree

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; Description ..: Releases a region of pages within the virtual address space of a process
    ; Parameters ...: $hProcess - Handle to a process. The function frees memory within the virtual
    ; address space of this process. You must have PROCESS_VM_OPERATION access to this
    ; process. If you do not, the function fails.
    ; $pAddress - See _VirtualFree
    ; $iSize - See _VirtualFree
    ; $iFreeType - See _VirtualFree
    ; Return values : Success - True
    ; Failure - False
    ; ====================================================================================================
    Func _VirtualFreeEx($hProcess, $pAddress, $iSize, $iFreeType)
    Local $aResult = DllCall("Kernel32.dll", "ptr", "VirtualFreeEx", "hwnd", $hProcess, "ptr", $pAddress, "int", $iSize, "int", $iFreeType)
    If @error Or Not IsArray($aResult) Then Return SetError(-1, -1, 0)
    Return $aResult[0]
    EndFunc ;==>_VirtualFreeEx

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; Description ..: Retrieves the identifier of the thread that created the specified window and the
    ; identifier of the process that created the window.
    ; Parameters ...: $hWnd - Window handle
    ; $iProcessID - Process ID of the specified window. If this parameter is not 0, the
    ; function copies the identifier of the process otherwise it does not.
    ; Return values : Thread ID of the specified window
    ; ====================================================================================================
    Func _GetWindowThreadProcessId($hWnd, ByRef $iProcessID)
    Local $rProcessID, $aResult
    $rProcessID = DllStructCreate("int")
    $aResult = DllCall("User32.dll", "int", "GetWindowThreadProcessId", "hwnd", $hWnd, "ptr", DllStructGetPtr($rProcessID))
    If @error Or Not IsArray($aResult) Then Return SetError(-1, -1, 0)
    $iProcessID = DllStructGetData($rProcessID, 1)
    Return $aResult[0]
    EndFunc ;==>_GetWindowThreadProcessId

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; Description ..: Returns a handle of an existing process object
    ; Parameters ...: $iAccess - Specifies the access to the process object
    ; $bInherit - Specifies whether the returned handle can be inherited
    ; $iProcessID - Specifies the process identifier of the process to open
    ; Return values : Open process handle to the object
    ; ====================================================================================================
    Func _OpenProcess($iAccess, $bInherit, $iProcessID)
    Local $aResult = DllCall("Kernel32.Dll", "int", "OpenProcess", "int", $iAccess, "int", $bInherit, "int", $iProcessID)
    If @error Or Not IsArray($aResult) Then Return SetError(-1, -1, 0)
    Return $aResult[0]
    EndFunc ;==>_OpenProcess

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; Description ..: Read memory in a specified process
    ; Parameters ...: $hProcess - Identifies an open handle of a process whose memory is read. The
    ; handle must have PROCESS_VM_READ access to the process.
    ; $pBaseAddress - Points to the base address in the specified process to be read.
    ; Before any data transfer occurs, the system verifies that all data in the base
    ; address and memory of the specified size is accessible for read access. If this is
    ; the case the function proceeds otherwise the function fails.
    ; $pBuffer - Points to a buffer that receives the contents from the address space
    ; of the specified process.
    ; $iSize - Specifies the requested number of bytes to read from the specified
    ; process.
    ; $iBytesRead - The actual number of bytes transferred into the specified buffer. If
    ; $iBytesRead is 0, the parameter is ignored.
    ; Return values : Success - True
    ; Failure - False
    ; ====================================================================================================
    Func _ReadProcessMemory($hProcess, $pBaseAddress, $pBuffer, $iSize, ByRef $iBytesRead)
    Local $rBytesRead = DllStructCreate("int")
    Local $aResult = DllCall("Kernel32.dll", "int", "ReadProcessMemory", "int", $hProcess, "int", $pBaseAddress, _
    "ptr", $pBuffer, "int", $iSize, "ptr", DllStructGetPtr($rBytesRead))
    If @error Or Not IsArray($aResult) Then Return SetError(-1, -1, 0)
    $iBytesRead = DllStructGetData($rBytesRead, 1)
    $rBytesRead = 0
    Return $aResult[0]
    EndFunc ;==>_ReadProcessMemory

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; Description ..: Writes memory in a specified process
    ; Parameters ...: $hProcess - Identifies an open handle to a process whose memory is to be written
    ; to. The handle must have PROCESS_VM_WRITE and PROCESS_VM_OPERATION access to the
    ; process.
    ; $pBaseAddress - Points to the base address in the specified process to be written to
    ; Before any data transfer occurs, the system verifies that all data in the base
    ; address and memory of the specified size is accessible for write access. If so the
    ; function proceeds otherwise the function fails.
    ; $pBuffer - Points to the buffer that supplies data to be written into the
    ; address space of the specified process.
    ; $iSize - Specifies the number of bytes to write into the specified process
    ; $iBytesWritten- The actual number of bytes transferred into the specified process.
    ; This parameter is optional. If $iBytesWritten is 0, the parameter is ignored.
    ; Return values : Success - True
    ; Failure - False
    ; ====================================================================================================
    Func _WriteProcessMemory($hProcess, $pBaseAddress, $pBuffer, $iSize, ByRef $iBytesWritten)
    Local $rBytesWritten = DllStructCreate("int")
    Local $aResult = DllCall("Kernel32.dll", "int", "WriteProcessMemory", "int", $hProcess, "int", $pBaseAddress, _
    "ptr", $pBuffer, "int", $iSize, "int", DllStructGetPtr($rBytesWritten))
    If @error Or Not IsArray($aResult) Then Return SetError(-1, -1, 0)
    $iBytesWritten = DllStructGetData($rBytesWritten, 1)
    $rBytesWritten = 0
    Return $aResult[0]
    EndFunc ;==>_WriteProcessMemory

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; Description ..: Initializes a memory map structure based on a windows handle
    ; Parameters ...: $hWnd - Window handle of the process where memory will be mapped
    ; $iSize - Size in bytes of memory space
    ; $rMemMap - MEM_MAP structure
    ; $pAddress - Pointer that specifies a desired starting address for the region of
    ; pages that you want to allocate. If you are reserving memory, the function rounds
    ; this address down to the nearest 64K boundary. If you are committing memory that
    ; is already reserved, the function rounds this address down to the nearest page
    ; boundary. To determine the size of a page, use the GetSystemInfo function. If
    ; $pAddress is 0, the function will determine where to allocate the region.
    ; Return values : Pointer to reserved memory
    ; ====================================================================================================
    Func _MemInit($hWnd, $iSize, ByRef $rMemMap, $pAddress = 0)
    Local $iAccess, $iAllocation
    Local $pMemory, $hProcess
    Local $iProcessID
    Local $PROCESS_VM_OPERATION = 0x00000008
    Local $PROCESS_VM_READ = 0x00000010
    Local $PROCESS_VM_WRITE = 0x00000020
    Local $MEM_RESERVE = 0x00002000
    Local $MEM_COMMIT = 0x00001000
    Local $MEM_SHARED = 0x08000000
    Local $PAGE_READWRITE = 0x00000004
    ;~ , $iThreadID

    [/autoit] [autoit][/autoit] [autoit]

    ;~ $iThreadID = _GetWindowThreadProcessId($hWnd, $iProcessID)
    _GetWindowThreadProcessId($hWnd, $iProcessID)
    $iAccess = BitOR($PROCESS_VM_OPERATION, $PROCESS_VM_READ, $PROCESS_VM_WRITE)
    $hProcess = _OpenProcess($iAccess, False, $iProcessID)
    Switch @OSVersion
    Case "WIN_ME", "WIN_98", "WIN_95"
    $iAllocation = BitOR($MEM_RESERVE, $MEM_COMMIT, $MEM_SHARED)
    $pMemory = _VirtualAlloc($pAddress, $iSize, $iAllocation, $PAGE_READWRITE)
    Case Else
    $iAllocation = BitOR($MEM_RESERVE, $MEM_COMMIT)
    $pMemory = _VirtualAllocEx($hProcess, $pAddress, $iSize, $iAllocation, $PAGE_READWRITE)
    EndSwitch
    If @error Then Return SetError(-1, -1, 0)
    $rMemMap = DllStructCreate($MEM_MAP)
    DllStructSetData($rMemMap, $MEM_MAP_HPROC, $hProcess)
    DllStructSetData($rMemMap, $MEM_MAP_ISIZE, $iSize)
    DllStructSetData($rMemMap, $MEM_MAP_PMEM, $pMemory)
    Return $pMemory
    EndFunc ;==>_MemInit

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; Description ..: Transfer memory from external address space to internal address space
    ; Parameters ...: $rMemMap - MEM_MAP structure
    ; $pSrce - Pointer to external memory
    ; $pDest - Pointer to internal memory
    ; $iSize - Size in bytes of memory to read
    ; Return values : True - Success
    ; False - Failure
    ; ====================================================================================================
    Func _MemRead($rMemMap, $pSrce, $pDest, $iSize)
    Local $hProcess
    Local $iWritten

    [/autoit] [autoit][/autoit] [autoit]

    $hProcess = DllStructGetData($rMemMap, $MEM_MAP_HPROC)
    Return _ReadProcessMemory($hProcess, $pSrce, $pDest, $iSize, $iWritten)
    EndFunc ;==>_MemRead

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; Description ..: Transfer memory to external address space from internal address space
    ; Parameters ...: $rMemMap - MEM_MAP structure
    ; $pSrce - Pointer to internal memory
    ; $pDest - Pointer to external memory. If this value is 0, then the memory
    ; pointer from $rMemMap will be used.
    ; $iSize - Size in bytes of memory to write. If this value is 0, then the size
    ; value from $rMemMap will be used.
    ; Return values : True - Success
    ; False - Failure
    ; ====================================================================================================
    Func _MemWrite($rMemMap, $pSrce, $pDest = 0, $iSize = 0)
    Local $hProcess
    Local $iWritten

    [/autoit] [autoit][/autoit] [autoit]

    If $pDest = 0 Then
    $pDest = DllStructGetData($rMemMap, $MEM_MAP_PMEM)
    EndIf
    If $iSize = 0 Then
    $iSize = DllStructGetData($rMemMap, $MEM_MAP_ISIZE)
    EndIf
    $hProcess = DllStructGetData($rMemMap, $MEM_MAP_HPROC)
    Return _WriteProcessMemory($hProcess, $pDest, $pSrce, $iSize, $iWritten)
    EndFunc ;==>_MemWrite

    [/autoit] [autoit][/autoit] [autoit]

    ; ====================================================================================================
    ; Description ..: Maps a character string to a wide-character (Unicode) string
    ; Parameters ...: $sText - Text to be converted
    ; $iCodePage - Specifies the code page to be used to perform the conversion:
    ; CP_ACP - ANSI code page
    ; CP_MACCP - Macintosh code page
    ; CP_OEMCP - OEM code page
    ; $iFlags - A set of bit flags that indicate whether to translate to precomposed
    ; or composite wide characters:
    ; MB_PRECOMPOSED - Always use precomposed characters
    ; MB_COMPOSITE - Always use composite characters
    ; MB_USEGLYPHCHARS - Use glyph characters instead of control characters
    ; Return values : Structure that contains the Unicode character string
    ; ====================================================================================================
    Func _MultiByteToWideChar($s_Text, $i_CodePage = 0, $i_Flags = 1)
    Local $iBuffLen = StringLen($s_Text)
    Local $rUnicode = DllStructCreate("byte[" & ($iBuffLen * 2) & "]")
    Local $pUnicode = DllStructGetPtr($rUnicode)
    DllCall("Kernel32.dll", "int", "MultiByteToWideChar", "int", $i_CodePage, "int", $i_Flags, _
    "str", $s_Text, "int", $iBuffLen, "ptr", $pUnicode, "int", $iBuffLen * 2)
    If @error Then Return SetError(-1, -1, 0)
    Return DllStructGetData($rUnicode, 1)
    EndFunc ;==>_MultiByteToWideChar

    [/autoit]

    Wenn ich nun das folgende Minesweeper-Skript:

    Spoiler anzeigen
    [autoit]

    #include <Memory.au3>

    $pidm = WinGetProcess("MineSweeper")
    $infom = _MemoryOpen($pidm)
    $readm = _MemoryRead(0x0100579C, $infom)
    MsgBox(0, "", $readm) ; aktueller Punktestand wird angezeigt

    Func _Reset()
    $newm = 0
    _MemoryWrite(0x0100579C, $infom, $newm) ; Gebrauchte Zeit wird auf 0 resettet
    EndFunc

    Func _weniger()
    $neweniger = $readm - 1
    _MemoryWrite(0x0100579C, $infom, $neweniger) ; gebrauchte Zeit wird um 1 Sekunde verringert.
    EndFunc

    [/autoit]

    (#include<memory.au3 >habe ich geändert in #include< Memory.au3> weil die Datei bei mir so heißt)
    in eine neue AutoIt3-Skript-Datei kopiere, die ich im Ordner "AutoIt3" angelegt habe, diese Datei anschließend öffne, bekomme ich folgende Fehlermeldung:

    Line (bei mir "16") (File"C:\...)

    $infom = _MemoryOpen($pidm)
    $infom = ^ERROR

    Error : Unknown function name

    Die Funktion "_MemoryOpen" gibt's in dieser Version der "Memory.au3" auch gar nicht, also ersetze
    ich sie in dem Minesweeper-Skript durch "_ReadProcessMemory".
    Abgesehen davon, dass hier wohl noch Parameter angegeben werden müßten, die ich nicht mal auf Deutsch kenne schon gar nicht auf Englisch,
    bekomme ich die gleiche Fehlermeldung, nur mit dem Funktionsnamen "_ReadProcessMemory".
    (Auch weiß ich nicht ob "_ReadProcessMemory" der Funktion "_MemoryOpen"entspricht.)

    Mit dieser "Memory.au3":

    Spoiler anzeigen
    [autoit]

    #include-once
    #region _Memory
    ;=================================================================================================
    ; AutoIt Version: 3.1.127 (beta)
    ; Language: English
    ; Platform: All Windows
    ; Author: Nomad
    ; Requirements: These functions will only work with beta.
    ;=================================================================================================
    ; Credits: wOuter - These functions are based on his original _Mem() functions. But they are
    ; easier to comprehend and more reliable. These functions are in no way a direct copy
    ; of his functions. His functions only provided a foundation from which these evolved.
    ;=================================================================================================
    ;
    ; Functions:
    ;
    ;=================================================================================================
    ; Function: _MemoryOpen($iv_Pid[, $iv_DesiredAccess[, $iv_InheritHandle]])
    ; Description: Opens a process and enables all possible access rights to the process. The
    ; Process ID of the process is used to specify which process to open. You must
    ; call this function before calling _MemoryClose(), _MemoryRead(), or _MemoryWrite().
    ; Parameter(s): $iv_Pid - The Process ID of the program you want to open.
    ; $iv_DesiredAccess - (optional) Set to 0x1F0FFF by default, which enables all
    ; possible access rights to the process specified by the
    ; Process ID.
    ; $if_InheritHandle - (optional) If this value is TRUE, all processes created by
    ; this process will inherit the access handle. Set to TRUE
    ; (1) by default. Set to 0 if you want it to be FALSE.
    ; Requirement(s): A valid process ID.
    ; Return Value(s): On Success - Returns an array containing the Dll handle and an open handle to
    ; the specified process.
    ; On Failure - Returns 0
    ; @Error - 0 = No error.
    ; 1 = Invalid $iv_Pid.
    ; 2 = Failed to open Kernel32.dll.
    ; 3 = Failed to open the specified process.
    ; Author(s): Nomad
    ; Note(s):
    ;=================================================================================================
    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]

    ;=================================================================================================
    ; Function: _MemoryRead($iv_Address, $ah_Handle[, $sv_Type])
    ; Description: Reads the value located in the memory address specified.
    ; Parameter(s): $iv_Address - The memory address you want to read from. 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().
    ; $sv_Type - (optional) The "Type" of value you intend to read. This is set to
    ; 'dword'(32bit(4byte) signed integer) by default. See the help file
    ; for DllStructCreate for all types.
    ; An example: If you want to read a word that is 15 characters in
    ; length, you would use 'char[16]'.
    ; Requirement(s): The $ah_Handle returned from _MemoryOpen.
    ; Return Value(s): On Success - Returns the value located at the specified address.
    ; On Failure - Returns 0
    ; @Error - 0 = No error.
    ; 1 = Invalid $ah_Handle.
    ; 2 = $sv_Type was not a string.
    ; 3 = $sv_Type is an unknown data type.
    ; 4 = Failed to allocate the memory needed for the DllStructure.
    ; 5 = Error allocating memory for $sv_Type.
    ; 6 = Failed to read from the specified process.
    ; Author(s): Nomad
    ; Note(s): Values returned are in Decimal format, unless specified as a 'char' type, then
    ; they are returned in ASCII format. Also note that size ('char[size]') for all
    ; 'char' types should be 1 greater than the actual size.
    ;=================================================================================================
    Func _MemoryRead($iv_Address, $ah_Handle, $sv_Type = 'dword')

    If Not IsArray($ah_Handle) Then
    SetError(1)
    Return 0
    EndIf

    Local $v_Buffer = DllStructCreate($sv_Type)

    If @Error Then
    SetError(@Error + 1)
    Return 0
    EndIf

    DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')

    If Not @Error Then
    Local $v_Value = DllStructGetData($v_Buffer, 1)
    Return $v_Value
    Else
    SetError(6)
    Return 0
    EndIf

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;=================================================================================================
    ; Function: _MemoryWrite($iv_Address, $ah_Handle, $v_Data[, $sv_Type])
    ; Description: Writes data to the specified memory address.
    ; Parameter(s): $iv_Address - The memory address you want to write to. 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().
    ; $v_Data - The data to be written.
    ; $sv_Type - (optional) The "Type" of value you intend to write. This is set to
    ; 'dword'(32bit(4byte) signed integer) by default. See the help file
    ; for DllStructCreate for all types.
    ; An example: If you want to write a word that is 15 characters in
    ; length, you would use 'char[16]'.
    ; Requirement(s): The $ah_Handle returned from _MemoryOpen.
    ; Return Value(s): On Success - Returns 1
    ; On Failure - Returns 0
    ; @Error - 0 = No error.
    ; 1 = Invalid $ah_Handle.
    ; 2 = $sv_Type was not a string.
    ; 3 = $sv_Type is an unknown data type.
    ; 4 = Failed to allocate the memory needed for the DllStructure.
    ; 5 = Error allocating memory for $sv_Type.
    ; 6 = $v_Data is not in the proper format to be used with the "Type"
    ; selected for $sv_Type, or it is out of range.
    ; 7 = Failed to write to the specified process.
    ; Author(s): Nomad
    ; Note(s): Values sent must be in Decimal format, unless specified as a 'char' type, then
    ; they must be in ASCII format. Also note that size ('char[size]') for all
    ; 'char' types should be 1 greater than the actual size.
    ;=================================================================================================
    Func _MemoryWrite($iv_Address, $ah_Handle, $v_Data, $sv_Type = 'dword')

    If Not IsArray($ah_Handle) Then
    SetError(1)
    Return 0
    EndIf

    Local $v_Buffer = DllStructCreate($sv_Type)

    If @Error Then
    SetError(@Error + 1)
    Return 0
    Else
    DllStructSetData($v_Buffer, 1, $v_Data)
    If @Error Then
    SetError(6)
    Return 0
    EndIf
    EndIf

    DllCall($ah_Handle[0], 'int', 'WriteProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')

    If Not @Error Then
    Return 1
    Else
    SetError(7)
    Return 0
    EndIf

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;=================================================================================================
    ; Function: _MemoryClose($ah_Handle)
    ; Description: Closes the process handle opened by using _MemoryOpen().
    ; Parameter(s): $ah_Handle - An array containing the Dll handle and the handle of the open
    ; process as returned by _MemoryOpen().
    ; Requirement(s): The $ah_Handle returned from _MemoryOpen.
    ; Return Value(s): On Success - Returns 1
    ; On Failure - Returns 0
    ; @Error - 0 = No error.
    ; 1 = Invalid $ah_Handle.
    ; 2 = Unable to close the process handle.
    ; Author(s): Nomad
    ; Note(s):
    ;=================================================================================================
    Func _MemoryClose($ah_Handle)

    If Not IsArray($ah_Handle) Then
    SetError(1)
    Return 0
    EndIf

    DllCall($ah_Handle[0], 'int', 'CloseHandle', 'int', $ah_Handle[1])
    If Not @Error Then
    DllClose($ah_Handle[0])
    Return 1
    Else
    DllClose($ah_Handle[0])
    SetError(2)
    Return 0
    EndIf

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;=================================================================================================
    ; 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

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;=================================================================================================
    ; Function: _MemoryPointerWrite ($iv_Address, $ah_Handle, $av_Offset, $v_Data[, $sv_Type])
    ; Description: Reads a chain of pointers and writes the data to the destination 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.
    ; $v_Data - The data to be written.
    ; $sv_Type - (optional) The "Type" of data you intend to write 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 the destination address.
    ; On Failure - Returns 0.
    ; @Error - 0 = No error.
    ; 1 = $av_Offset is not an array.
    ; 2 = Invalid $ah_Handle.
    ; 3 = Failed to read from the specified process.
    ; 4 = $sv_Type is not a string.
    ; 5 = $sv_Type is an unknown data type.
    ; 6 = Failed to allocate the memory needed for the DllStructure.
    ; 7 = Error allocating memory for $sv_Type.
    ; 8 = $v_Data is not in the proper format to be used with the
    ; "Type" selected for $sv_Type, or it is out of range.
    ; 9 = Failed to write to the specified process.
    ; Author(s): Nomad
    ; Note(s): Data written is in Decimal format, unless a 'char' type is selected.
    ; Set $av_Offset like this:
    ; $av_Offset[0] = NULL (not used, doesn't matter what's entered)
    ; $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 _MemoryPointerWrite ($iv_Address, $ah_Handle, $av_Offset, $v_Data, $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_StructData, $i
    Local $v_Buffer = DllStructCreate('dword')

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 to $iv_PointerCount
    If $i = $iv_PointerCount Then
    $v_Buffer = DllStructCreate($sv_Type)
    If @Error Then
    SetError(@Error + 3)
    Return 0
    EndIf

    DllStructSetData($v_Buffer, 1, $v_Data)
    If @Error Then
    SetError(8)
    Return 0
    EndIf

    $iv_Address = '0x' & hex($iv_StructData + $av_Offset[$i])
    DllCall($ah_Handle[0], 'int', 'WriteProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
    If @Error Then
    SetError(9)
    Return 0
    Else
    Return $iv_Address
    EndIf
    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(3)
    Return 0
    EndIf

    $iv_StructData = DllStructGetData($v_Buffer, 1)

    Else
    $iv_Address = '0x' & hex($iv_StructData + $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(3)
    Return 0
    EndIf

    $iv_StructData = DllStructGetData($v_Buffer, 1)

    EndIf
    Next

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc
    #endregion

    [/autoit]


    die ich über den Link im Tutorial bekommen habe, gibt's die gleiche Fehlermeldung wie oben, obwohl hier die "_MemoryOpen"- Funktion
    definiert ist, wenn ich das soweit verstanden habe.

    Was ich eigentlich "nur" möchte:
    (Ein fertiger Skriptvorschlag dafür würde mir sicher weiterhelfen.)

    1. einen Prozess mit einer Verknüpfung starten ( z.B.: "xyz.exe")
    2. automatisch den Wert einer Adresse ändern (z.B.: "001234AB" (oder "0X001234AB" ???)
    (Was bedeutet eigentlich das "x" in der Speicheradresse? Kann ich dafür vorn eine Null weglassen?)

    Kann mir jemand helfen?

    MfG, Osterhase :) :) :)

  • Hi
    das 0x kommt davon dass die Dll die in der #Include<Memory.au3> aufgerufen wird nur addressen im Hex Format annimmt.

    So nun folgendes script das den Timer in MineSweeper wieder auf null setzt

    [autoit][/autoit][autoit][/autoit][autoit]

    #include<mem.au3>
    $pid = ProcessExists("winmine.exe")
    $handle = _Memoryopen($pid)
    _MemoryWrite(0x100579C,$handle,0)
    _MemoryClose($handle)

    [/autoit][autoit][/autoit][autoit][/autoit]

    also du solltest dir die datei laden die im Wikitut. beschrieben ist herunter zu laden deshalb heiß mein #Include auch nich Memory.au3 sondern Mem.au3( habe die datei umbenannt)
    Wenn du das machst sollte mein Script dir hefen.

    Der Fehler:

    Line (bei mir "16") (File"C:\...)

    $infom = _MemoryOpen($pidm)
    $infom = ^ERROR

    Error : Unknown function name

    kommt daher dass in deiner Memory.au3 diese Funktionen nicht enthalten sind diese sind in der datei im WikiTut zu finden

    Gruß Redclaw