File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed
Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -171,11 +171,8 @@ class CurrentProcessReadSyswow(process.Process):
171171 bitness = 64
172172
173173 def _get_handle (self ):
174- # return winproxy.GetCurrentProcess()
175- return 0xffffffffffffffff
176-
177- def __del__ (self ):
178- pass
174+ # GetCurrentProcess() is not accepted for NtWow64ReadVirtualMemory64 :(
175+ return winproxy .OpenProcess (dwProcessId = windows .current_process .pid )
179176
180177 def read_memory (self , addr , size ):
181178 buffer_addr = ctypes .create_string_buffer (size )
Original file line number Diff line number Diff line change @@ -520,11 +520,12 @@ def handles(self):
520520 return [h for h in windows .system .handles if h .dwProcessId == pid ]
521521
522522 def __del__ (self ):
523- super (Process , self ).__del__ ()
524- # Same logic that AutoHandle.__del__ for Process.limited_handle
525- # Assert that Process inherit AutoHandle
526523 # sys.path is not None -> check if python shutdown
527524 if sys .path is not None and hasattr (self , "_limited_handle" ) and self ._limited_handle :
525+ # Same logic that AutoHandle.__del__ for Process.limited_handle
526+ # Assert that Process inherit AutoHandle
527+ # Call super after check as Process could be None during destruction
528+ super (Process , self ).__del__ ()
528529 # Prevent some bug where dbgprint might be None when __del__ is called in a closing process
529530 # This line is bad -> it reopens a handle closed by 'super(Process, self).__del__()' ._.
530531 dbgprint ("Closing limited handle {0} for {1}" .format (hex (self ._limited_handle ), self ), "HANDLE" ) if dbgprint is not None else None
You can’t perform that action at this time.
0 commit comments