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

Method GetDetails

WinArk/ProcessObjectType.cpp:10–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8}
9
10CString ProcessObjectType::GetDetails(HANDLE hProcess) {
11 CString details;
12 auto pid = ::GetProcessId(hProcess);
13 auto name = ProcessHelper::GetProcessName(hProcess);
14 if (name.IsEmpty()) {
15 auto info = _pm.GetProcessById(pid);
16 if (info)
17 name = info->GetImageName().c_str();
18 }
19 FILETIME create, exit{}, dummy;
20 if (::GetProcessTimes(hProcess, &create, &exit, &dummy, &dummy)) {
21 details.Format(L"PID: %d (%s) Created: %s Exited: %s", pid, name,
22 CTime(create).Format(L"%D %X"),
23 exit.dwHighDateTime + exit.dwLowDateTime == 0 ? CString(L"(running)") : CTime(exit).Format(L"%D %X"));
24 }
25 else {
26 details.Format(L"PID: %d (%s)", pid, name);
27 }
28 return details;
29}

Callers

nothing calls this directly

Calls 2

IsEmptyMethod · 0.80
GetProcessByIdMethod · 0.45

Tested by

no test coverage detected