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

Method GetDetails

WinArk/ThreadObjectType.cpp:9–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7}
8
9CString ThreadObjectType::GetDetails(HANDLE hThread) {
10 CString details;
11 auto tid = ::GetThreadId(hThread);
12 if (tid == 0)
13 return details;
14
15 auto pid = ::GetProcessIdOfThread(hThread);
16 FILETIME created{}, exited{}, kernel{}, user{};
17 ATLVERIFY(::GetThreadTimes(hThread, &created, &exited, &kernel, &user));
18 CString name;
19 auto info = _pm.GetProcessById(pid);
20 if (info)
21 name = info->GetImageName().c_str();
22 details.Format(L"TID: %u, PID: %u (%s) Created: %s, Exited: %s, CPU Time: %s",
23 tid, pid, name, CTime(created).Format(L"%D %X"),
24 exited.dwHighDateTime + exited.dwLowDateTime == 0 ? CString(L"(running)") : CTime(exited).Format(L"%D %X"),
25 CTimeSpan((*(int64_t*)& kernel + *(int64_t*)& user) / 10000000).Format(L"%D.%H:%M:%S"));
26
27 return details;
28}

Callers

nothing calls this directly

Calls 1

GetProcessByIdMethod · 0.45

Tested by

no test coverage detected