MCPcopy Create free account
hub / github.com/ELMERIKH/PyinMemoryPE / virtual_protected

Method virtual_protected

windows/winobject/process.py:161–168  ·  view source on GitHub ↗

A context manager for local virtual_protect (old Protection are restored at exit)

(self, addr, size, protect)

Source from the content-addressed store, hash-verified

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"""

Callers

nothing calls this directly

Calls 1

virtual_protectMethod · 0.95

Tested by

no test coverage detected