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

Function CanonicalizeProcessName

PresentMon/OutputThread.cpp:96–108  ·  view source on GitHub ↗

Removes any directory and extension, and converts the remaining name to lower case.

Source from the content-addressed store, hash-verified

94// Removes any directory and extension, and converts the remaining name to
95// lower case.
96void CanonicalizeProcessName(std::wstring* name)
97{
98 size_t i = name->find_last_of(L"./\\");
99 if (i != std::wstring::npos && (*name)[i] == L'.') {
100 name->resize(i);
101 i = name->find_last_of(L"/\\");
102 }
103
104 *name = name->substr(i + 1);
105
106 std::transform(name->begin(), name->end(), name->begin(),
107 [](wchar_t c) { return (wchar_t) ::towlower(c); });
108}
109
110static bool IsTargetProcess(uint32_t processId, std::wstring const& processName)
111{

Callers 2

IsTargetProcessFunction · 0.85
ParseCommandLineFunction · 0.85

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected