Revision: 18794
          http://sourceforge.net/p/edk2/code/18794
Author:   vanjeff
Date:     2015-11-16 06:54:44 +0000 (Mon, 16 Nov 2015)
Log Message:
-----------
Update register hot key logic, return EFI_ALREADY_START status if same hot key 
already existed.

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.

(Sync patch r18604 from main trunk.)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <[email protected]>
Reviewed-by: Liming Gao <[email protected]>

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/18604

Modified Paths:
--------------
    branches/UDK2015/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
    branches/UDK2015/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h

Modified: branches/UDK2015/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
===================================================================
--- branches/UDK2015/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c     
2015-11-16 06:53:53 UTC (rev 18793)
+++ branches/UDK2015/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c     
2015-11-16 06:54:44 UTC (rev 18794)
@@ -5890,6 +5890,7 @@
   @retval EFI_INVALID_PARAMETER  KeyData is NULL or HelpString is NULL on 
register.
   @retval EFI_NOT_FOUND          KeyData is not found to be unregistered.
   @retval EFI_UNSUPPORTED        Key represents a printable character. It is 
conflicted with Browser.
+  @retval EFI_ALREADY_STARTED    Key already been registered for one hot key.
 **/
 EFI_STATUS
 EFIAPI
@@ -5935,20 +5936,19 @@
       return EFI_NOT_FOUND;
     }
   }
-  
+
+  if (HotKey != NULL) {
+    return EFI_ALREADY_STARTED;
+  }
+
   //
-  // Register HotKey into List.
+  // Create new Key, and add it into List.
   //
-  if (HotKey == NULL) {
-    //
-    // Create new Key, and add it into List.
-    //
-    HotKey = AllocateZeroPool (sizeof (BROWSER_HOT_KEY));
-    ASSERT (HotKey != NULL);
-    HotKey->Signature = BROWSER_HOT_KEY_SIGNATURE;
-    HotKey->KeyData   = AllocateCopyPool (sizeof (EFI_INPUT_KEY), KeyData);
-    InsertTailList (&gBrowserHotKeyList, &HotKey->Link);
-  }
+  HotKey = AllocateZeroPool (sizeof (BROWSER_HOT_KEY));
+  ASSERT (HotKey != NULL);
+  HotKey->Signature = BROWSER_HOT_KEY_SIGNATURE;
+  HotKey->KeyData   = AllocateCopyPool (sizeof (EFI_INPUT_KEY), KeyData);
+  InsertTailList (&gBrowserHotKeyList, &HotKey->Link);
 
   //
   // Fill HotKey information.

Modified: branches/UDK2015/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
===================================================================
--- branches/UDK2015/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h     
2015-11-16 06:53:53 UTC (rev 18793)
+++ branches/UDK2015/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h     
2015-11-16 06:54:44 UTC (rev 18794)
@@ -1308,6 +1308,7 @@
   @retval EFI_INVALID_PARAMETER  KeyData is NULL.
   @retval EFI_NOT_FOUND          KeyData is not found to be unregistered.
   @retval EFI_UNSUPPORTED        Key represents a printable character. It is 
conflicted with Browser.
+  @retval EFI_ALREADY_STARTED    Key already been registered for one hot key.
 **/
 EFI_STATUS
 EFIAPI


------------------------------------------------------------------------------
Presto, an open source distributed SQL query engine for big data, initially
developed by Facebook, enables you to easily query your data on Hadoop in a 
more interactive manner. Teradata is also now providing full enterprise
support for Presto. Download a free open source copy now.
http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to