如何在 pymem 中打开一个带有 PID 的进程

问题描述 投票:0回答:0

我已经设法通过使用 pymem 库更改了游戏中的一些字节。我是通过搜索进程名称来实现的。但现在我需要用它的 PID 来做。这是我的代码:

def pattern_scan_all(handle, pattern, *, return_multiple=False):
    next_region = 0
    found = []
    while next_region < 0x7FFFFFFF0000:
        next_region, page_found = pymem.pattern.scan_pattern_page(
            handle,
            next_region,
            pattern,
            return_multiple=return_multiple
        )
        if not return_multiple and page_found:
            return page_found
        if page_found:
            found += page_found

    if not return_multiple:
        return None
    return found


pm = pymem.Pymem("Game.exe")
bytes_pattern_MaxEXP = b"\\x20\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x36"
allLevel_maxExp_addrs = pattern_scan_all(pm.process_handle, bytes_pattern_MaxEXP, return_multiple=True)

for addr in allLevel_maxExp_addrs:    
    work.addr = addr
    break 

现在游戏在网络浏览器上运行,我需要使用它的 PID 来访问它,有没有什么方法可以使用它的 PID 来访问它。

感谢您的宝贵时间。 “

我试过“pm = pymem.Pymem.open_process_from_id(9812)”但它给了我“TypeError: Pymem.open_process_from_id() missing 1 required positional argument: 'process_id'”错误。

python pid
© www.soinside.com 2019 - 2024. All rights reserved.