Hey guys.. I just started with autoit a while ago and yesterday decided to make my first project a World of Warcraft (MMORPG) memory reading program.
So I wanted to read the health of my character and display it.
A nice guy on another site gave me this code wich puts his HP and max HP in a tooltip when WoW is minimized:
#Include <NomadMemory.au3>
hotkeyset("{end}", "err")
SetPrivilege("SeDebugPrivilege", 1)
$dll = DllOpen("user32.dll")
$wow = _memoryopen(WinGetProcess("wow"))
sleep(500)
$lvl1Pointer= _MemoryRead(0x0127F13C, $wow, 'ptr')
sleep(500)
$lvl2Pointer= _MemoryRead(($lvl1Pointer + 0x30), $wow, 'ptr')
sleep(500)
$PlayerBase= _MemoryRead(($lvl2Pointer + 0x28), $wow, 'ptr')
sleep(500)
While 1
$health= _memoryread($PlayerBase + 0xFF4, $wow)
$mhealth= _memoryread($PlayerBase + 0x26E4, $wow)
if not WinActive("World of Warcraft") Then
ToolTip("Current HP: "&$health&"/"&$mhealth&".")
Sleep(10)
if $health < $mhealth Then
WinActivate("World of Warcraft")
EndIf
Else
sleep(10)
EndIf
WEnd
func err()
Exit
endfunc
As you can see he uses the nomadmemory.au3.
But as I was reading the helpfile yesterday, I found the read memory API of autoit:
_WinAPI_ReadProcessMemory($hProcess, $pBaseAddress, $pBuffer, $iSize, ByRef $iRead)
And it looks much easier to use. But the helpfile did not give any info or sample code on using it and I was wondering if anybody could point me in the right direction to learning.
EDIT: BTW, the first sample code doesn't work, for some weird reason it always returns 0/0
I am on windows XP so i dont think its adminstrator thing.