Jump to content
Sign in to follow this  
Chuuy

Error 6 When Trying To Read Memory

Recommended Posts

Chuuy

For some reason, everytime I try to read memory, it always returns 0 with an @Error of 6. I'm using NomadMemory. Error 6 is:

6 = Failed to read from the specified process.

I have no idea what causes this problem. Here's the code I came up with. Also, I bypasses Hackshields hook, so the fact that it usually hooks ReadProcessMemory() shouldn't be a problem.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Description=Auto MTS Merchant
#AutoIt3Wrapper_Res_Fileversion=0.0.0.32
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=y
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Tidy_Stop_onerror=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <NomadMemory.au3>

Dim $ah_Handle, $Hotkey, $Value1, $Value2, $Value3, $Value4, $Value5, $Price
$ah_Handle = _MemoryOpen("MapleStory.exe")
If $ah_Handle = 0 Then MsgBox(0, "Error", "_MemoryOpen Failed" & @error)

$Hotkey = HotKeySet("{ESC}", "Quit")
If $Hotkey = 0 Then MsgBox(0, "Error", "HotKeySet Failed")

While 1
    MouseClick("main", 1119, 199, 1, 0)
    $Value1 = _MemoryRead(0x525FB339, $ah_Handle, 'dword')
    If $Value1 = 0 Then MsgBox(0, "Error", "_MemoryOpen1 Failed" & @error)
    $Value2 = _MemoryRead(0x525FB33B, $ah_Handle, 'dword')
    If $Value2 = 0 Then MsgBox(0, "Error", "_MemoryOpen2 Failed" & @error)
    $Value3 = _MemoryRead(0x525FB941, $ah_Handle, 'dword')
    If $Value3 = 0 Then MsgBox(0, "Error", "_MemoryOpen3 Failed" & @error)
    $Value4 = _MemoryRead(0x525FB943, $ah_Handle, 'dword')
    If $Value4 = 0 Then MsgBox(0, "Error", "_MemoryOpen4 Failed" & @error)
    $Value5 = _MemoryRead(0x525FBF39, $ah_Handle, 'dword')
    If $Value5 = 0 Then MsgBox(0, "Error", "_MemoryOpen5 Failed" & @error)
    $Price = _MemoryRead(0x4721CED5, $ah_Handle, 'short')
    If $Price = 0 Then MsgBox(0, "Error", "_MemoryOpen6 Failed" & @error)
    If $Value1 = 4294077426 And $Value2 = 4294967282 And $Value3 = 1811939314 And $Value4 = 1811049471 And $Value5 = 4294077426 And $Price < 1149 Then
        MouseClick("main", 511, 183, 1, 0)
        MouseClick("main", 448, 366, 1, 0)
    EndIf
WEnd

Func Quit()
    Exit 0
EndFunc   ;==>Quit

Share this post


Link to post
Share on other sites
Authenticity

_MemoryOpen() as it's defined, expect a process identifier as opposed to a process name. So you need to call it like:

$ah_Handle = _MemoryOpen(ProcessExists("MapleStory.exe"))

You should also consider that if the memory is protected you'll need to use VirtualProtectEx() to change the specific page to be readable also, and not only write or execute for example.

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  

×