Trying to OpenProcess fails Topic is solved

Ask gaming related questions (AHK v1.1 and older)
FokS

Trying to OpenProcess fails  Topic is solved

17 Aug 2017, 09:50

Hi Guys,

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 : ""
}
but the DLL call "OpenProcess" fails. The error code is 5, which means access denied.
The script and the game is running at 64bit and with admin privileges.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 95 guests