【发布时间】:2019-08-31 17:24:31
【问题描述】:
我正在使用ctypes 并尝试使用NtQueryInformationProcess 函数获取PEB 地址。
返回值为0,表示函数成功完成。
但是PROCESS_BASIC_INFORMATION 结构(作为第三个参数给出)不包含PEB 地址。
class PROCESS_BASIC_INFORMATION(Structure):
_fields_ = [
("Reserved1", c_void_p),
("PebBaseAddress", DWORD),
("Reserved2", c_void_p * 2),
("UniqueProcessId", DWORD),
("Reserved3", c_void_p)]
ntdll = WinDLL('ntdll')
NTSTATUS = LONG
ntdll.argtypes = [HANDLE, DWORD, c_void_p, DWORD, PDWORD]
ntdll.restype = NTSTATUS
processInformation = PROCESS_BASIC_INFORMATION()
processInformationLength = sizeof(PROCESS_BASIC_INFORMATION)
result = ntdll.NtQueryInformationProcess(hProcess, 0, processInformation, processInformationLength, byref(DWORD(0)))
考虑返回值为0的事实,可能是什么问题?
【问题讨论】:
-
函数返回后PEB字段包含什么?
标签: python python-3.x winapi ctypes