MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / open_handle

Method open_handle

pydevd_attach_to_process/winappdbg/module.py:385–404  ·  view source on GitHub ↗

Opens a new handle to the module. The new handle is stored in the L{hFile} property.

(self)

Source from the content-addressed store, hash-verified

383 # ------------------------------------------------------------------------------
384
385 def open_handle(self):
386 """
387 Opens a new handle to the module.
388
389 The new handle is stored in the L{hFile} property.
390 """
391
392 if not self.get_filename():
393 msg = "Cannot retrieve filename for module at %s"
394 msg = msg % HexDump.address(self.get_base())
395 raise Exception(msg)
396
397 hFile = win32.CreateFile(self.get_filename(), dwShareMode=win32.FILE_SHARE_READ, dwCreationDisposition=win32.OPEN_EXISTING)
398
399 # In case hFile was set to an actual handle value instead of a Handle
400 # object. This shouldn't happen unless the user tinkered with hFile.
401 if not hasattr(self.hFile, "__del__"):
402 self.close_handle()
403
404 self.hFile = hFile
405
406 def close_handle(self):
407 """

Callers 1

get_handleMethod · 0.95

Calls 4

get_filenameMethod · 0.95
get_baseMethod · 0.95
close_handleMethod · 0.95
addressMethod · 0.45

Tested by

no test coverage detected