Change the access right of one or more page of the process
(self, addr, size, protect, old_protect=None)
| 168 | self.virtual_protect(addr, size, old_protect.value, old_protect) |
| 169 | |
| 170 | def virtual_protect(self, addr, size, protect, old_protect=None): |
| 171 | """Change the access right of one or more page of the process""" |
| 172 | if windows.current_process.bitness == 32 and self.bitness == 64: |
| 173 | if size & 0x0fff: |
| 174 | size = ((size >> 12) + 1) << 12 |
| 175 | if old_protect is None: |
| 176 | old_protect = gdef.DWORD() |
| 177 | xold_protect = ctypes.addressof(old_protect) |
| 178 | xaddr = ULONG64(addr) |
| 179 | addr = ctypes.addressof(xaddr) |
| 180 | xsize = ULONG(size) |
| 181 | size = ctypes.addressof(xsize) |
| 182 | return windows.syswow64.NtProtectVirtualMemory_32_to_64(self.handle, addr, size, protect, xold_protect) |
| 183 | else: |
| 184 | winproxy.VirtualProtectEx(self.handle, addr, size, protect, old_protect) |
| 185 | |
| 186 | |
| 187 | def execute(self, code, parameter=0): |
no outgoing calls
no test coverage detected