I'm trying to read process memory using DllCall("ReadProcessMemory"...) from an address that stores a Double datatype. The read is stored as a string and converted to 8Byte (Int64?).
How would I convert this to a Double datatype value?
Example: 8Byte value is 4682434448260570601 and Double value should be 112021.153472535
Here is the code that I'm working with:
Code: Select all
ReadMemory8Byte(MemAdrs=0,Prg="")
{
Static OldPrc, ProcessHandle
VarSetCapacity(MemV, 8, 0)
if Prg != %OldPrc%
{
WinGet, pid, pid, % OldPrc := Prg
ProcessHandle := (ProcessHandle ? 0*(closed := DllCall("CloseHandle", "UInt", ProcessHandle)) : 0)+(pid ? DllCall("OpenProcess", "Int", 16, "Int", 0, "UInt", pid) : 0)
}
if (ProcessHandle) && DllCall("ReadProcessMemory", "UInt", ProcessHandle, "UInt", MemAdrs, "Str", MemV, "UInt", 8, "UInt *", 0)
return *(&MemV+7)<<56 | *(&MemV+6)<<48 | *(&MemV+5)<<40 | *(&MemV+4)<<32 | *(&MemV+3)<<24 | *(&MemV+2)<<16 | *(&MemV+1)<<8 | *(&MemV)
return !ProcessHandle ? "Handle Closed: " closed : "Fail"
}