MCPcopy Create free account
hub / github.com/AlSch092/UltimateAntiCheat / IsSecureBootEnabled

Method IsSecureBootEnabled

Environment/Services.cpp:387–414  ·  view source on GitHub ↗

IsSecureBootEnabled - checks if secure bool is enabled on machine through a powershell cmdlet (`Confirm-SecureBootUEFI`) returns `true` if secure boot is enabled */

Source from the content-addressed store, hash-verified

385 returns `true` if secure boot is enabled
386*/
387BOOL Services::IsSecureBootEnabled()
388{
389 HKEY hKey;
390 LONG lResult;
391 DWORD dwSize = sizeof(DWORD);
392 DWORD dwValue = 0;
393 const char* registryPath = "SYSTEM\\CurrentControlSet\\Control\\SecureBoot\\State";
394 const char* valueName = "UEFISecureBootEnabled";
395
396 lResult = RegOpenKeyExA(HKEY_LOCAL_MACHINE, registryPath, 0, KEY_READ, &hKey);
397 if (lResult != ERROR_SUCCESS)
398 {
399 Logger::logf(Err, "Error opening registry key: (%d) @ Services::IsSecureBootEnabled", GetLastError());
400 return FALSE;
401 }
402
403 lResult = RegQueryValueExA(hKey, valueName, NULL, NULL, (LPBYTE)&dwValue, &dwSize);
404
405 if (lResult != ERROR_SUCCESS)
406 {
407 Logger::logf(Err, "Error querying registry value: %d @ Services::IsSecureBootEnabled", GetLastError());
408 RegCloseKey(hKey);
409 return FALSE;
410 }
411
412 RegCloseKey(hKey);
413 return dwValue;
414}
415
416/*
417 GetWindowsDrive - return drive where windows is installed, such as C:\\

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected