From eb0eec7b39534b0bec5566ef92985f163e1f7025 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Mon, 16 Sep 2024 23:11:37 +0200 Subject: [PATCH] Windows: Fix failed EFI detection on some PCs where BootOrder variable is not defined. we now report that EFI is not support only when GetFirmwareEnvironmentVariable fails with error ERROR_INVALID_FUNCTION. Proposed by @kriegste on https://github.com/veracrypt/VeraCrypt/issues/360 --- src/Common/BootEncryption.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp index c9b275dc..bf7a0f64 100644 --- a/src/Common/BootEncryption.cpp +++ b/src/Common/BootEncryption.cpp @@ -2636,7 +2636,7 @@ namespace VeraCrypt bool EfiBoot::IsEfiBoot() { DWORD BootOrderLen; BootOrderLen = GetFirmwareEnvironmentVariable(L"BootOrder", EfiVarGuid, tempBuf, sizeof(tempBuf)); - return BootOrderLen != 0; + return (BootOrderLen != 0) || (GetLastError() != ERROR_INVALID_FUNCTION); } void EfiBoot::DeleteStartExec(uint16 statrtOrderNum, wchar_t* type) {