Opens a new handle to the thread, closing the previous one. The new handle is stored in the L{hThread} 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
(self, dwDesiredAccess=win32.THREAD_ALL_ACCESS)
| 267 | # ------------------------------------------------------------------------------ |
| 268 | |
| 269 | def open_handle(self, dwDesiredAccess=win32.THREAD_ALL_ACCESS): |
| 270 | """ |
| 271 | Opens a new handle to the thread, closing the previous one. |
| 272 | |
| 273 | The new handle is stored in the L{hThread} property. |
| 274 | |
| 275 | @warn: Normally you should call L{get_handle} instead, since it's much |
| 276 | "smarter" and tries to reuse handles and merge access rights. |
| 277 | |
| 278 | @type dwDesiredAccess: int |
| 279 | @param dwDesiredAccess: Desired access rights. |
| 280 | Defaults to L{win32.THREAD_ALL_ACCESS}. |
| 281 | See: U{http://msdn.microsoft.com/en-us/library/windows/desktop/ms686769(v=vs.85).aspx} |
| 282 | |
| 283 | @raise WindowsError: It's not possible to open a handle to the thread |
| 284 | with the requested access rights. This tipically happens because |
| 285 | the target thread belongs to system process and the debugger is not |
| 286 | runnning with administrative rights. |
| 287 | """ |
| 288 | hThread = win32.OpenThread(dwDesiredAccess, win32.FALSE, self.dwThreadId) |
| 289 | |
| 290 | # In case hThread was set to an actual handle value instead of a Handle |
| 291 | # object. This shouldn't happen unless the user tinkered with it. |
| 292 | if not hasattr(self.hThread, "__del__"): |
| 293 | self.close_handle() |
| 294 | |
| 295 | self.hThread = hThread |
| 296 | |
| 297 | def close_handle(self): |
| 298 | """ |
no test coverage detected