从两天开始,我尝试阅读pymem的文档并在论坛上搜索一个错误,但是我看到的所有解决方案都失败了。
我不能只读取内存地址中的int,我也不知道它是代码的问题还是我的pc
from pymem import *
from pymem.process import module_from_name
pm = pymem.Pymem("***-Win64.exe")
gameModule = module_from_name(pm.process_handle, "***-Win64.exe").lpBaseOfDll
def GetPtrAddr(base, offsets):
addr = pm.read_int(base) # addr = 9460301, base = 140696812060672
for i in offsets:
if i != offsets[-1]:
addr = pm.read_int(addr + i) # <- here is the error line
return addr + offsets[-1]
pm.read_int(GetPtrAddr(gameModule + 0x04D934B0, [0x50, 0x30, 0x98, 0xf0, 0x380]))错误
pymem.exception.MemoryReadError: Could not read memory at: 9460349, length: 4 - GetLastError: 299我也试过了,使用Python中的静态地址和偏移量从进程读取内存地址,但是我有错误
ctypes.ArgumentError: argument 2: <class 'OverflowError'>: int too long to convert但我唯一想得到的值是从0到12

我在for循环中添加了一个try捕获,下面是错误
Could not read memory at: 9460349, length: 4 - GetLastError: 299
Could not read memory at: 9460973, length: 4 - GetLastError: 299
Could not read memory at: 9460589, length: 4 - GetLastError: 299
Could not read memory at: 9460301, length: 4 - GetLastError: 299发布于 2022-04-10 15:24:18
感谢包的帮助,我狂热地发现了我的错误
问题在于我的应用程序是64位的,我试着读取一个int,但是这还不够,所以这里有完整的代码
from pymem import *
from pymem.process import *
offsets = [0x50,0x30,0x98,0xF0,0x380]
pm = Pymem('***-Win64.exe')
gameModule = module_from_name(pm.process_handle, '***-Win64.exe').lpBaseOfDll
def GetPointer(base, offsets):
addr = pm.read_longlong(base+0x04D934B0) # <-- here was the probleme solved
print(hex(addr))
for offset in offsets:
if offset != offsets[-1]:
try:
addr = pm.read_longlong(addr + offset)
print(addr)
except Exception as e:
print(e)
return addr + offsets[-1]
GetPointer(gameModule, offsets)发布于 2022-04-09 13:14:35
我想知道为什么您用偏移量从pm.readint()中添加返回值。base似乎是您可以访问的有效地址,而addr + some offset不是。
我从文档中读到,read_int从指定进程中的内存区域读取4字节。返回值addr是否是要使用的地址?
FYI,我发现错误代码是由kernel32抛出的,它意味着ERROR_PARTIAL_COPY。
https://stackoverflow.com/questions/71807738
复制相似问题