Sign in to follow this  
Followers 0
Clee12

Can't read memory using autoit

12 posts in this topic

I have been asking for help on another topic but I'm almost certain the problem wasn't being caused by NomadMemory.au3 as I first suspected. On that note I decided to open a topic for this specific problem.

I'm trying to read WoW memory and I'm obviously having trouble(Always displays 00000 ). I can read memory from any other application other than WoW. I was wondering if anyone here has used autoit to read WoW memory and how they went about it. Anything would be helpful. Thanks a lot.

Here is one of the many scripts I've been trying to use + a lot of unneeded includes :D --

CODE
#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <TabConstants.au3>

#include <WindowsConstants.au3>

#include <NomadMemory.au3>

#include <string.au3>

SETPRIVILEGE("SeDebugPrivilege", 1)

Dim $ProPID = WinGetProcess("Wow.exe")

Global $HPROCESS = _MemoryOpen($ProPID)

$HPROCESS = _MemoryOpen($ProPID)

$Health = _MemoryRead(0x012EB558,$HPROCESS)

If $Health = 0 Then

MsgBox(1,"No!","Value not found")

Else

MsgBox(1,"Yes!",$Health)

EndIf

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Check the @error (if any) after MemoryRead

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

I suggest

MsgBox(1,"No!","Value not found, error code is : " & @error)

Edited by Inverted

Share this post


Link to post
Share on other sites

@error = 1

So as you said - Invalid $ah_Handle. How would I go about trouble shooting this? Thanks.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Why do you have 2 _MemoryOpen ?

Use only one and check/show its return and @error , if any. In fact, I'd get rid of that Dim and Global crap :D

Edited by Inverted

Share this post


Link to post
Share on other sites

Haven't coded in a while and I'm not positive I know what you're asking me to do but here is the code I just ran.

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <NomadMemory.au3>
#include <string.au3>
SETPRIVILEGE("SeDebugPrivilege", 1)
 $ProPID = WinGetProcess("Wow.exe")
 $HPROCESS = _MemoryOpen($ProPID)
 $Health = _MemoryRead(0x012EB558,$HPROCESS)
If @error Then
    MsgBox(4096,"Error", @error)
Else
    MsgBox(4096, "Result", $Health)
EndIf

Results was - @error = 1, $Health = 0.

Is this what you were asking?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

#include <NomadMemory.au3>

SETPRIVILEGE("SeDebugPrivilege", 1)
$ProPID = ProcessExists ("wow.exe")
$HPROCESS = _MemoryOpen($ProPID)
If @error <>0 Then
    MsgBox (0, "Error", "An error occured opening or finding the process, code : " & @error)
    Exit
EndIf

$Health = _MemoryRead(0x012EB558,$HPROCESS)
If @error Then
    MsgBox(4096,"Error", @error)
Else
    MsgBox(4096, "Result", $Health)
EndIf

WinGetProcess was the wrong funciton to use, you never got the right pid. Check mine, tell me what happens.

Edited by Inverted

Share this post


Link to post
Share on other sites

Oh ok thank you. However I just tried it and got result = 0. So no error was reported but it isn't seeing any values damn it.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Can you backup your NomadMemory.au3 and use my own ? I've made sure that if ReadProcessMemory fails, then @error is set (to 6)

Then can you confirm that :

using correct memory addresses in normal apps = returns correct reads with no @error

using wrong memory addresses in normal apps = returns 0 with @error

using correct memory addresses in Wow = returns 0 with @error

NomadMemory.au3

Edited by Inverted

Share this post


Link to post
Share on other sites

Brilliant! So replaced my Nomad with yours and got @error = 6. Interesting so ReadProcessMemory is the problem?

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

So, we have confirmed that there is something different about WoW that makes ReadProcessMemory fail (at least on your PC), since it works for other proggies, right ?

Also, we got rid of the @error bug, I was gettring tired of the damn 0 return + 0 @error.

But now, what ? I'm not gonna download WoW to test myself, hehe. Is anyone else reading that has WoW installed ?

What OS are you using btw ?

Edited by Inverted

Share this post


Link to post
Share on other sites

So, we have confirmed that there is something different about WoW that makes ReadProcessMemory fail (at least on your PC), since it works for other proggies, right ?

Also, we got rid of the @error bug, I was gettring tired of the damn 0 return + 0 @error.

But now, what ? I'm not gonna download WoW to test myself, hehe. Is anyone else reading that has WoW installed ?

What OS are you using btw ?

Yeah it works fine with all other programs. I'm running XP with SP2. What is weird is that I have ran an autoit based program that reads WoW's memory. I tried to modify some other users scripts to display some of my addresses but nothing seems to work. There is no .dll or system based dependencies? I also tried this on my laptop running vista yesterday and had the exact same problem. Frustrating knowing that people know a way around this problem but won't look at this post. My guess is its something rather simple and I'm going to cause harm to myself after realizing just how easy it really is. Thanks for your help though.

Share this post


Link to post
Share on other sites

Login to wow, and try this...

Its no finished, but i was just messing arround.

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <NomadMemory.au3>

;settings -----------------
$Playerbase = 0x010BD5F4
$Playername = 0x01139FB8
$Playerx = 0x798
$Playery = 0x79C
$Playerz = 0x7A0
$Playerrotation = 0x7A8
$Playerlevel = 0x18AC
$PlayerCurHP = 0xF90
$PlayerMaxHP = 0x1854
$PlayerCurMP = 0x094
$PlayerMaxMP = 0x1858
$PlayerExp = 0x980
$PlayerMaxExp = 0x984
$Off1=0x34
$Off2=0x24

SETPRIVILEGE("SeDebugPrivilege", 1)
Dim $ProPID = WinGetProcess("World of Warcraft");--------FIX THIS---------@SW_MINIMIZE
$wowprocess = _MemoryOpen($ProPID)

HotKeySet("{F5}", "_Getpointers")
TrayTip("Tip:", "Press F5 to refresh", 5)

#Region ### START Koda GUI section ### Form=
$MainGUI = GUICreate("WoW Info", 190, 312)
$plrname = GUICtrlCreateLabel("Player name:", 16, 16, 190, 17)
$plrx = GUICtrlCreateLabel("Player x:", 16, 40, 190, 17)
$plry = GUICtrlCreateLabel("Player y:", 16, 64, 190, 17)
$plrz = GUICtrlCreateLabel("Player z:", 16, 88, 190, 17)
$plrrot = GUICtrlCreateLabel("Player Rotation:", 16, 112, 190, 17)
$plrlevel = GUICtrlCreateLabel("Player Level:", 16, 136, 190, 17)
$plrnowhp = GUICtrlCreateLabel("Player current hp:", 16, 160, 190, 17)
$plrmaxhp = GUICtrlCreateLabel("Player max hp:", 16, 184, 190, 17)
$plrnowmp = GUICtrlCreateLabel("Player current mana:", 16, 208, 190, 17)
$plrmaxmp = GUICtrlCreateLabel("Player max mana:", 16, 232, 190, 17)
$plrnowxp = GUICtrlCreateLabel("Player xp:", 16, 256, 190, 17)
$plrmaxxp = GUICtrlCreateLabel("Player max xp:", 16, 280, 190, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

    
    
Func _Getpointers()
    Global $LVL1POINTER = _MemoryRead($Playerbase, $wowprocess, "ptr")
    Global $LVL2POINTER = _MemoryRead(($LVL1POINTER + $Off1), $wowprocess, "ptr")
    Global $PlayerMEM = _MemoryRead(($LVL2POINTER+ $Off2), $wowprocess, "ptr")
    Global $Plrxread = $PlayerMEM + $Playerx
    Global $Plryread = $PlayerMEM + $Playery
    Global $Plrzread = $PlayerMEM + $Playerz
    Global $Rotationread = $PlayerMEM + $Playerrotation
    Global $Plrlevelread = $PlayerMEM + $Playerlevel
    Global $Plrnowhpread = $PlayerMEM + $PlayerCurHP
    Global $Plrmaxhpread = $PlayerMEM + $PlayerMaxHP
    Global $Plrnowmpread = $PlayerMEM + $PlayerCurMP
    Global $Plrmaxmpread = $PlayerMEM + $PlayerMaxMP
    Global $Plrnowxpread = $PlayerMEM + $PlayerExp
    Global $Plrmaxxpread = $PlayerMEM + $PlayerMaxExp
    Global $Plrnameread = "Player name: " & _MEMORYREAD($Playername, $wowprocess, "char[12]")

    
    
    Update()
EndFunc

Func Update()
GUICtrlSetData($plrname, $Plrnameread)
GUICtrlSetData($plrx, "Player x: " & _MEMORYREAD($Plrxread, $wowprocess, "float"))
GUICtrlSetData($plry, "Player y: " & _MEMORYREAD($Plryread, $wowprocess, "float"))
GUICtrlSetData($plrz, "Player z: " & _MEMORYREAD($Plrzread, $wowprocess, "float"))
GUICtrlSetData($plrrot, "Player Rotation: " & _MEMORYREAD($Rotationread, $wowprocess, "float"))
GUICtrlSetData($plrlevel, "Player Level: " & _MEMORYREAD($Plrlevelread, $wowprocess, "int"))
GUICtrlSetData($plrnowhp, "Player current hp: " & _MEMORYREAD($Plrnowhpread, $wowprocess, "int"))
GUICtrlSetData($plrmaxhp, "Player max hp: " & _MEMORYREAD($Plrmaxhpread, $wowprocess, "int"))
GUICtrlSetData($plrnowmp, "Player current mana: " & _MEMORYREAD($Plrnowmpread, $wowprocess, "int"))
GUICtrlSetData($plrmaxmp, "Player max mana: " & _MEMORYREAD($Plrmaxmpread, $wowprocess, "int"))
GUICtrlSetData($plrnowxp, "Player xp: " & _MEMORYREAD($Plrnowxpread, $wowprocess, "int"))
GUICtrlSetData($plrmaxxp, "Player max xp: " & _MEMORYREAD($Plrmaxxpread, $wowprocess, "int"))
EndFunc

Let me know what happens?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0