mirror of
https://github.com/es3n1n/defendnot.git
synced 2026-08-02 10:32:01 +00:00
feat(loader): check for wsc service before starting
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user