| 332 | } |
| 333 | |
| 334 | void 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 | |
| 367 | const std::wstring& TraceManager::GetKernelEventName(EVENT_RECORD* rec) const { |
| 368 | static const std::wstring empty; |
nothing calls this directly
no test coverage detected