首页 > 解决方案 > Ctypes __readgsqword

问题描述

当尝试在 python 中返回 PEB 的值时,您会遇到与此类似的问题,是否无法在 python 中调用 __readgsqword。

def GetPEB():
    return ctypes.windll.kernel32.__readgsqword('0x0C',ctypes.sizeof('PVOID'))
AttributeError: function '__readgsqword' not found

标签: pythonwindowswinapictypes

解决方案


正如文档中所解释的,这些函数是内在函数,而不是由内核 32 dll 导出的。

您可以通过编译公开这些函数的 DLL 来调用它们,然后从 Python 代码中调用它们。

但是,使用不同的方法可能会更好。例如:如何使用 python ctypes 访问另一个进程的 PEB


推荐阅读