Merge pull request #28 from es3n1n/windows-server-notice

feat(com): display detailed error message if WSC not available
This commit is contained in:
Arsenii es3n1n
2025-05-30 12:02:05 +02:00
committed by GitHub

View File

@@ -92,7 +92,14 @@ namespace defendnot {
public:
static IWscAVStatus* get() {
IWscAVStatus* result = nullptr;
com_checked(CoCreateInstance(detail::CLSID_IWscAVStatus, 0, 1, detail::IID_IWscAVStatus, reinterpret_cast<LPVOID*>(&result)));
const auto status = CoCreateInstance(detail::CLSID_IWscAVStatus, 0, 1, detail::IID_IWscAVStatus, reinterpret_cast<LPVOID*>(&result));
if (status == REGDB_E_CLASSNOTREG) {
throw std::runtime_error("Windows Security Center (WSC) is not available on this machine.\n"
"This typically occurs on Windows Server operating systems, which are not supported by this tool.\n"
"For more details, please refer to: https://github.com/es3n1n/defendnot/issues/17");
}
com_checked(status);
return result;
}
};