summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal
diff options
context:
space:
mode:
authorEric Dong <eric.dong@intel.com>2015-10-15 00:57:20 +0000
committerydong10 <ydong10@Edk2>2015-10-15 00:57:20 +0000
commit291422d78bd810b33e7a49733a84d8ea6f6588f4 (patch)
tree005c273dd71e0de9897bc9b0bfaa7b39908260f7 /MdeModulePkg/Universal
parent377680ae64bd6f702bfac7c98e65f73019b7d285 (diff)
downloadedk2-291422d78bd810b33e7a49733a84d8ea6f6588f4.tar.gz
edk2-291422d78bd810b33e7a49733a84d8ea6f6588f4.tar.bz2
edk2-291422d78bd810b33e7a49733a84d8ea6f6588f4.zip
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. 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
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.c24
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.h1
2 files changed, 13 insertions, 12 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index 579396293e..43cfc87eeb 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -5890,6 +5890,7 @@ SetScope (
@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 @@ RegisterHotKey (
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.
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
index 1238197535..61e706a0b4 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
@@ -1308,6 +1308,7 @@ SetScope (
@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