1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-01-06 10:34:09 +00:00

Changed sas.dll to dynamically load, becuase it doesn't exist on Windows Core

This commit is contained in:
Bryan Roe
2020-11-16 09:34:29 -08:00
parent 555cf65dac
commit 78f264bd90
3 changed files with 39 additions and 23 deletions

View File

@@ -158,10 +158,26 @@ DWORD WINAPI kvm_ctrlaltdel(LPVOID Param)
{
UNREFERENCED_PARAMETER( Param );
KVMDEBUG("kvm_ctrlaltdel", (int)Param);
typedef VOID(WINAPI *SendSas)(BOOL asUser);
SendSas sas;
// Perform new method (Vista & Win7)
kvm_setupSasPermissions();
SendSAS(FALSE);
HMODULE m = LoadLibraryExA("sas.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
// We need to dynamically load this, becuase it doesn't exist on Windows Core.
// However, LOAD_LIBRARY_SEARCH_SYSTEM32 does not exist on Windows 7 SP1 / Windows Server 2008 R2 without a MSFT Patch,
// but this patch is no longer available from MSFT, so this fallback case will only affect insecure versions of Windows 7 SP1 / Server 2008 R2
if (m == NULL && GetLastError() == ERROR_INVALID_PARAMETER) { m = LoadLibraryA("sas.dll"); }
if (m != NULL)
{
sas = (SendSas)GetProcAddress(m, "SendSAS");
if (sas != NULL)
{
kvm_setupSasPermissions();
sas(FALSE);
}
FreeLibrary(m);
}
return 0;
}