Returns a handle to the thread 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.THREAD_ALL_ACCESS)
| 311 | self.hThread = None |
| 312 | |
| 313 | def get_handle(self, dwDesiredAccess=win32.THREAD_ALL_ACCESS): |
| 314 | """ |
| 315 | Returns a handle to the thread with I{at least} the access rights |
| 316 | requested. |
| 317 | |
| 318 | @note: |
| 319 | If a handle was previously opened and has the required access |
| 320 | rights, it's reused. If not, a new handle is opened with the |
| 321 | combination of the old and new access rights. |
| 322 | |
| 323 | @type dwDesiredAccess: int |
| 324 | @param dwDesiredAccess: Desired access rights. |
| 325 | See: U{http://msdn.microsoft.com/en-us/library/windows/desktop/ms686769(v=vs.85).aspx} |
| 326 | |
| 327 | @rtype: ThreadHandle |
| 328 | @return: Handle to the thread. |
| 329 | |
| 330 | @raise WindowsError: It's not possible to open a handle to the thread |
| 331 | with the requested access rights. This tipically happens because |
| 332 | the target thread belongs to system process and the debugger is not |
| 333 | runnning with administrative rights. |
| 334 | """ |
| 335 | if self.hThread in (None, win32.INVALID_HANDLE_VALUE): |
| 336 | self.open_handle(dwDesiredAccess) |
| 337 | else: |
| 338 | dwAccess = self.hThread.dwAccess |
| 339 | if (dwAccess | dwDesiredAccess) != dwAccess: |
| 340 | self.open_handle(dwAccess | dwDesiredAccess) |
| 341 | return self.hThread |
| 342 | |
| 343 | def clear(self): |
| 344 | """ |
no test coverage detected