]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update register hot key logic, return EFI_ALREADY_START status if same hot key alread...
authorEric Dong <eric.dong@intel.com>
Thu, 15 Oct 2015 00:57:20 +0000 (00:57 +0000)
committerydong10 <ydong10@Edk2>
Thu, 15 Oct 2015 00:57:20 +0000 (00:57 +0000)
In current case, if one key was requested to register twice, browser will override old hot key with new one. This behavior is not user friendly.
Now update the logic, return EFI_ALREADY_STARTED for this case. If user still want to override it, he must unregistered it first.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18604 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
MdeModulePkg/Universal/SetupBrowserDxe/Setup.h

index 579396293edf408c60dfff21f910531341df6a6d..43cfc87eeb3d2ce39d936257241522666fb9056c 100644 (file)
@@ -5890,6 +5890,7 @@ SetScope (
   @retval EFI_INVALID_PARAMETER  KeyData is NULL or HelpString is NULL on register.\r
   @retval EFI_NOT_FOUND          KeyData is not found to be unregistered.\r
   @retval EFI_UNSUPPORTED        Key represents a printable character. It is conflicted with Browser.\r
+  @retval EFI_ALREADY_STARTED    Key already been registered for one hot key.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -5935,20 +5936,19 @@ RegisterHotKey (
       return EFI_NOT_FOUND;\r
     }\r
   }\r
-  \r
+\r
+  if (HotKey != NULL) {\r
+    return EFI_ALREADY_STARTED;\r
+  }\r
+\r
   //\r
-  // Register HotKey into List.\r
+  // Create new Key, and add it into List.\r
   //\r
-  if (HotKey == NULL) {\r
-    //\r
-    // Create new Key, and add it into List.\r
-    //\r
-    HotKey = AllocateZeroPool (sizeof (BROWSER_HOT_KEY));\r
-    ASSERT (HotKey != NULL);\r
-    HotKey->Signature = BROWSER_HOT_KEY_SIGNATURE;\r
-    HotKey->KeyData   = AllocateCopyPool (sizeof (EFI_INPUT_KEY), KeyData);\r
-    InsertTailList (&gBrowserHotKeyList, &HotKey->Link);\r
-  }\r
+  HotKey = AllocateZeroPool (sizeof (BROWSER_HOT_KEY));\r
+  ASSERT (HotKey != NULL);\r
+  HotKey->Signature = BROWSER_HOT_KEY_SIGNATURE;\r
+  HotKey->KeyData   = AllocateCopyPool (sizeof (EFI_INPUT_KEY), KeyData);\r
+  InsertTailList (&gBrowserHotKeyList, &HotKey->Link);\r
 \r
   //\r
   // Fill HotKey information.\r
index 12381975355e5d3b6076d75a6fd386e3b9ff6842..61e706a0b4c9ed877a7c655b5ae4767775cc4133 100644 (file)
@@ -1308,6 +1308,7 @@ SetScope (
   @retval EFI_INVALID_PARAMETER  KeyData is NULL.\r
   @retval EFI_NOT_FOUND          KeyData is not found to be unregistered.\r
   @retval EFI_UNSUPPORTED        Key represents a printable character. It is conflicted with Browser.\r
+  @retval EFI_ALREADY_STARTED    Key already been registered for one hot key.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r