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

Method allocated_memory

windows/winobject/process.py:149–158  ·  view source on GitHub ↗

ContextManager to allocate memory and free it :type: :class:`int` -- the address of the allocated memory

(self, size, prot=PAGE_EXECUTE_READWRITE)

Source from the content-addressed store, hash-verified

147
148 @contextmanager
149 def allocated_memory(self, size, prot=PAGE_EXECUTE_READWRITE):
150 """ContextManager to allocate memory and free it
151
152 :type: :class:`int` -- the address of the allocated memory
153 """
154 addr = self.virtual_alloc(size, prot=prot)
155 try:
156 yield addr
157 finally:
158 winproxy.VirtualFreeEx(self.handle, addr)
159
160 @contextmanager
161 def virtual_protected(self, addr, size, protect):

Calls 1

virtual_allocMethod · 0.95

Tested by

no test coverage detected