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

Method get_handle

pydevd_attach_to_process/winappdbg/process.py:232–261  ·  view source on GitHub ↗

Returns a handle to the process with I{at least} the access rights requested. @note: If a handle was previously opened and has the required access rights, it's reused. If not, a new handle is opened with the combination of the old and new

(self, dwDesiredAccess=win32.PROCESS_ALL_ACCESS)

Source from the content-addressed store, hash-verified

230 self.hProcess = None
231
232 def get_handle(self, dwDesiredAccess=win32.PROCESS_ALL_ACCESS):
233 """
234 Returns a handle to the process with I{at least} the access rights
235 requested.
236
237 @note:
238 If a handle was previously opened and has the required access
239 rights, it's reused. If not, a new handle is opened with the
240 combination of the old and new access rights.
241
242 @type dwDesiredAccess: int
243 @param dwDesiredAccess: Desired access rights.
244 Defaults to L{win32.PROCESS_ALL_ACCESS}.
245 See: U{http://msdn.microsoft.com/en-us/library/windows/desktop/ms684880(v=vs.85).aspx}
246
247 @rtype: L{ProcessHandle}
248 @return: Handle to the process.
249
250 @raise WindowsError: It's not possible to open a handle to the process
251 with the requested access rights. This tipically happens because
252 the target process is a system process and the debugger is not
253 runnning with administrative rights.
254 """
255 if self.hProcess in (None, win32.INVALID_HANDLE_VALUE):
256 self.open_handle(dwDesiredAccess)
257 else:
258 dwAccess = self.hProcess.dwAccess
259 if (dwAccess | dwDesiredAccess) != dwAccess:
260 self.open_handle(dwAccess | dwDesiredAccess)
261 return self.hProcess
262
263 # ------------------------------------------------------------------------------
264

Callers 15

add_existing_sessionMethod · 0.95
__cleanup_processMethod · 0.95
waitMethod · 0.95
killMethod · 0.95
is_debuggedMethod · 0.95
get_exit_codeMethod · 0.95
debug_breakMethod · 0.95
is_wow64Method · 0.95
get_start_timeMethod · 0.95
get_exit_timeMethod · 0.95
get_running_timeMethod · 0.95

Calls 1

open_handleMethod · 0.95

Tested by

no test coverage detected