process.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:PythonForWindows 作者: hakril 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号