无法在python中readProcessMemory获取错误代码299

时间:2018-06-02 07:26:22

标签: python readprocessmemory

我试图使用Python读取进程内存但是有什么错误的idk是什么。 print语句给出0,0,299。这里给出的答案是不完整的Function ReadProcessMemory keeps returning ERROR_PARTIAL_COPY

import ctypes
from ctypes import *
from ctypes.wintypes import *
import psutil
import sys
from ctypes import wintypes

PROCESS_QUERY_INFORMATION = 0x0400
PROCESS_VM_OPERATION = 0x0008
PROCESS_VM_READ = 0x0010
PROCESS_VM_WRITE = 0x0020
desired_access = (PROCESS_QUERY_INFORMATION|
              PROCESS_VM_OPERATION|
              PROCESS_VM_READ|
              PROCESS_VM_WRITE)

process = windll.kernel32.OpenProcess(desired_access,0,5816)
rPM = ctypes.WinDLL('kernel32',use_last_error=True).ReadProcessMemory
rPM.argtypes =    [wintypes.HANDLE,wintypes.LPCVOID,wintypes.LPVOID,ctypes.c_size_t,ctypes.POINTER   (ctypes.c_size_t)]
rPM.restype = wintypes.BOOL

ReadBuffer = ctypes.c_uint()
lpBuffer = ctypes.byref(ReadBuffer)
nSize = ctypes.sizeof(ReadBuffer)
lpNumberOfBytesRead = ctypes.c_ulong(0)
x = rPM(process, hex(2305324751792),lpBuffer,nSize,lpNumberOfBytesRead)

print(ReadBuffer.value)
print(x)
print(ctypes.get_last_error())

0 个答案:

没有答案