Prevent OOM
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user