我正在尝试用python写内存。我需要写一个整数,但是对于WriteProcessMemory函数,我需要一个缓冲区。你知道吗
writeProcessMemory = kernel.WriteProcessMemory
writeProcessMemory.argtypes = [ctypes.wintypes.HANDLE,
ctypes.wintypes.LPVOID, ctypes.wintypes.LPCVOID, ctypes.c_size_t,
ctypes.POINTER(ctypes.c_size_t)]
writeProcessMemory.restype = ctypes.wintypes.BOOL
openProcess = kernel.OpenProcess
openProcess.argtypes = [ctypes.wintypes.DWORD, ctypes.wintypes.BOOL,
ctypes.wintypes.DWORD]
openProcess.restype = ctypes.wintypes.HANDLE
handle = openProcess(PROCESS_ALL_ACCESS, False, pid)
addr = 0x024EA498
data = ctypes.c_int(1000)
buffer = #i need to create a buffer here
你可以使用^{}
创建1000个4大小整数的0填充缓冲区。这个缓冲区是
ctypes.c_char_Array_4000
类型,可以作为指针传递给导入的函数。你知道吗现在调用导入的函数,获取刚才使用以下命令编写的python
bytes
对象:并使用
struct
获取整数值。不需要指定端点。I
是4个字节。如果调用的函数使用4字节整数,则它将起作用:相关问题 更多 >
编程相关推荐