Revision: 16159
http://sourceforge.net/p/edk2/code/16159
Author: shenshushi
Date: 2014-09-23 01:14:30 +0000 (Tue, 23 Sep 2014)
Log Message:
-----------
ShellPkg: Fix setting hot key for boot option fail.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
Modified Paths:
--------------
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.uni
Modified:
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
===================================================================
---
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
2014-09-22 21:11:22 UTC (rev 16158)
+++
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
2014-09-23 01:14:30 UTC (rev 16159)
@@ -768,8 +768,9 @@
CHAR16 *FileName;
CHAR16 *Temp2;
CHAR16 *Data;
- UINT16 KeyIndex;
+ UINT32 KeyIndex;
CHAR16 VariableName[12];
+ UINT8 *VariableData;
SHELL_FILE_HANDLE FileHandle;
@@ -779,8 +780,10 @@
FileName = NULL;
Data = NULL;
KeyOptionBuffer = NULL;
+ VariableData = NULL;
ZeroMem(&NewKeyOption, sizeof(EFI_KEY_OPTION));
+ ZeroMem(VariableName, sizeof(VariableName));
while(Walker[0] == L' ') {
Walker++;
@@ -941,28 +944,31 @@
}
if (ShellStatus == SHELL_SUCCESS) {
- for (Temp2 = NULL, KeyIndex = 0 ; KeyIndex < 0xFFFF ; KeyIndex++) {
+ for (Temp2 = NULL, KeyIndex = 0 ; KeyIndex <= 0xFFFF ; KeyIndex++) {
UnicodeSPrint(VariableName, sizeof(VariableName), L"Key%04x",
KeyIndex);
- Status = gRT->GetVariable(
- VariableName,
- (EFI_GUID*)&gEfiGlobalVariableGuid,
- NULL,
- (UINTN*)&Intermediate,
- NULL);
+ Status = GetEfiGlobalVariable2 (VariableName, &VariableData, NULL);
if (Status == EFI_NOT_FOUND) {
break;
}
+ if (!EFI_ERROR(Status)) {
+ SHELL_FREE_NON_NULL(VariableData);
+ }
}
- Status = gRT->SetVariable(
- VariableName,
- (EFI_GUID*)&gEfiGlobalVariableGuid,
-
EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof(EFI_KEY_OPTION) + (sizeof(EFI_INPUT_KEY) *
NewKeyOption.KeyData.Options.InputKeyCount),
- KeyOptionBuffer);
- if (EFI_ERROR(Status)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL),
gShellBcfgHiiHandle, VariableName, Status);
+ if (KeyIndex <= 0xFFFF) {
+ Status = gRT->SetVariable(
+ VariableName,
+ (EFI_GUID*)&gEfiGlobalVariableGuid,
+
EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
+ sizeof(EFI_KEY_OPTION) + (sizeof(EFI_INPUT_KEY) *
NewKeyOption.KeyData.Options.InputKeyCount),
+ KeyOptionBuffer);
+ if (EFI_ERROR(Status)) {
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN
(STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, VariableName, Status);
+ ShellStatus = SHELL_INVALID_PARAMETER;
+ }
+ } else {
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_VAR_NO_NUM),
gShellBcfgHiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
- }
+ }
ASSERT(FileName == NULL && Data == NULL);
}
}
Modified:
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.uni
===================================================================
---
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.uni
2014-09-22 21:11:22 UTC (rev 16158)
+++
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.uni
2014-09-23 01:14:30 UTC (rev 16159)
@@ -4,7 +4,7 @@
- @@ -90,6 +90,8 @@
+
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits