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
This commit is contained in:
Mounir IDRASSI 2024-09-16 23:11:37 +02:00
parent 3a1c8bac59
commit eb0eec7b39
No known key found for this signature in database
GPG Key ID: FC1B00364B3FE937

View File

@ -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) {