MCPcopy Create free account
hub / github.com/OpenSteam001/OpenSteamTool / IsSystemModulePath

Function IsSystemModulePath

src/OSTPlatform/Windows/Process.cpp:341–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339}
340
341bool IsSystemModulePath(const std::string& path) {
342 static const std::string systemDir = [] {
343 const UINT needed = GetWindowsDirectoryW(nullptr, 0);
344 if (needed == 0) {
345 OSTP_LOG_WARN("GetWindowsDirectoryW(size query) failed (error={})", GetLastError());
346 return std::string{};
347 }
348 std::wstring dir(needed, L'\0');
349 const UINT written = GetWindowsDirectoryW(dir.data(), needed);
350 if (written == 0 || written >= needed) {
351 OSTP_LOG_WARN("GetWindowsDirectoryW failed (written={}, error={})", written, GetLastError());
352 return std::string{};
353 }
354 dir.resize(written);
355 std::string normalized = NormalizePathForCompare(Encoding::WideToUtf8(dir));
356 if (!normalized.empty() && normalized.back() != '\\') normalized += '\\';
357 return normalized;
358 }();
359
360 if (systemDir.empty()) return false;
361 return NormalizePathForCompare(path).starts_with(systemDir);
362}
363
364} // namespace OSTPlatform::Process

Callers 1

EnumerateModulesFunction · 0.85

Calls 4

NormalizePathForCompareFunction · 0.85
WideToUtf8Function · 0.85
dataMethod · 0.80
emptyMethod · 0.80

Tested by

no test coverage detected