I'm trying to write myself a simple rotation macro for the game "wildstar". For that purpose i wanted to read memory.
I already found the correct pointer and stuff.
so i use this function for reading :
Code: Select all
ReadMemory(address, program, type := "UInt")
{
static aTypeSize := { "UChar": 1, "Char": 1
, "UShort": 2, "Short": 2
, "UInt": 4, "Int": 4
, "UFloat": 4, "Float": 4 ; UFloat is really just float (doesn't exist)
, "Int64": 8, "Double": 8}
if !aTypeSize.hasKey(type){
msgbox Type does not exist
return "", ErrorLevel := -2
}
WinGet, pid, PID, %program%
if !pid{
msgbox pid does not exist
return
}
if !hProcess := DllCall("OpenProcess", "UInt", 2035711, "Int", False, "UInt", pid, "Ptr"){
msgbox % A_LastError
return
}
success := DllCall("ReadProcessMemory", "Ptr", hProcess, "Ptr", address, type "*", result, "Ptr", aTypeSize[type], "Ptr",0)
DllCall("CloseHandle", "Ptr", hProcess)
return success ? result : ""
}
The script and the game is running at 64bit and with admin privileges.