def virtual_protect(self, addr, size, protect, old_protect):
"""Change the access right of one or more page of the process"""
if windows.current_process.bitness == 32 and self.bitness == 64:
#addr = (addr >> 12) << 12
#addr = ULONG64(addr)
if size & 0x0fff:
size = ((size >> 12) + 1) << 12
#ssize = ULONG(size)
old_protect = ctypes.addressof(old_protect)
xaddr = ULONG64(addr)
addr = ctypes.addressof(xaddr)
xsize = ULONG(size)
size = ctypes.addressof(xsize)
return windows.syswow64.NtProtectVirtualMemory_32_to_64(self.handle, addr, size, protect, old_protect)
else:
winproxy.VirtualProtectEx(self.handle, addr, size, protect, old_protect)
评论列表
文章目录