Removes any directory and extension, and converts the remaining name to lower case.
| 94 | // Removes any directory and extension, and converts the remaining name to |
| 95 | // lower case. |
| 96 | void 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 | |
| 110 | static bool IsTargetProcess(uint32_t processId, std::wstring const& processName) |
| 111 | { |
no test coverage detected