错误描述:
读取内存地址为 0x00642650 :
kernerl32 = ctypes.windll.LoadLibrary(r"C:\Windows\System32\kernel32.dll")
print(“kernerl32”,kernerl32)
data1 = ctypes.c_long()
kernerl32.ReadProcessMemory(int(phwnd),0x00642650 , ctypes.byref(data1), 4, None)
上述代码正常运行;
当读取64位程序内存地址 0x01110642650
data1 = ctypes.c_long()
kernerl32.ReadProcessMemory(int(phwnd),0x01110642650, ctypes.byref(data1), 4, None)
返回报错:
Traceback (most recent call last):
File “D:/WORK/memOpra/*****.py”, line 18, in
kernerl32.ReadProcessMemory(int(phwnd), 0x01110642650 , ctypes.byref(data1), 4, None)
ctypes.ArgumentError: argument 2: <class ‘OverflowError’>: int too long to convert
错误可能原因及解决方法:
python中的int值范围超过了C中的int值范围 在内存地址上加
ctypes.c_void_p()例如:
kernerl32.ReadProcessMemory(int(phwnd),ctypes.c_void_p(0x01110642650), ctypes.byref(data1), 4, None)
可能大佬早就知道该怎样解决 ,在此仅做一次笔记让自己温习,欢迎补充修正;
版权归原作者 qq_39431717 所有, 如有侵权,请联系我们删除。