Terminates the thread execution. @note: If the C{lpInjectedMemory} member contains a valid pointer, the memory is freed. @type dwExitCode: int @param dwExitCode: (Optional) Thread exit code.
(self, dwExitCode=0)
| 362 | self.get_handle(win32.SYNCHRONIZE).wait(dwTimeout) |
| 363 | |
| 364 | def kill(self, dwExitCode=0): |
| 365 | """ |
| 366 | Terminates the thread execution. |
| 367 | |
| 368 | @note: If the C{lpInjectedMemory} member contains a valid pointer, |
| 369 | the memory is freed. |
| 370 | |
| 371 | @type dwExitCode: int |
| 372 | @param dwExitCode: (Optional) Thread exit code. |
| 373 | """ |
| 374 | hThread = self.get_handle(win32.THREAD_TERMINATE) |
| 375 | win32.TerminateThread(hThread, dwExitCode) |
| 376 | |
| 377 | # Ugliest hack ever, won't work if many pieces of code are injected. |
| 378 | # Seriously, what was I thinking? :( |
| 379 | if self.pInjectedMemory is not None: |
| 380 | try: |
| 381 | self.get_process().free(self.pInjectedMemory) |
| 382 | self.pInjectedMemory = None |
| 383 | except Exception: |
| 384 | ## raise # XXX DEBUG |
| 385 | pass |
| 386 | |
| 387 | # XXX TODO |
| 388 | # suspend() and resume() should have a counter of how many times a thread |
nothing calls this directly
no test coverage detected