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

Function GetProcessName

RedEdrShared/process_query.cpp:73–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71
72
73std::wstring GetProcessName(HANDLE hProcess) {
74 if (!hProcess || hProcess == INVALID_HANDLE_VALUE) {
75 LOG_A(LOG_WARNING, "GetProcessName: Invalid process handle");
76 return std::wstring(L"");
77 }
78
79 WCHAR exePath[MAX_PATH] = { 0 };
80 if (GetModuleFileNameEx(hProcess, NULL, exePath, MAX_PATH)) {
81 //LOG_W(LOG_INFO, L"GetProcessName: Process name: %s", exePath);
82 return std::wstring(exePath);
83 }
84 else {
85 // Happens often
86 LOG_A(LOG_WARNING, "GetProcessName: Failed to get module filename. Error: %lu", GetLastError());
87 return std::wstring(L"");
88 }
89}
90
91
92// Process: PEB Info

Callers

nothing calls this directly

Calls 1

LOG_AFunction · 0.50

Tested by

no test coverage detected