read a float value from ReadProcessMemory in python

46 views Asked by At

I'm trying to read a float value from memory. Cheat Engine labels the address as "Spider-Man.exe"+6D17018 which is 7FF7F0ED7018 but the ReadBuffer.value is returning 0.0 and the , lpNumberOfBytesRead.value shows zero bytes read.

import win32api
import win32con
import win32process
import win32ui
import ctypes

rpm = ctypes.windll.kernel32.ReadProcessMemory

# Marvel's Spider-Man Remastered v2.616.0.0
# 7FF7F0ED701

HWND = win32ui.FindWindow(None, 'Marvel\'s Spider-Man Remastered v2.616.0.0').GetSafeHwnd()
PID = win32process.GetWindowThreadProcessId(HWND)[1]
PROCESS = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, 0, PID)

lpBaseAddress = '0x7FF7F0ED701'
ReadBuffer = ctypes.c_float()
lpBuffer = ctypes.byref(ReadBuffer)
nSize = ctypes.sizeof(ReadBuffer)
lpNumberOfBytesRead = ctypes.c_ulong(0)

rpm(PROCESS.handle, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesRead)

print(ReadBuffer.value, lpNumberOfBytesRead.value)
x = ctypes.windll.kernel32.GetLastError()
print(x)
0

There are 0 answers