Trouble with Memory reading script modification

Ask gaming related questions (AHK v1.1 and older)
Zukurah
Posts: 9
Joined: 22 Nov 2015, 15:24

Trouble with Memory reading script modification

13 Jun 2017, 13:24

Hey there, so i got this script from another AHK users post

Code: Select all

ReadMemory(MADDRESS,PROGRAM)
{
winget, pid, PID, %PROGRAM%

VarSetCapacity(MVALUE,4,0)
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)

Loop 4
result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)

return, result  
which works perfectly however i want to multibox a game and having multiple processes with the game name and different PID's is causing trouble.
what i would like to do is have the script refer to an INI file that ill just manually enter the PID for each process. how would i change this code to accomplish that?
Zukurah
Posts: 9
Joined: 22 Nov 2015, 15:24

Re: Trouble with Memory reading script modification

13 Jun 2017, 13:42

Found a solution for anybody looking,

Code: Select all

ReadMemory(MADDRESS)
{
	Global pid
	VarSetCapacity(MVALUE,4,0)
	ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
	;DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)
	DllCall("ReadProcessMemory", "UInt", ProcessHandle, "Ptr", MADDRESS, "Ptr", &MVALUE, "Uint",4)
	Loop 4
		result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)
	return, result
}

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: sofista and 148 guests