]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c
Rollback the change to EFI_BOOT_KEY_DATA structure since UEFI Spec adds the clarifica...
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / Hotkey.c
index ee1df6f73005b03878abb21e4ec3b18c6c805491..477411377d9a9ea048ffd12630270e79279a592a 100644 (file)
@@ -2,7 +2,7 @@
   Provides a way for 3rd party applications to register themselves for launch by the\r
   Boot Manager based on hot key\r
 \r
-Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -315,6 +315,7 @@ HotkeyInsertList (
   BDS_HOTKEY_OPTION  *HotkeyLeft;\r
   BDS_HOTKEY_OPTION  *HotkeyRight;\r
   UINTN              Index;\r
+  EFI_BOOT_KEY_DATA  KeyOptions;\r
   UINT32             KeyShiftStateLeft;\r
   UINT32             KeyShiftStateRight;\r
   EFI_INPUT_KEY      *InputKey;\r
@@ -327,28 +328,31 @@ HotkeyInsertList (
 \r
   HotkeyLeft->Signature = BDS_HOTKEY_OPTION_SIGNATURE;\r
   HotkeyLeft->BootOptionNumber = KeyOption->BootOption;\r
-  HotkeyLeft->CodeCount = (UINT8) KEY_OPTION_INPUT_KEY_COUNT (KeyOption);\r
+\r
+  KeyOptions = KeyOption->KeyData;\r
+\r
+  HotkeyLeft->CodeCount = (UINT8) KeyOptions.Options.InputKeyCount;\r
 \r
   //\r
   // Map key shift state from KeyOptions to EFI_KEY_DATA.KeyState\r
   //\r
   KeyShiftStateRight = EFI_SHIFT_STATE_VALID;\r
-  if (KEY_OPTION_SHIFT_PRESSED (KeyOption)) {\r
+  if (KeyOptions.Options.ShiftPressed) {\r
     KeyShiftStateRight |= EFI_RIGHT_SHIFT_PRESSED;\r
   }\r
-  if (KEY_OPTION_CONTROL_PRESSED (KeyOption)) {\r
+  if (KeyOptions.Options.ControlPressed) {\r
     KeyShiftStateRight |= EFI_RIGHT_CONTROL_PRESSED;\r
   }\r
-  if (KEY_OPTION_ALT_PRESSED (KeyOption)) {\r
+  if (KeyOptions.Options.AltPressed) {\r
     KeyShiftStateRight |= EFI_RIGHT_ALT_PRESSED;\r
   }\r
-  if (KEY_OPTION_LOGO_PRESSED (KeyOption)) {\r
+  if (KeyOptions.Options.LogoPressed) {\r
     KeyShiftStateRight |= EFI_RIGHT_LOGO_PRESSED;\r
   }\r
-  if (KEY_OPTION_MENU_PRESSED (KeyOption)) {\r
+  if (KeyOptions.Options.MenuPressed) {\r
     KeyShiftStateRight |= EFI_MENU_KEY_PRESSED;\r
   }\r
-  if (KEY_OPTION_SYS_REQ_PRESSED (KeyOption)) {\r
+  if (KeyOptions.Options.SysReqPressed) {\r
     KeyShiftStateRight |= EFI_SYS_REQ_PRESSED;\r
   }\r
 \r
@@ -419,7 +423,7 @@ IsKeyOptionVariable (
   UINTN         Index;\r
   \r
   if (!CompareGuid (Guid, &gEfiGlobalVariableGuid) ||\r
-      (StrSize (Name) != sizeof (L"Key####")) &&\r
+      (StrSize (Name) != sizeof (L"Key####")) ||\r
       (StrnCmp (Name, L"Key", 3) != 0)\r
      ) {\r
     return FALSE;\r
@@ -470,11 +474,13 @@ HotkeyGetOptionNumbers (
 \r
   NameSize = sizeof (CHAR16);\r
   Name     = AllocateZeroPool (NameSize);\r
+  ASSERT (Name != NULL);\r
   while (TRUE) {\r
     NewNameSize = NameSize;\r
     Status = gRT->GetNextVariableName (&NewNameSize, Name, &Guid);\r
     if (Status == EFI_BUFFER_TOO_SMALL) {\r
       Name = ReallocatePool (NameSize, NewNameSize, Name);\r
+      ASSERT (Name != NULL);\r
       Status = gRT->GetNextVariableName (&NewNameSize, Name, &Guid);\r
       NameSize = NewNameSize;\r
     }\r
@@ -490,6 +496,7 @@ HotkeyGetOptionNumbers (
                         (*Count + 1) * sizeof (UINT16),\r
                         OptionNumbers\r
                         );\r
+      ASSERT (OptionNumbers != NULL);\r
       for (Index = 0; Index < *Count; Index++) {\r
         if (OptionNumber < OptionNumbers[Index]) {\r
           break;\r
@@ -548,7 +555,7 @@ InitializeHotkeyService (
   KeyOptionNumbers = HotkeyGetOptionNumbers (&KeyOptionCount);\r
   for (Index = 0; Index < KeyOptionCount; Index ++) {\r
     UnicodeSPrint (KeyOptionName, sizeof (KeyOptionName), L"Key%04x", KeyOptionNumbers[Index]);\r
-    GetEfiGlobalVariable2 (KeyOptionName, &KeyOption, NULL);\r
+    GetEfiGlobalVariable2 (KeyOptionName, (VOID **) &KeyOption, NULL);\r
     ASSERT (KeyOption != NULL);\r
     if (IsKeyOptionValid (KeyOption)) {\r
       HotkeyInsertList (KeyOption);\r