ContextManager to allocate memory and free it :type: :class:`int` -- the address of the allocated memory
(self, size, prot=PAGE_EXECUTE_READWRITE)
| 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): |
no test coverage detected