MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / QueryProcessName

Function QueryProcessName

PresentMon/OutputThread.cpp:288–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286}
287
288static void QueryProcessName(uint32_t processId, ProcessInfo* info)
289{
290 auto const& args = GetCommandLineArgs();
291
292 wchar_t path[MAX_PATH];
293 const wchar_t* processName = L"<unknown>";
294 HANDLE handle = NULL;
295
296 if (args.mEtlFileName == nullptr) {
297 handle = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, processId);
298 if (handle != NULL) {
299 DWORD numChars = _countof(path);
300 if (QueryFullProcessImageNameW(handle, 0, path, &numChars)) {
301 for (;; --numChars) {
302 if (numChars == 0 || path[numChars - 1] == L'\\' || path[numChars - 1] == L'/') {
303 processName = &path[numChars];
304 break;
305 }
306 }
307 }
308 }
309 }
310
311 info->mModuleName = processName;
312 info->mHandle = handle;
313}
314
315static bool GetPresentProcessInfo(
316 std::shared_ptr<PresentEvent> const& presentEvent,

Callers 1

GetPresentProcessInfoFunction · 0.85

Calls 1

OpenProcessFunction · 0.85

Tested by

no test coverage detected