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
This commit is contained in:
Eric Dong 2015-10-15 00:57:20 +00:00 committed by ydong10
parent 377680ae64
commit 291422d78b
2 changed files with 14 additions and 13 deletions

View File

@ -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,21 +5936,20 @@ RegisterHotKey (
return EFI_NOT_FOUND;
}
}
//
// Register HotKey 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);
if (HotKey != NULL) {
return EFI_ALREADY_STARTED;
}
//
// 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);
//
// Fill HotKey information.
//

View File

@ -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