MCPcopy Create free account
hub / github.com/dobin/RedEdr / EtwReaderStopAll

Function EtwReaderStopAll

RedEdr/etwreader.cpp:459–486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

457
458
459void EtwReaderStopAll() {
460 // Signal stop
461 if (hStopEventEtw != NULL) {
462 SetEvent(hStopEventEtw);
463 }
464
465 trace_user.stop();
466
467 // Wait for thread to exit cleanly
468 if (hEtwThreadHandle != NULL) {
469 if (WaitForSingleObject(hEtwThreadHandle, 5000) == WAIT_TIMEOUT) {
470 LOG_A(LOG_WARNING, "ETW: Thread did not exit in time, force-terminating");
471 TerminateThread(hEtwThreadHandle, 1);
472 }
473 CloseHandle(hEtwThreadHandle);
474 hEtwThreadHandle = NULL;
475 }
476
477 // Clean up event handles
478 if (hStopEventEtw != NULL) {
479 CloseHandle(hStopEventEtw);
480 hStopEventEtw = NULL;
481 }
482 if (threadReadynessEtw != NULL) {
483 CloseHandle(threadReadynessEtw);
484 threadReadynessEtw = NULL;
485 }
486}

Callers 1

ManagerShutdownFunction · 0.85

Calls 2

stopMethod · 0.80
LOG_AFunction · 0.70

Tested by

no test coverage detected