mirror of https://github.com/acidanthera/audk.git
MdeModulePkg:System hangs in setup menu
System hangs when RTC time rollover 1999 to 2000 Error processing of GetTime function: If get time fail,the date/time will display ??, and update help info to let user know get time fail. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17651 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
b269f89563
commit
cc63add853
|
@ -2545,6 +2545,8 @@ UiDisplayMenu (
|
|||
UINTN BottomRow;
|
||||
UINTN Index;
|
||||
CHAR16 *StringPtr;
|
||||
CHAR16 *StringRightPtr;
|
||||
CHAR16 *StringErrorPtr;
|
||||
CHAR16 *OptionString;
|
||||
CHAR16 *HelpString;
|
||||
CHAR16 *HelpHeaderString;
|
||||
|
@ -2579,6 +2581,7 @@ UiDisplayMenu (
|
|||
EFI_STRING_ID HelpInfo;
|
||||
UI_EVENT_TYPE EventType;
|
||||
BOOLEAN SkipHighLight;
|
||||
EFI_HII_VALUE *StatementValue;
|
||||
|
||||
EventType = UIEventNone;
|
||||
Status = EFI_SUCCESS;
|
||||
|
@ -2885,10 +2888,26 @@ UiDisplayMenu (
|
|||
//
|
||||
ASSERT(MenuOption != NULL);
|
||||
HelpInfo = ((EFI_IFR_STATEMENT_HEADER *) ((CHAR8 *)MenuOption->ThisTag->OpCode + sizeof (EFI_IFR_OP_HEADER)))->Help;
|
||||
Statement = MenuOption->ThisTag;
|
||||
StatementValue = &Statement->CurrentValue;
|
||||
if (HelpInfo == 0 || !IsSelectable (MenuOption)) {
|
||||
StringPtr = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
|
||||
if ((Statement->OpCode->OpCode == EFI_IFR_DATE_OP && StatementValue->Value.date.Month== 0xff)||(Statement->OpCode->OpCode == EFI_IFR_TIME_OP && StatementValue->Value.time.Hour == 0xff)){
|
||||
StringPtr = GetToken (STRING_TOKEN (GET_TIME_FAIL), gHiiHandle);
|
||||
} else {
|
||||
StringPtr = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
|
||||
}
|
||||
} else {
|
||||
StringPtr = GetToken (HelpInfo, gFormData->HiiHandle);
|
||||
if ((Statement->OpCode->OpCode == EFI_IFR_DATE_OP && StatementValue->Value.date.Month== 0xff)||(Statement->OpCode->OpCode == EFI_IFR_TIME_OP && StatementValue->Value.time.Hour == 0xff)){
|
||||
StringRightPtr = GetToken (HelpInfo, gFormData->HiiHandle);
|
||||
StringErrorPtr = GetToken (STRING_TOKEN (GET_TIME_FAIL), gHiiHandle);
|
||||
StringPtr = AllocateZeroPool ((StrLen (StringRightPtr) + StrLen (StringErrorPtr)+ 1 ) * sizeof (CHAR16));
|
||||
StrCpyS (StringPtr, StrLen (StringRightPtr) + StrLen (StringErrorPtr) + 1, StringRightPtr);
|
||||
StrCatS (StringPtr, StrLen (StringRightPtr) + StrLen (StringErrorPtr) + 1, StringErrorPtr);
|
||||
FreePool (StringRightPtr);
|
||||
FreePool (StringErrorPtr);
|
||||
} else {
|
||||
StringPtr = GetToken (HelpInfo, gFormData->HiiHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
|
@ -2,7 +2,7 @@
|
|||
Implementation for handling the User Interface option processing.
|
||||
|
||||
|
||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -1278,19 +1278,31 @@ ProcessOptions (
|
|||
switch (MenuOption->Sequence) {
|
||||
case 0:
|
||||
*OptionString[0] = LEFT_NUMERIC_DELIMITER;
|
||||
UnicodeSPrint (OptionString[0] + 1, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.date.Month);
|
||||
if (QuestionValue->Value.date.Month == 0xff){
|
||||
UnicodeSPrint (OptionString[0] + 1, 21 * sizeof (CHAR16), L"??");
|
||||
} else {
|
||||
UnicodeSPrint (OptionString[0] + 1, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.date.Month);
|
||||
}
|
||||
*(OptionString[0] + 3) = DATE_SEPARATOR;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
SetUnicodeMem (OptionString[0], 4, L' ');
|
||||
UnicodeSPrint (OptionString[0] + 4, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.date.Day);
|
||||
if (QuestionValue->Value.date.Day == 0xff){
|
||||
UnicodeSPrint (OptionString[0] + 4, 21 * sizeof (CHAR16), L"??");
|
||||
} else {
|
||||
UnicodeSPrint (OptionString[0] + 4, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.date.Day);
|
||||
}
|
||||
*(OptionString[0] + 6) = DATE_SEPARATOR;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
SetUnicodeMem (OptionString[0], 7, L' ');
|
||||
UnicodeSPrint (OptionString[0] + 7, 21 * sizeof (CHAR16), L"%04d", QuestionValue->Value.date.Year);
|
||||
if (QuestionValue->Value.date.Year == 0xff){
|
||||
UnicodeSPrint (OptionString[0] + 7, 21 * sizeof (CHAR16), L"????");
|
||||
} else {
|
||||
UnicodeSPrint (OptionString[0] + 7, 21 * sizeof (CHAR16), L"%04d", QuestionValue->Value.date.Year);
|
||||
}
|
||||
*(OptionString[0] + 11) = RIGHT_NUMERIC_DELIMITER;
|
||||
break;
|
||||
}
|
||||
|
@ -1310,19 +1322,31 @@ ProcessOptions (
|
|||
switch (MenuOption->Sequence) {
|
||||
case 0:
|
||||
*OptionString[0] = LEFT_NUMERIC_DELIMITER;
|
||||
UnicodeSPrint (OptionString[0] + 1, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.time.Hour);
|
||||
if (QuestionValue->Value.time.Hour == 0xff){
|
||||
UnicodeSPrint (OptionString[0] + 1, 21 * sizeof (CHAR16), L"??");
|
||||
} else {
|
||||
UnicodeSPrint (OptionString[0] + 1, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.time.Hour);
|
||||
}
|
||||
*(OptionString[0] + 3) = TIME_SEPARATOR;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
SetUnicodeMem (OptionString[0], 4, L' ');
|
||||
UnicodeSPrint (OptionString[0] + 4, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.time.Minute);
|
||||
if (QuestionValue->Value.time.Minute == 0xff){
|
||||
UnicodeSPrint (OptionString[0] + 4, 21 * sizeof (CHAR16), L"??");
|
||||
} else {
|
||||
UnicodeSPrint (OptionString[0] + 4, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.time.Minute);
|
||||
}
|
||||
*(OptionString[0] + 6) = TIME_SEPARATOR;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
SetUnicodeMem (OptionString[0], 7, L' ');
|
||||
UnicodeSPrint (OptionString[0] + 7, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.time.Second);
|
||||
if (QuestionValue->Value.time.Second == 0xff){
|
||||
UnicodeSPrint (OptionString[0] + 7, 21 * sizeof (CHAR16), L"??");
|
||||
} else {
|
||||
UnicodeSPrint (OptionString[0] + 7, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.time.Second);
|
||||
}
|
||||
*(OptionString[0] + 9) = RIGHT_NUMERIC_DELIMITER;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1595,7 +1595,16 @@ GetQuestionValue (
|
|||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
if (Question->Operand == EFI_IFR_DATE_OP){
|
||||
QuestionValue->date.Year = 0xff;
|
||||
QuestionValue->date.Month = 0xff;
|
||||
QuestionValue->date.Day = 0xff;
|
||||
} else {
|
||||
QuestionValue->time.Hour = 0xff;
|
||||
QuestionValue->time.Minute = 0xff;
|
||||
QuestionValue->time.Second = 0xff;
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (Question->Operand == EFI_IFR_DATE_OP) {
|
||||
|
|
Loading…
Reference in New Issue