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 - 2018, 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
HotkeyBoot (\r
VOID\r
)\r
-{ \r
+{\r
EFI_STATUS Status;\r
UINTN ExitDataSize;\r
CHAR16 *ExitData;\r
\r
if (mHotkeyBootOption == NULL) {\r
return EFI_NOT_FOUND;\r
- } \r
- \r
+ }\r
+\r
BdsLibConnectDevicePath (mHotkeyBootOption->DevicePath);\r
\r
//\r
HotkeyData = &Hotkey->KeyData[Hotkey->WaitingKey];\r
if ((KeyData->Key.ScanCode == HotkeyData->Key.ScanCode) &&\r
(KeyData->Key.UnicodeChar == HotkeyData->Key.UnicodeChar) &&\r
- (((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) ? \r
+ (((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) ?\r
(KeyData->KeyState.KeyShiftState == HotkeyData->KeyState.KeyShiftState) : TRUE\r
)\r
) {\r
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
\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
)\r
{\r
UINTN Index;\r
- \r
+\r
if (!CompareGuid (Guid, &gEfiGlobalVariableGuid) ||\r
(StrSize (Name) != sizeof (L"Key####")) ||\r
(StrnCmp (Name, L"Key", 3) != 0)\r
*OptionNumber = 0;\r
for (Index = 3; Index < 7; Index++) {\r
if ((Name[Index] >= L'0') && (Name[Index] <= L'9')) {\r
- *OptionNumber = *OptionNumber * 10 + Name[Index] - L'0';\r
+ *OptionNumber = *OptionNumber * 16 + Name[Index] - L'0';\r
} else if ((Name[Index] >= L'A') && (Name[Index] <= L'F')) {\r
- *OptionNumber = *OptionNumber * 10 + Name[Index] - L'A';\r
+ *OptionNumber = *OptionNumber * 16 + Name[Index] - L'A' + 10;\r
} else {\r
return FALSE;\r
}\r
sizeof (UINT32),\r
&BootOptionSupport\r
);\r
+ //\r
+ // Platform needs to make sure setting volatile variable before calling 3rd party code shouldn't fail.\r
+ //\r
ASSERT_EFI_ERROR (Status);\r
\r
KeyOptionNumbers = HotkeyGetOptionNumbers (&KeyOptionCount);\r