Jump to content

Need help with _MEMORYREAD()


KentNguyen
 Share

Recommended Posts

sr if i ask some stupid question... i tried to get some simple infomation of a game by using NomadMemory, i used CheatEngine5.5 to get target's address but i dont know what should be target's address in this picture, i tried to use 0x... with these in the red boxes but none of them worked,

Posted Image

can some1 help me out pls, thanks a lot, here is my csript

#include-once
#include <GUIListView.au3>
#include <GUIConstants.au3>
#include <GuiListView.au3>
#Include <GuiConstants.au3>
#include <StaticConstants.au3>

Opt ("WinTitleMatchMode",2)
Opt("GUIOnEventMode", 1)

Func _MEMORYOPEN($IV_PID, $IV_DESIREDACCESS =0x1F0FFF, $IV_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", $IV_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


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


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


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

GUICreate("Practice",200,200,-1,-1)
GUISetState()
While 1
    $msg=GUIGetMsg()
    If $msg=$GUI_EVENT_CLOSE Then
        Exit
    EndIf
    $title=WinGetTitle("AlyKulun","")
    $memid=_MEMORYOPEN($title)
    $hp=GUICtrlCreateLabel("",10,10,100,20)
    GUICtrlSetData($hp,"HP: "&GETHP())
WEnd

Func GETHP()
    Return _MEMORYREAD(0x044EDA64,$memid)
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...