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

Function InitializeEtwReader

RedEdr/etwreader.cpp:239–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237
238
239BOOL InitializeEtwReader(std::vector<HANDLE>& threads) {
240 hStopEventEtw = CreateEvent(NULL, TRUE, FALSE, NULL);
241 if (hStopEventEtw == NULL) {
242 LOG_A(LOG_ERROR, "ETW: Failed to create stop event");
243 return FALSE;
244 }
245 threadReadynessEtw = CreateEvent(NULL, TRUE, FALSE, NULL);
246 if (threadReadynessEtw == NULL) {
247 LOG_A(LOG_ERROR, "ETW: Failed to create event for thread readiness");
248 CloseHandle(hStopEventEtw);
249 hStopEventEtw = NULL;
250 return FALSE;
251 }
252
253 HANDLE thread = CreateThread(NULL, 0, TraceProcessingThread, NULL, 0, NULL);
254 if (thread == NULL) {
255 LOG_A(LOG_ERROR, "ETW: Could not start thread");
256 CloseHandle(hStopEventEtw);
257 hStopEventEtw = NULL;
258 CloseHandle(threadReadynessEtw);
259 threadReadynessEtw = NULL;
260 return FALSE;
261 }
262 hEtwThreadHandle = thread;
263
264 // Wait for the thread (ETW) to be fully initialized before returning
265 WaitForSingleObject(threadReadynessEtw, INFINITE);
266
267 LOG_A(LOG_DEBUG, "!ETW: Thread: begin");
268 threads.push_back(thread);
269 return TRUE;
270}
271
272
273DWORD WINAPI TraceProcessingThread(LPVOID param) {

Callers 1

ManagerStartFunction · 0.85

Calls 1

LOG_AFunction · 0.70

Tested by

no test coverage detected