A context manager for local virtual_protect (old Protection are restored at exit)
(self, addr, size, protect)
| 159 | |
| 160 | @contextmanager |
| 161 | def virtual_protected(self, addr, size, protect): |
| 162 | """A context manager for local virtual_protect (old Protection are restored at exit)""" |
| 163 | old_protect = DWORD() |
| 164 | self.virtual_protect(addr, size, protect, old_protect) |
| 165 | try: |
| 166 | yield addr |
| 167 | finally: |
| 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""" |
nothing calls this directly
no test coverage detected