Skip to content

Commit 44ac68b

Browse files
committed
Remove hard wscapi dependency in loader
1 parent cca0ae7 commit 44ac68b

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Client/loader/MainFunctions.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,21 @@ void CheckAntiVirusStatus()
663663

664664
// Get status from WSC
665665
WSC_SECURITY_PROVIDER_HEALTH health = (WSC_SECURITY_PROVIDER_HEALTH)-1;
666-
WscGetSecurityProviderHealth(WSC_SECURITY_PROVIDER_ANTIVIRUS, &health);
666+
{
667+
using FunctionT = decltype(&WscGetSecurityProviderHealth);
668+
669+
static auto _WscGetSecurityProviderHealth = ([]() -> FunctionT {
670+
if (HMODULE wscapi = LoadLibraryW(L"Wscapi.dll"))
671+
{
672+
return reinterpret_cast<FunctionT>(static_cast<void*>(GetProcAddress(wscapi, "WscGetSecurityProviderHealth")));
673+
}
674+
675+
return nullptr;
676+
})();
677+
678+
if (_WscGetSecurityProviderHealth)
679+
_WscGetSecurityProviderHealth(WSC_SECURITY_PROVIDER_ANTIVIRUS, &health);
680+
}
667681

668682
// Dump results
669683
SString strStatus("AV health: %s (%d)", *EnumToString(health), health);

Client/loader/premake5.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ project "Loader"
1818
"unrar", "d3d9",
1919
"detours", "Imagehlp",
2020
"../../vendor/nvapi/x86/nvapi.lib",
21-
"cryptopp", "Wscapi",
21+
"cryptopp",
2222
}
2323

2424
pchheader "StdInc.h"

0 commit comments

Comments
 (0)