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

Method open_handle

pydevd_attach_to_process/winappdbg/process.py:187–213  ·  view source on GitHub ↗

Opens a new handle to the process. The new handle is stored in the L{hProcess} property. @warn: Normally you should call L{get_handle} instead, since it's much "smarter" and tries to reuse handles and merge access rights. @type dwDesiredAccess: int

(self, dwDesiredAccess=win32.PROCESS_ALL_ACCESS)

Source from the content-addressed store, hash-verified

185 return self.fileName
186
187 def open_handle(self, dwDesiredAccess=win32.PROCESS_ALL_ACCESS):
188 """
189 Opens a new handle to the process.
190
191 The new handle is stored in the L{hProcess} property.
192
193 @warn: Normally you should call L{get_handle} instead, since it's much
194 "smarter" and tries to reuse handles and merge access rights.
195
196 @type dwDesiredAccess: int
197 @param dwDesiredAccess: Desired access rights.
198 Defaults to L{win32.PROCESS_ALL_ACCESS}.
199 See: U{http://msdn.microsoft.com/en-us/library/windows/desktop/ms684880(v=vs.85).aspx}
200
201 @raise WindowsError: It's not possible to open a handle to the process
202 with the requested access rights. This tipically happens because
203 the target process is a system process and the debugger is not
204 runnning with administrative rights.
205 """
206 hProcess = win32.OpenProcess(dwDesiredAccess, win32.FALSE, self.dwProcessId)
207
208 try:
209 self.close_handle()
210 except Exception:
211 warnings.warn("Failed to close process handle: %s" % traceback.format_exc())
212
213 self.hProcess = hProcess
214
215 def close_handle(self):
216 """

Callers 1

get_handleMethod · 0.95

Calls 1

close_handleMethod · 0.95

Tested by

no test coverage detected