Skip to contentSkip to conversation

fix EFI detection on Windows

PATCH In review Andrey Borzenkov 2 participants 2 messages Dec 25, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix EFI detection on Windows

We are on legacy BIOS if GetFirmwareEnvironmentVariable fails (returns zero) *and* extended error information is ERROR_INVALID_FUNCTION.

Cf. http://msdn.microsoft.com/en-us/library/windows/desktop/ms724325%28v=vs.85%29.aspx

---
 grub-core/osdep/windows/platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/osdep/windows/platform.c +1 -1
index f2b9d71..d217efe 100644
@@ -100,7 +100,7 @@ get_platform (void)
 
   if (!func_GetFirmwareEnvironmentVariableW (L"BootOrder", GRUB_EFI_GLOBAL_VARIABLE_GUID_WINDOWS_STR,
 					     buffer, sizeof (buffer))
-      && GetLastError () != ERROR_INVALID_FUNCTION)
+      && GetLastError () == ERROR_INVALID_FUNCTION)
     {
       platform = PLAT_BIOS;
       return;
Signature · 1 line
tg: (e8f0782..) u/windows-efi-detection (depends on: master)
#1 lore raw

go ahead

Quoted 33 lines · Andrey Borzenkov

We are on legacy BIOS if GetFirmwareEnvironmentVariable fails (returns zero) *and* extended error information is ERROR_INVALID_FUNCTION.

Cf.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724325%28v=vs.85%29.aspx

---
 grub-core/osdep/windows/platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/osdep/windows/platform.c +1 -1
index f2b9d71..d217efe 100644
@@ -100,7 +100,7 @@ get_platform (void)
 
   if (!func_GetFirmwareEnvironmentVariableW (L"BootOrder",
 GRUB_EFI_GLOBAL_VARIABLE_GUID_WINDOWS_STR,
                                             buffer, sizeof (buffer))
-      && GetLastError () != ERROR_INVALID_FUNCTION)
+      && GetLastError () == ERROR_INVALID_FUNCTION)
     {
       platform = PLAT_BIOS;
       return;

--
tg: (e8f0782..) u/windows-efi-detection (depends on: master)

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel