MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / HandleNoProcessId

Method HandleNoProcessId

WinSysCore/TraceManager.cpp:334–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332}
333
334void TraceManager::HandleNoProcessId(EventData* data) {
335 DWORD tid = 0;
336 if (data->GetThreadId() == 0 || data->GetThreadId() == (DWORD)-1) {
337 auto prop = data->GetProperty(L"ThreadId");
338 if (!prop)
339 prop = data->GetProperty(L"TThreadId");
340 if (prop) {
341 tid = prop->GetValue<DWORD>();
342 data->_threadId = tid;
343 }
344
345 prop = data->GetProperty(L"PID");
346 if (prop == nullptr)
347 prop = data->GetProperty(L"ProcessId");
348 if (prop) {
349 auto pid = prop->GetValue<DWORD>();
350 data->_processId = pid;
351 data->SetProcessName(GetProcessImageById(pid));
352 }
353 else if (tid) {
354 wil::unique_handle hThread(::OpenThread(THREAD_QUERY_LIMITED_INFORMATION,FALSE, tid));
355 if (hThread) {
356 auto pid = ::GetProcessIdOfThread(hThread.get());
357 if (pid) {
358 data->_processId = pid;
359 data->SetProcessName(GetProcessImageById(pid));
360 }
361 }
362 }
363 }
364
365}
366
367const std::wstring& TraceManager::GetKernelEventName(EVENT_RECORD* rec) const {
368 static const std::wstring empty;

Callers

nothing calls this directly

Calls 3

GetThreadIdMethod · 0.80
GetPropertyMethod · 0.80
SetProcessNameMethod · 0.80

Tested by

no test coverage detected