Autoit memory read only give back 0s

1

I'm learning memory reading with AutoIt. My current problem is that when I want to read an address it only gives back 0s.

Here is my code:

#include "C:\Program Files (x86)\AutoIt3\Plugins\NomadMemory.au3"
$ID = _MemoryOpen(0x00000650)
$Address = 0x1AAFD6ECEC8

While 1
MemoryTest()
WEnd

Func MemoryTest()

$Test = _MemoryRead($Address,$ID)

Sleep(1000)
ConsoleWrite('Current address value: ' & $Test & @LF)

EndFunc

_MemoryClose($ID)

The output is:

Current address value: 0
Current address value: 0
Current address value: 0
Current address value: 0
Current address value: 0
Current address value: 0
Current address value: 0
...

The address in unchanged meanwhile (it's 3315), I've double-checked it with Cheat Engine.

What could be the problem?

memory
autoit
asked on Stack Overflow Aug 29, 2017 by TheReshi • edited Aug 31, 2017 by user4157124

1 Answer

1

Both _MemoryOpen() and _MemoryRead() returns 0 on failure. From NomadMemory.au3:

_MemoryOpen()

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

_MemoryRead()

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

You should check your @Error value after you call each of the functions.

answered on Stack Overflow Aug 30, 2017 by Daniel

User contributions licensed under CC BY-SA 3.0