Prevent OOM

This commit is contained in:
2026-06-18 05:55:31 +10:00
parent ebba70b9d9
commit b3436a61ee
44 changed files with 1797 additions and 66 deletions
+21
View File
@@ -1427,6 +1427,27 @@ namespace ANSCENTER
return str.c_str();
}
// Static, handle-free hardware id. Mirrors ANSLSHelper::GetCurrentHardwareId but has no
// instance/_logger, so diagnostics go to DebugView via ANS_DBG. Returns "" on failure.
std::string ANSLicenseHelper::GetHardwareId() {
try {
const wchar_t* hwid = KeyHelper::GetCurrentHardwareId();
std::wstring result_t = std::wstring(hwid);
std::string result = WString2String(result_t);
ANS_DBG("ANSLicenseHelper", "GetHardwareId -> '%s'", result.c_str());
return result;
}
catch (ANSCENTER::Licensing::Exception* ex) {
ANS_DBG("ANSLicenseHelper", "GetHardwareId failed: %s", ex->GetExceptionMessage());
ex->Destroy();
return "";
}
catch (...) {
ANS_DBG("ANSLicenseHelper", "GetHardwareId failed: unknown exception");
return "";
}
}
bool ANSLicenseHelper::isPathSafe(const std::string& pathStr) {
// Basic safety checks - customize as needed
if (pathStr.empty()) return false;