feat(loader): check for wsc service before starting

This commit is contained in:
es3n1n
2025-05-30 12:01:43 +02:00
parent 3583c4636f
commit df93be27ec
13 changed files with 210 additions and 29 deletions

View File

@@ -5,6 +5,7 @@
#include <thread>
#include "core/log.hpp"
#include "shared/strings.hpp"
#include <Windows.h>
@@ -53,6 +54,7 @@ namespace defendnot {
if (delayed) {
/// Sleep for additional 15 seconds to let WSC proceed all previous requests
/// \todo @es3n1n: there should be a better way to handle this
std::this_thread::sleep_for(std::chrono::seconds(15));
}
@@ -92,7 +94,12 @@ 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(strings::wsc_unavailable_error().data());
}
com_checked(status);
return result;
}
};