2 Implementation for handling user input from the User Interfaces.
4 Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "FormDisplay.h"
18 Get maximum and minimum info from this opcode.
20 @param OpCode Pointer to the current input opcode.
21 @param Minimum The minimum size info for this opcode.
22 @param Maximum The maximum size info for this opcode.
27 IN EFI_IFR_OP_HEADER
*OpCode
,
32 EFI_IFR_STRING
*StringOp
;
33 EFI_IFR_PASSWORD
*PasswordOp
;
34 if (OpCode
->OpCode
== EFI_IFR_STRING_OP
) {
35 StringOp
= (EFI_IFR_STRING
*) OpCode
;
36 *Minimum
= StringOp
->MinSize
;
37 *Maximum
= StringOp
->MaxSize
;
38 } else if (OpCode
->OpCode
== EFI_IFR_PASSWORD_OP
) {
39 PasswordOp
= (EFI_IFR_PASSWORD
*) OpCode
;
40 *Minimum
= PasswordOp
->MinSize
;
41 *Maximum
= PasswordOp
->MaxSize
;
49 Get string or password input from user.
51 @param MenuOption Pointer to the current input menu.
52 @param Prompt The prompt string shown on popup window.
53 @param StringPtr Old user input and destination for use input string.
55 @retval EFI_SUCCESS If string input is read successfully
56 @retval EFI_DEVICE_ERROR If operation fails
61 IN UI_MENU_OPTION
*MenuOption
,
63 IN OUT CHAR16
*StringPtr
73 CHAR16
*BufferedString
;
79 UINTN DimensionsWidth
;
80 UINTN DimensionsHeight
;
82 BOOLEAN CursorVisible
;
85 FORM_DISPLAY_ENGINE_STATEMENT
*Question
;
88 DimensionsWidth
= gStatementDimensions
.RightColumn
- gStatementDimensions
.LeftColumn
;
89 DimensionsHeight
= gStatementDimensions
.BottomRow
- gStatementDimensions
.TopRow
;
91 NullCharacter
= CHAR_NULL
;
92 ScreenSize
= GetStringWidth (Prompt
) / sizeof (CHAR16
);
96 Question
= MenuOption
->ThisTag
;
97 GetFieldFromOp(Question
->OpCode
, &Minimum
, &Maximum
);
99 if (Question
->OpCode
->OpCode
== EFI_IFR_PASSWORD_OP
) {
105 TempString
= AllocateZeroPool ((Maximum
+ 1)* sizeof (CHAR16
));
108 if (ScreenSize
< (Maximum
+ 1)) {
109 ScreenSize
= Maximum
+ 1;
112 if ((ScreenSize
+ 2) > DimensionsWidth
) {
113 ScreenSize
= DimensionsWidth
- 2;
116 BufferedString
= AllocateZeroPool (ScreenSize
* 2);
117 ASSERT (BufferedString
);
119 Start
= (DimensionsWidth
- ScreenSize
- 2) / 2 + gStatementDimensions
.LeftColumn
+ 1;
120 Top
= ((DimensionsHeight
- 6) / 2) + gStatementDimensions
.TopRow
- 1;
123 // Display prompt for string
125 // CreateDialog (NULL, "", Prompt, Space, "", NULL);
126 CreateMultiStringPopUp (ScreenSize
, 4, &NullCharacter
, Prompt
, Space
, &NullCharacter
);
127 gST
->ConOut
->SetAttribute (gST
->ConOut
, EFI_TEXT_ATTR (EFI_BLACK
, EFI_LIGHTGRAY
));
129 CursorVisible
= gST
->ConOut
->Mode
->CursorVisible
;
130 gST
->ConOut
->EnableCursor (gST
->ConOut
, TRUE
);
132 CurrentCursor
= GetStringWidth (StringPtr
) / 2 - 1;
133 if (CurrentCursor
!= 0) {
135 // Show the string which has beed saved before.
137 SetUnicodeMem (BufferedString
, ScreenSize
- 1, L
' ');
138 PrintStringAt (Start
+ 1, Top
+ 3, BufferedString
);
140 if ((GetStringWidth (StringPtr
) / 2) > (DimensionsWidth
- 2)) {
141 Index
= (GetStringWidth (StringPtr
) / 2) - DimensionsWidth
+ 2;
147 gST
->ConOut
->SetCursorPosition (gST
->ConOut
, Start
+ 1, Top
+ 3);
150 for (Count
= 0; Index
+ 1 < GetStringWidth (StringPtr
) / 2; Index
++, Count
++) {
151 BufferedString
[Count
] = StringPtr
[Index
];
154 PrintCharAt ((UINTN
)-1, (UINTN
)-1, L
'*');
159 PrintStringAt (Start
+ 1, Top
+ 3, BufferedString
);
162 gST
->ConOut
->SetAttribute (gST
->ConOut
, EFI_TEXT_ATTR (EFI_LIGHTGRAY
, EFI_BLACK
));
163 gST
->ConOut
->SetCursorPosition (gST
->ConOut
, Start
+ GetStringWidth (StringPtr
) / 2, Top
+ 3);
167 Status
= WaitForKeyStroke (&Key
);
168 ASSERT_EFI_ERROR (Status
);
170 gST
->ConOut
->SetAttribute (gST
->ConOut
, EFI_TEXT_ATTR (EFI_BLACK
, EFI_LIGHTGRAY
));
171 switch (Key
.UnicodeChar
) {
173 switch (Key
.ScanCode
) {
175 if (CurrentCursor
> 0) {
181 if (CurrentCursor
< (GetStringWidth (StringPtr
) / 2 - 1)) {
187 FreePool (TempString
);
188 FreePool (BufferedString
);
189 gST
->ConOut
->SetAttribute (gST
->ConOut
, EFI_TEXT_ATTR (EFI_LIGHTGRAY
, EFI_BLACK
));
190 gST
->ConOut
->EnableCursor (gST
->ConOut
, CursorVisible
);
191 return EFI_DEVICE_ERROR
;
199 case CHAR_CARRIAGE_RETURN
:
200 if (GetStringWidth (StringPtr
) >= ((Minimum
+ 1) * sizeof (CHAR16
))) {
202 FreePool (TempString
);
203 FreePool (BufferedString
);
204 gST
->ConOut
->SetAttribute (gST
->ConOut
, EFI_TEXT_ATTR (EFI_LIGHTGRAY
, EFI_BLACK
));
205 gST
->ConOut
->EnableCursor (gST
->ConOut
, CursorVisible
);
209 // Simply create a popup to tell the user that they had typed in too few characters.
210 // To save code space, we can then treat this as an error and return back to the menu.
213 CreateDialog (&Key
, &NullCharacter
, gMiniString
, gPressEnter
, &NullCharacter
, NULL
);
214 } while (Key
.UnicodeChar
!= CHAR_CARRIAGE_RETURN
);
216 FreePool (TempString
);
217 FreePool (BufferedString
);
218 gST
->ConOut
->SetAttribute (gST
->ConOut
, EFI_TEXT_ATTR (EFI_LIGHTGRAY
, EFI_BLACK
));
219 gST
->ConOut
->EnableCursor (gST
->ConOut
, CursorVisible
);
220 return EFI_DEVICE_ERROR
;
226 if (StringPtr
[0] != CHAR_NULL
&& CurrentCursor
!= 0) {
227 for (Index
= 0; Index
< CurrentCursor
- 1; Index
++) {
228 TempString
[Index
] = StringPtr
[Index
];
230 Count
= GetStringWidth (StringPtr
) / 2 - 1;
231 if (Count
>= CurrentCursor
) {
232 for (Index
= CurrentCursor
- 1, Index2
= CurrentCursor
; Index2
< Count
; Index
++, Index2
++) {
233 TempString
[Index
] = StringPtr
[Index2
];
235 TempString
[Index
] = CHAR_NULL
;
238 // Effectively truncate string by 1 character
240 StrCpy (StringPtr
, TempString
);
246 // If it is the beginning of the string, don't worry about checking maximum limits
248 if ((StringPtr
[0] == CHAR_NULL
) && (Key
.UnicodeChar
!= CHAR_BACKSPACE
)) {
249 StrnCpy (StringPtr
, &Key
.UnicodeChar
, 1);
251 } else if ((GetStringWidth (StringPtr
) < ((Maximum
+ 1) * sizeof (CHAR16
))) && (Key
.UnicodeChar
!= CHAR_BACKSPACE
)) {
252 KeyPad
[0] = Key
.UnicodeChar
;
253 KeyPad
[1] = CHAR_NULL
;
254 Count
= GetStringWidth (StringPtr
) / 2 - 1;
255 if (CurrentCursor
< Count
) {
256 for (Index
= 0; Index
< CurrentCursor
; Index
++) {
257 TempString
[Index
] = StringPtr
[Index
];
259 TempString
[Index
] = CHAR_NULL
;
260 StrCat (TempString
, KeyPad
);
261 StrCat (TempString
, StringPtr
+ CurrentCursor
);
262 StrCpy (StringPtr
, TempString
);
264 StrCat (StringPtr
, KeyPad
);
270 // If the width of the input string is now larger than the screen, we nee to
271 // adjust the index to start printing portions of the string
273 SetUnicodeMem (BufferedString
, ScreenSize
- 1, L
' ');
274 PrintStringAt (Start
+ 1, Top
+ 3, BufferedString
);
276 if ((GetStringWidth (StringPtr
) / 2) > (DimensionsWidth
- 2)) {
277 Index
= (GetStringWidth (StringPtr
) / 2) - DimensionsWidth
+ 2;
283 gST
->ConOut
->SetCursorPosition (gST
->ConOut
, Start
+ 1, Top
+ 3);
286 for (Count
= 0; Index
+ 1 < GetStringWidth (StringPtr
) / 2; Index
++, Count
++) {
287 BufferedString
[Count
] = StringPtr
[Index
];
290 PrintCharAt ((UINTN
)-1, (UINTN
)-1, L
'*');
295 PrintStringAt (Start
+ 1, Top
+ 3, BufferedString
);
300 gST
->ConOut
->SetAttribute (gST
->ConOut
, EFI_TEXT_ATTR (EFI_LIGHTGRAY
, EFI_BLACK
));
301 gST
->ConOut
->SetCursorPosition (gST
->ConOut
, Start
+ CurrentCursor
+ 1, Top
+ 3);
307 Adjust the value to the correct one. Rules follow the sample:
308 like: Year change: 2012.02.29 -> 2013.02.29 -> 2013.02.01
309 Month change: 2013.03.29 -> 2013.02.29 -> 2013.02.28
311 @param QuestionValue Pointer to current question.
312 @param Sequence The sequence of the field in the question.
315 AdjustQuestionValue (
316 IN EFI_HII_VALUE
*QuestionValue
,
325 Month
= QuestionValue
->Value
.date
.Month
;
326 Year
= QuestionValue
->Value
.date
.Year
;
331 if ((Year
% 4) == 0 && ((Year
% 100) != 0 || (Year
% 400) == 0)) {
349 // Change the month area.
352 if (QuestionValue
->Value
.date
.Day
> Maximum
) {
353 QuestionValue
->Value
.date
.Day
= Maximum
;
358 // Change the Year area.
361 if (QuestionValue
->Value
.date
.Day
> Maximum
) {
362 QuestionValue
->Value
.date
.Day
= Minimum
;
368 Get field info from numeric opcode.
370 @param OpCode Pointer to the current input opcode.
371 @param IntInput Whether question shows with EFI_IFR_DISPLAY_INT_DEC type.
372 @param QuestionValue Input question value, with EFI_HII_VALUE type.
373 @param Value Return question value, always return UINT64 type.
374 @param Minimum The minimum size info for this opcode.
375 @param Maximum The maximum size info for this opcode.
376 @param Step The step size info for this opcode.
377 @param StorageWidth The storage width info for this opcode.
382 IN EFI_IFR_OP_HEADER
*OpCode
,
384 IN EFI_HII_VALUE
*QuestionValue
,
389 OUT UINT16
*StorageWidth
392 EFI_IFR_NUMERIC
*NumericOp
;
394 NumericOp
= (EFI_IFR_NUMERIC
*) OpCode
;
396 switch (NumericOp
->Flags
& EFI_IFR_NUMERIC_SIZE
) {
397 case EFI_IFR_NUMERIC_SIZE_1
:
399 *Minimum
= (INT64
) (INT8
) NumericOp
->data
.u8
.MinValue
;
400 *Maximum
= (INT64
) (INT8
) NumericOp
->data
.u8
.MaxValue
;
401 *Value
= (INT64
) (INT8
) QuestionValue
->Value
.u8
;
403 *Minimum
= NumericOp
->data
.u8
.MinValue
;
404 *Maximum
= NumericOp
->data
.u8
.MaxValue
;
405 *Value
= QuestionValue
->Value
.u8
;
407 *Step
= NumericOp
->data
.u8
.Step
;
408 *StorageWidth
= (UINT16
) sizeof (UINT8
);
411 case EFI_IFR_NUMERIC_SIZE_2
:
413 *Minimum
= (INT64
) (INT16
) NumericOp
->data
.u16
.MinValue
;
414 *Maximum
= (INT64
) (INT16
) NumericOp
->data
.u16
.MaxValue
;
415 *Value
= (INT64
) (INT16
) QuestionValue
->Value
.u16
;
417 *Minimum
= NumericOp
->data
.u16
.MinValue
;
418 *Maximum
= NumericOp
->data
.u16
.MaxValue
;
419 *Value
= QuestionValue
->Value
.u16
;
421 *Step
= NumericOp
->data
.u16
.Step
;
422 *StorageWidth
= (UINT16
) sizeof (UINT16
);
425 case EFI_IFR_NUMERIC_SIZE_4
:
427 *Minimum
= (INT64
) (INT32
) NumericOp
->data
.u32
.MinValue
;
428 *Maximum
= (INT64
) (INT32
) NumericOp
->data
.u32
.MaxValue
;
429 *Value
= (INT64
) (INT32
) QuestionValue
->Value
.u32
;
431 *Minimum
= NumericOp
->data
.u32
.MinValue
;
432 *Maximum
= NumericOp
->data
.u32
.MaxValue
;
433 *Value
= QuestionValue
->Value
.u32
;
435 *Step
= NumericOp
->data
.u32
.Step
;
436 *StorageWidth
= (UINT16
) sizeof (UINT32
);
439 case EFI_IFR_NUMERIC_SIZE_8
:
441 *Minimum
= (INT64
) NumericOp
->data
.u64
.MinValue
;
442 *Maximum
= (INT64
) NumericOp
->data
.u64
.MaxValue
;
443 *Value
= (INT64
) QuestionValue
->Value
.u64
;
445 *Minimum
= NumericOp
->data
.u64
.MinValue
;
446 *Maximum
= NumericOp
->data
.u64
.MaxValue
;
447 *Value
= QuestionValue
->Value
.u64
;
449 *Step
= NumericOp
->data
.u64
.Step
;
450 *StorageWidth
= (UINT16
) sizeof (UINT64
);
458 *Maximum
= (UINT64
) -1;
463 This routine reads a numeric value from the user input.
465 @param MenuOption Pointer to the current input menu.
467 @retval EFI_SUCCESS If numerical input is read successfully
468 @retval EFI_DEVICE_ERROR If operation fails
473 IN UI_MENU_OPTION
*MenuOption
478 CHAR16 InputText
[MAX_NUMERIC_INPUT_WIDTH
];
479 CHAR16 FormattedNumber
[MAX_NUMERIC_INPUT_WIDTH
- 1];
480 UINT64 PreviousNumber
[MAX_NUMERIC_INPUT_WIDTH
- 3];
487 BOOLEAN ValidateFail
;
497 EFI_HII_VALUE
*QuestionValue
;
498 FORM_DISPLAY_ENGINE_STATEMENT
*Question
;
499 EFI_IFR_NUMERIC
*NumericOp
;
502 Column
= MenuOption
->OptCol
;
503 Row
= MenuOption
->Row
;
504 PreviousNumber
[0] = 0;
515 ValidateFail
= FALSE
;
517 Question
= MenuOption
->ThisTag
;
518 QuestionValue
= &Question
->CurrentValue
;
521 // Only two case, user can enter to this function: Enter and +/- case.
522 // In Enter case, gDirection = 0; in +/- case, gDirection = SCAN_LEFT/SCAN_WRIGHT
524 ManualInput
= (BOOLEAN
)(gDirection
== 0 ? TRUE
: FALSE
);
526 if ((Question
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) || (Question
->OpCode
->OpCode
== EFI_IFR_TIME_OP
)) {
533 // Prepare Value to be edit
537 if (Question
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) {
541 switch (MenuOption
->Sequence
) {
545 EditValue
= QuestionValue
->Value
.date
.Month
;
549 switch (QuestionValue
->Value
.date
.Month
) {
551 if ((QuestionValue
->Value
.date
.Year
% 4) == 0 &&
552 ((QuestionValue
->Value
.date
.Year
% 100) != 0 ||
553 (QuestionValue
->Value
.date
.Year
% 400) == 0)) {
571 EditValue
= QuestionValue
->Value
.date
.Day
;
577 EditValue
= QuestionValue
->Value
.date
.Year
;
583 } else if (Question
->OpCode
->OpCode
== EFI_IFR_TIME_OP
) {
587 switch (MenuOption
->Sequence
) {
591 EditValue
= QuestionValue
->Value
.time
.Hour
;
597 EditValue
= QuestionValue
->Value
.time
.Minute
;
603 EditValue
= QuestionValue
->Value
.time
.Second
;
610 ASSERT (Question
->OpCode
->OpCode
== EFI_IFR_NUMERIC_OP
);
611 NumericOp
= (EFI_IFR_NUMERIC
*) Question
->OpCode
;
612 GetValueFromNum(Question
->OpCode
, (NumericOp
->Flags
& EFI_IFR_DISPLAY
) == 0, QuestionValue
, &EditValue
, &Minimum
, &Maximum
, &Step
, &StorageWidth
);
613 EraseLen
= gOptionBlockWidth
;
616 if ((Question
->OpCode
->OpCode
== EFI_IFR_NUMERIC_OP
) && (NumericOp
!= NULL
)) {
617 if ((NumericOp
->Flags
& EFI_IFR_DISPLAY
) == EFI_IFR_DISPLAY_UINT_HEX
){
619 } else if ((NumericOp
->Flags
& EFI_IFR_DISPLAY
) == 0){
621 // Display with EFI_IFR_DISPLAY_INT_DEC type. Support negative number.
628 // Enter from "Enter" input, clear the old word showing.
631 if (Question
->OpCode
->OpCode
== EFI_IFR_NUMERIC_OP
) {
633 InputWidth
= StorageWidth
* 2;
635 switch (StorageWidth
) {
659 // Support an extra '-' for negative number.
665 InputText
[0] = LEFT_NUMERIC_DELIMITER
;
666 SetUnicodeMem (InputText
+ 1, InputWidth
, L
' ');
667 ASSERT (InputWidth
+ 2 < MAX_NUMERIC_INPUT_WIDTH
);
668 InputText
[InputWidth
+ 1] = RIGHT_NUMERIC_DELIMITER
;
669 InputText
[InputWidth
+ 2] = L
'\0';
671 PrintStringAt (Column
, Row
, InputText
);
675 if (Question
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) {
676 if (MenuOption
->Sequence
== 2) {
682 if (MenuOption
->Sequence
== 0) {
683 InputText
[0] = LEFT_NUMERIC_DELIMITER
;
684 SetUnicodeMem (InputText
+ 1, InputWidth
, L
' ');
686 SetUnicodeMem (InputText
, InputWidth
, L
' ');
689 if (MenuOption
->Sequence
== 2) {
690 InputText
[InputWidth
+ 1] = RIGHT_NUMERIC_DELIMITER
;
692 InputText
[InputWidth
+ 1] = DATE_SEPARATOR
;
694 InputText
[InputWidth
+ 2] = L
'\0';
696 PrintStringAt (Column
, Row
, InputText
);
697 if (MenuOption
->Sequence
== 0) {
702 if (Question
->OpCode
->OpCode
== EFI_IFR_TIME_OP
) {
705 if (MenuOption
->Sequence
== 0) {
706 InputText
[0] = LEFT_NUMERIC_DELIMITER
;
707 SetUnicodeMem (InputText
+ 1, InputWidth
, L
' ');
709 SetUnicodeMem (InputText
, InputWidth
, L
' ');
712 if (MenuOption
->Sequence
== 2) {
713 InputText
[InputWidth
+ 1] = RIGHT_NUMERIC_DELIMITER
;
715 InputText
[InputWidth
+ 1] = TIME_SEPARATOR
;
717 InputText
[InputWidth
+ 2] = L
'\0';
719 PrintStringAt (Column
, Row
, InputText
);
720 if (MenuOption
->Sequence
== 0) {
727 // First time we enter this handler, we need to check to see if
728 // we were passed an increment or decrement directive
731 Key
.UnicodeChar
= CHAR_NULL
;
732 if (gDirection
!= 0) {
733 Key
.ScanCode
= gDirection
;
738 WaitForKeyStroke (&Key
);
741 switch (Key
.UnicodeChar
) {
745 if (ManualInput
&& IntInput
) {
747 // In Manual input mode, check whether input the negative flag.
749 if (Key
.UnicodeChar
== '-') {
754 PrintCharAt (Column
++, Row
, Key
.UnicodeChar
);
757 if (Key
.UnicodeChar
== '+') {
758 Key
.ScanCode
= SCAN_RIGHT
;
760 Key
.ScanCode
= SCAN_LEFT
;
762 Key
.UnicodeChar
= CHAR_NULL
;
768 switch (Key
.ScanCode
) {
771 if (DateOrTime
&& !ManualInput
) {
773 // By setting this value, we will return back to the caller.
774 // We need to do this since an auto-refresh will destroy the adjustment
775 // based on what the real-time-clock is showing. So we always commit
776 // upon changing the value.
778 gDirection
= SCAN_DOWN
;
781 if ((Step
!= 0) && !ManualInput
) {
782 if (Key
.ScanCode
== SCAN_LEFT
) {
784 if ((INT64
) EditValue
>= (INT64
) Minimum
+ (INT64
) Step
) {
785 EditValue
= EditValue
- Step
;
786 } else if ((INT64
) EditValue
> (INT64
) Minimum
){
792 if (EditValue
>= Minimum
+ Step
) {
793 EditValue
= EditValue
- Step
;
794 } else if (EditValue
> Minimum
){
800 } else if (Key
.ScanCode
== SCAN_RIGHT
) {
802 if ((INT64
) EditValue
+ (INT64
) Step
<= (INT64
) Maximum
) {
803 EditValue
= EditValue
+ Step
;
804 } else if ((INT64
) EditValue
< (INT64
) Maximum
) {
810 if (EditValue
+ Step
<= Maximum
) {
811 EditValue
= EditValue
+ Step
;
812 } else if (EditValue
< Maximum
) {
820 ZeroMem (FormattedNumber
, 21 * sizeof (CHAR16
));
821 if (Question
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) {
822 if (MenuOption
->Sequence
== 2) {
826 UnicodeSPrint (FormattedNumber
, 21 * sizeof (CHAR16
), L
"%04d", (UINT16
) EditValue
);
831 UnicodeSPrint (FormattedNumber
, 21 * sizeof (CHAR16
), L
"%02d", (UINT8
) EditValue
);
834 if (MenuOption
->Sequence
== 0) {
835 ASSERT (EraseLen
>= 2);
836 FormattedNumber
[EraseLen
- 2] = DATE_SEPARATOR
;
837 } else if (MenuOption
->Sequence
== 1) {
838 ASSERT (EraseLen
>= 1);
839 FormattedNumber
[EraseLen
- 1] = DATE_SEPARATOR
;
841 } else if (Question
->OpCode
->OpCode
== EFI_IFR_TIME_OP
) {
842 UnicodeSPrint (FormattedNumber
, 21 * sizeof (CHAR16
), L
"%02d", (UINT8
) EditValue
);
844 if (MenuOption
->Sequence
== 0) {
845 ASSERT (EraseLen
>= 2);
846 FormattedNumber
[EraseLen
- 2] = TIME_SEPARATOR
;
847 } else if (MenuOption
->Sequence
== 1) {
848 ASSERT (EraseLen
>= 1);
849 FormattedNumber
[EraseLen
- 1] = TIME_SEPARATOR
;
852 QuestionValue
->Value
.u64
= EditValue
;
853 PrintFormattedNumber (Question
, FormattedNumber
, 21 * sizeof (CHAR16
));
856 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetFieldTextColor ());
857 for (Loop
= 0; Loop
< EraseLen
; Loop
++) {
858 PrintStringAt (MenuOption
->OptCol
+ Loop
, MenuOption
->Row
, L
" ");
860 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetHighlightTextColor ());
862 if (MenuOption
->Sequence
== 0) {
863 PrintCharAt (MenuOption
->OptCol
, Row
, LEFT_NUMERIC_DELIMITER
);
864 Column
= MenuOption
->OptCol
+ 1;
867 PrintStringAt (Column
, Row
, FormattedNumber
);
869 if (!DateOrTime
|| MenuOption
->Sequence
== 2) {
870 PrintCharAt ((UINTN
)-1, (UINTN
)-1, RIGHT_NUMERIC_DELIMITER
);
874 goto EnterCarriageReturn
;
879 goto EnterCarriageReturn
;
882 return EFI_DEVICE_ERROR
;
892 case CHAR_CARRIAGE_RETURN
:
894 // Validate input value with Minimum value.
896 ValidateFail
= FALSE
;
899 // After user input Enter, need to check whether the input value.
900 // If input a negative value, should compare with maximum value.
901 // else compare with the minimum value.
904 ValidateFail
= (INT64
) EditValue
> (INT64
) Maximum
? TRUE
: FALSE
;
906 ValidateFail
= (INT64
) EditValue
< (INT64
) Minimum
? TRUE
: FALSE
;
910 UpdateStatusBar (INPUT_ERROR
, TRUE
);
913 } else if (EditValue
< Minimum
) {
914 UpdateStatusBar (INPUT_ERROR
, TRUE
);
918 UpdateStatusBar (INPUT_ERROR
, FALSE
);
919 CopyMem (&gUserInput
->InputValue
, &Question
->CurrentValue
, sizeof (EFI_HII_VALUE
));
920 QuestionValue
= &gUserInput
->InputValue
;
922 // Store Edit value back to Question
924 if (Question
->OpCode
->OpCode
== EFI_IFR_DATE_OP
) {
925 switch (MenuOption
->Sequence
) {
927 QuestionValue
->Value
.date
.Month
= (UINT8
) EditValue
;
931 QuestionValue
->Value
.date
.Day
= (UINT8
) EditValue
;
935 QuestionValue
->Value
.date
.Year
= (UINT16
) EditValue
;
941 } else if (Question
->OpCode
->OpCode
== EFI_IFR_TIME_OP
) {
942 switch (MenuOption
->Sequence
) {
944 QuestionValue
->Value
.time
.Hour
= (UINT8
) EditValue
;
948 QuestionValue
->Value
.time
.Minute
= (UINT8
) EditValue
;
952 QuestionValue
->Value
.time
.Second
= (UINT8
) EditValue
;
962 QuestionValue
->Value
.u64
= EditValue
;
966 // Adjust the value to the correct one.
967 // Sample like: 2012.02.29 -> 2013.02.29 -> 2013.02.01
968 // 2013.03.29 -> 2013.02.29 -> 2013.02.28
970 if (Question
->OpCode
->OpCode
== EFI_IFR_DATE_OP
&&
971 (MenuOption
->Sequence
== 0 || MenuOption
->Sequence
== 2)) {
972 AdjustQuestionValue (QuestionValue
, (UINT8
)MenuOption
->Sequence
);
984 PrintStringAt (Column
, Row
, L
" ");
989 // Remove a character
991 EditValue
= PreviousNumber
[Count
- 1];
992 UpdateStatusBar (INPUT_ERROR
, FALSE
);
995 PrintStringAt (Column
, Row
, L
" ");
1002 if ((Key
.UnicodeChar
>= L
'0') && (Key
.UnicodeChar
<= L
'9')) {
1003 Digital
= (UINT8
) (Key
.UnicodeChar
- L
'0');
1004 } else if ((Key
.UnicodeChar
>= L
'A') && (Key
.UnicodeChar
<= L
'F')) {
1005 Digital
= (UINT8
) (Key
.UnicodeChar
- L
'A' + 0x0A);
1006 } else if ((Key
.UnicodeChar
>= L
'a') && (Key
.UnicodeChar
<= L
'f')) {
1007 Digital
= (UINT8
) (Key
.UnicodeChar
- L
'a' + 0x0A);
1009 UpdateStatusBar (INPUT_ERROR
, TRUE
);
1013 if (Key
.UnicodeChar
> L
'9' || Key
.UnicodeChar
< L
'0') {
1014 UpdateStatusBar (INPUT_ERROR
, TRUE
);
1020 // If Count exceed input width, there is no way more is valid
1022 if (Count
>= InputWidth
) {
1026 // Someone typed something valid!
1030 EditValue
= LShiftU64 (EditValue
, 4) + Digital
;
1031 } else if (IntInput
&& Negative
) {
1033 // Save the negative number.
1035 EditValue
= ~(MultU64x32 (~(EditValue
- 1), 10) + (Key
.UnicodeChar
- L
'0')) + 1;
1037 EditValue
= MultU64x32 (EditValue
, 10) + (Key
.UnicodeChar
- L
'0');
1041 EditValue
= Digital
;
1042 } else if (IntInput
&& Negative
) {
1044 // Save the negative number.
1046 EditValue
= ~(Key
.UnicodeChar
- L
'0') + 1;
1048 EditValue
= Key
.UnicodeChar
- L
'0';
1053 ValidateFail
= FALSE
;
1055 // When user input a new value, should check the current value.
1056 // If user input a negative value, should compare it with minimum
1057 // value, else compare it with maximum value.
1060 ValidateFail
= (INT64
) EditValue
< (INT64
) Minimum
? TRUE
: FALSE
;
1062 ValidateFail
= (INT64
) EditValue
> (INT64
) Maximum
? TRUE
: FALSE
;
1066 UpdateStatusBar (INPUT_ERROR
, TRUE
);
1067 ASSERT (Count
< sizeof (PreviousNumber
) / sizeof (PreviousNumber
[0]));
1068 EditValue
= PreviousNumber
[Count
];
1072 if (EditValue
> Maximum
) {
1073 UpdateStatusBar (INPUT_ERROR
, TRUE
);
1074 ASSERT (Count
< sizeof (PreviousNumber
) / sizeof (PreviousNumber
[0]));
1075 EditValue
= PreviousNumber
[Count
];
1080 UpdateStatusBar (INPUT_ERROR
, FALSE
);
1083 ASSERT (Count
< (sizeof (PreviousNumber
) / sizeof (PreviousNumber
[0])));
1084 PreviousNumber
[Count
] = EditValue
;
1086 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetHighlightTextColor ());
1087 PrintCharAt (Column
, Row
, Key
.UnicodeChar
);
1096 Adjust option order base on the question value.
1098 @param Question Pointer to current question.
1099 @param PopUpMenuLines The line number of the pop up menu.
1101 @retval EFI_SUCCESS If Option input is processed successfully
1102 @retval EFI_DEVICE_ERROR If operation fails
1107 IN FORM_DISPLAY_ENGINE_STATEMENT
*Question
,
1108 OUT UINTN
*PopUpMenuLines
1112 EFI_IFR_ORDERED_LIST
*OrderList
;
1116 DISPLAY_QUESTION_OPTION
*OneOfOption
;
1117 EFI_HII_VALUE
*HiiValueArray
;
1119 Link
= GetFirstNode (&Question
->OptionListHead
);
1120 OneOfOption
= DISPLAY_QUESTION_OPTION_FROM_LINK (Link
);
1121 ValueArray
= Question
->CurrentValue
.Buffer
;
1122 ValueType
= OneOfOption
->OptionOpCode
->Type
;
1123 OrderList
= (EFI_IFR_ORDERED_LIST
*) Question
->OpCode
;
1125 for (Index
= 0; Index
< OrderList
->MaxContainers
; Index
++) {
1126 if (GetArrayData (ValueArray
, ValueType
, Index
) == 0) {
1131 *PopUpMenuLines
= Index
;
1134 // Prepare HiiValue array
1136 HiiValueArray
= AllocateZeroPool (*PopUpMenuLines
* sizeof (EFI_HII_VALUE
));
1137 ASSERT (HiiValueArray
!= NULL
);
1139 for (Index
= 0; Index
< *PopUpMenuLines
; Index
++) {
1140 HiiValueArray
[Index
].Type
= ValueType
;
1141 HiiValueArray
[Index
].Value
.u64
= GetArrayData (ValueArray
, ValueType
, Index
);
1144 for (Index
= 0; Index
< *PopUpMenuLines
; Index
++) {
1145 OneOfOption
= ValueToOption (Question
, &HiiValueArray
[*PopUpMenuLines
- Index
- 1]);
1146 if (OneOfOption
== NULL
) {
1147 return EFI_NOT_FOUND
;
1150 RemoveEntryList (&OneOfOption
->Link
);
1155 InsertHeadList (&Question
->OptionListHead
, &OneOfOption
->Link
);
1158 FreePool (HiiValueArray
);
1164 Base on the type to compare the value.
1166 @param Value1 The first value need to compare.
1167 @param Value2 The second value need to compare.
1168 @param Type The value type for above two values.
1170 @retval TRUE The two value are same.
1171 @retval FALSE The two value are different.
1176 IN EFI_IFR_TYPE_VALUE
*Value1
,
1177 IN EFI_IFR_TYPE_VALUE
*Value2
,
1182 case EFI_IFR_TYPE_BOOLEAN
:
1183 case EFI_IFR_TYPE_NUM_SIZE_8
:
1184 return (BOOLEAN
) (Value1
->u8
== Value2
->u8
);
1186 case EFI_IFR_TYPE_NUM_SIZE_16
:
1187 return (BOOLEAN
) (Value1
->u16
== Value2
->u16
);
1189 case EFI_IFR_TYPE_NUM_SIZE_32
:
1190 return (BOOLEAN
) (Value1
->u32
== Value2
->u32
);
1192 case EFI_IFR_TYPE_NUM_SIZE_64
:
1193 return (BOOLEAN
) (Value1
->u64
== Value2
->u64
);
1202 Base on the type to set the value.
1204 @param Dest The dest value.
1205 @param Source The source value.
1206 @param Type The value type for above two values.
1211 OUT EFI_IFR_TYPE_VALUE
*Dest
,
1212 IN EFI_IFR_TYPE_VALUE
*Source
,
1217 case EFI_IFR_TYPE_BOOLEAN
:
1218 Dest
->b
= Source
->b
;
1221 case EFI_IFR_TYPE_NUM_SIZE_8
:
1222 Dest
->u8
= Source
->u8
;
1225 case EFI_IFR_TYPE_NUM_SIZE_16
:
1226 Dest
->u16
= Source
->u16
;
1229 case EFI_IFR_TYPE_NUM_SIZE_32
:
1230 Dest
->u32
= Source
->u32
;
1233 case EFI_IFR_TYPE_NUM_SIZE_64
:
1234 Dest
->u64
= Source
->u64
;
1244 Get selection for OneOf and OrderedList (Left/Right will be ignored).
1246 @param MenuOption Pointer to the current input menu.
1248 @retval EFI_SUCCESS If Option input is processed successfully
1249 @retval EFI_DEVICE_ERROR If operation fails
1253 GetSelectionInputPopUp (
1254 IN UI_MENU_OPTION
*MenuOption
1260 CHAR16
*TempStringPtr
;
1262 UINTN TopOptionIndex
;
1263 UINTN HighlightOptionIndex
;
1268 UINTN PopUpMenuLines
;
1269 UINTN MenuLinesInView
;
1272 INT32 SavedAttribute
;
1273 BOOLEAN ShowDownArrow
;
1274 BOOLEAN ShowUpArrow
;
1275 UINTN DimensionsWidth
;
1277 BOOLEAN OrderedList
;
1281 EFI_HII_VALUE HiiValue
;
1282 DISPLAY_QUESTION_OPTION
*OneOfOption
;
1283 DISPLAY_QUESTION_OPTION
*CurrentOption
;
1284 FORM_DISPLAY_ENGINE_STATEMENT
*Question
;
1286 EFI_IFR_ORDERED_LIST
*OrderList
;
1288 DimensionsWidth
= gStatementDimensions
.RightColumn
- gStatementDimensions
.LeftColumn
;
1292 CurrentOption
= NULL
;
1293 ShowDownArrow
= FALSE
;
1294 ShowUpArrow
= FALSE
;
1296 StringPtr
= AllocateZeroPool ((gOptionBlockWidth
+ 1) * 2);
1299 ZeroMem (&HiiValue
, sizeof (EFI_HII_VALUE
));
1301 Question
= MenuOption
->ThisTag
;
1302 if (Question
->OpCode
->OpCode
== EFI_IFR_ORDERED_LIST_OP
) {
1303 Link
= GetFirstNode (&Question
->OptionListHead
);
1304 OneOfOption
= DISPLAY_QUESTION_OPTION_FROM_LINK (Link
);
1305 ValueArray
= Question
->CurrentValue
.Buffer
;
1306 ValueType
= OneOfOption
->OptionOpCode
->Type
;
1308 OrderList
= (EFI_IFR_ORDERED_LIST
*) Question
->OpCode
;
1310 OrderedList
= FALSE
;
1315 // Calculate Option count
1319 AdjustOptionOrder(Question
, &PopUpMenuLines
);
1321 Link
= GetFirstNode (&Question
->OptionListHead
);
1322 while (!IsNull (&Question
->OptionListHead
, Link
)) {
1323 OneOfOption
= DISPLAY_QUESTION_OPTION_FROM_LINK (Link
);
1325 Link
= GetNextNode (&Question
->OptionListHead
, Link
);
1330 // Get the number of one of options present and its size
1333 HighlightOptionIndex
= 0;
1334 Link
= GetFirstNode (&Question
->OptionListHead
);
1335 for (Index
= 0; Index
< PopUpMenuLines
; Index
++) {
1336 OneOfOption
= DISPLAY_QUESTION_OPTION_FROM_LINK (Link
);
1338 StringPtr
= GetToken (OneOfOption
->OptionOpCode
->Option
, gFormData
->HiiHandle
);
1339 if (StrLen (StringPtr
) > PopUpWidth
) {
1340 PopUpWidth
= StrLen (StringPtr
);
1342 FreePool (StringPtr
);
1343 HiiValue
.Type
= OneOfOption
->OptionOpCode
->Type
;
1344 SetValuesByType (&HiiValue
.Value
, &OneOfOption
->OptionOpCode
->Value
, HiiValue
.Type
);
1345 if (!OrderedList
&& (CompareHiiValue (&Question
->CurrentValue
, &HiiValue
, &Result
, NULL
) == EFI_SUCCESS
) && (Result
== 0)) {
1347 // Find current selected Option for OneOf
1349 HighlightOptionIndex
= Index
;
1352 Link
= GetNextNode (&Question
->OptionListHead
, Link
);
1356 // Perform popup menu initialization.
1358 PopUpWidth
= PopUpWidth
+ POPUP_PAD_SPACE_COUNT
;
1360 SavedAttribute
= gST
->ConOut
->Mode
->Attribute
;
1361 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetPopupColor ());
1363 if ((PopUpWidth
+ POPUP_FRAME_WIDTH
) > DimensionsWidth
) {
1364 PopUpWidth
= DimensionsWidth
- POPUP_FRAME_WIDTH
;
1367 Start
= (DimensionsWidth
- PopUpWidth
- POPUP_FRAME_WIDTH
) / 2 + gStatementDimensions
.LeftColumn
;
1368 End
= Start
+ PopUpWidth
+ POPUP_FRAME_WIDTH
;
1369 Top
= gStatementDimensions
.TopRow
;
1370 Bottom
= gStatementDimensions
.BottomRow
- 1;
1372 MenuLinesInView
= Bottom
- Top
- 1;
1373 if (MenuLinesInView
>= PopUpMenuLines
) {
1374 Top
= Top
+ (MenuLinesInView
- PopUpMenuLines
) / 2;
1375 Bottom
= Top
+ PopUpMenuLines
+ 1;
1377 ShowDownArrow
= TRUE
;
1380 if (HighlightOptionIndex
> (MenuLinesInView
- 1)) {
1381 TopOptionIndex
= HighlightOptionIndex
- MenuLinesInView
+ 1;
1388 // Clear that portion of the screen
1390 ClearLines (Start
, End
, Top
, Bottom
, GetPopupColor ());
1393 // Draw "One of" pop-up menu
1395 Character
= BOXDRAW_DOWN_RIGHT
;
1396 PrintCharAt (Start
, Top
, Character
);
1397 for (Index
= Start
; Index
+ 2 < End
; Index
++) {
1398 if ((ShowUpArrow
) && ((Index
+ 1) == (Start
+ End
) / 2)) {
1399 Character
= GEOMETRICSHAPE_UP_TRIANGLE
;
1401 Character
= BOXDRAW_HORIZONTAL
;
1404 PrintCharAt ((UINTN
)-1, (UINTN
)-1, Character
);
1407 Character
= BOXDRAW_DOWN_LEFT
;
1408 PrintCharAt ((UINTN
)-1, (UINTN
)-1, Character
);
1409 Character
= BOXDRAW_VERTICAL
;
1410 for (Index
= Top
+ 1; Index
< Bottom
; Index
++) {
1411 PrintCharAt (Start
, Index
, Character
);
1412 PrintCharAt (End
- 1, Index
, Character
);
1416 // Move to top Option
1418 Link
= GetFirstNode (&Question
->OptionListHead
);
1419 for (Index
= 0; Index
< TopOptionIndex
; Index
++) {
1420 Link
= GetNextNode (&Question
->OptionListHead
, Link
);
1424 // Display the One of options
1427 for (Index
= TopOptionIndex
; (Index
< PopUpMenuLines
) && (Index2
< Bottom
); Index
++) {
1428 OneOfOption
= DISPLAY_QUESTION_OPTION_FROM_LINK (Link
);
1429 Link
= GetNextNode (&Question
->OptionListHead
, Link
);
1431 StringPtr
= GetToken (OneOfOption
->OptionOpCode
->Option
, gFormData
->HiiHandle
);
1432 ASSERT (StringPtr
!= NULL
);
1434 // If the string occupies multiple lines, truncate it to fit in one line,
1435 // and append a "..." for indication.
1437 if (StrLen (StringPtr
) > (PopUpWidth
- 1)) {
1438 TempStringPtr
= AllocateZeroPool (sizeof (CHAR16
) * (PopUpWidth
- 1));
1439 ASSERT ( TempStringPtr
!= NULL
);
1440 CopyMem (TempStringPtr
, StringPtr
, (sizeof (CHAR16
) * (PopUpWidth
- 5)));
1441 FreePool (StringPtr
);
1442 StringPtr
= TempStringPtr
;
1443 StrCat (StringPtr
, L
"...");
1446 if (Index
== HighlightOptionIndex
) {
1448 // Highlight the selected one
1450 CurrentOption
= OneOfOption
;
1452 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetPickListColor ());
1453 PrintStringAt (Start
+ 2, Index2
, StringPtr
);
1454 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetPopupColor ());
1456 gST
->ConOut
->SetAttribute (gST
->ConOut
, GetPopupColor ());
1457 PrintStringAt (Start
+ 2, Index2
, StringPtr
);
1461 FreePool (StringPtr
);
1464 Character
= BOXDRAW_UP_RIGHT
;
1465 PrintCharAt (Start
, Bottom
, Character
);
1466 for (Index
= Start
; Index
+ 2 < End
; Index
++) {
1467 if ((ShowDownArrow
) && ((Index
+ 1) == (Start
+ End
) / 2)) {
1468 Character
= GEOMETRICSHAPE_DOWN_TRIANGLE
;
1470 Character
= BOXDRAW_HORIZONTAL
;
1473 PrintCharAt ((UINTN
)-1, (UINTN
)-1, Character
);
1476 Character
= BOXDRAW_UP_LEFT
;
1477 PrintCharAt ((UINTN
)-1, (UINTN
)-1, Character
);
1480 // Get User selection
1482 Key
.UnicodeChar
= CHAR_NULL
;
1483 if ((gDirection
== SCAN_UP
) || (gDirection
== SCAN_DOWN
)) {
1484 Key
.ScanCode
= gDirection
;
1489 WaitForKeyStroke (&Key
);
1492 switch (Key
.UnicodeChar
) {
1495 if ((TopOptionIndex
> 0) && (TopOptionIndex
== HighlightOptionIndex
)) {
1497 // Highlight reaches the top of the popup window, scroll one menu item.
1500 ShowDownArrow
= TRUE
;
1503 if (TopOptionIndex
== 0) {
1504 ShowUpArrow
= FALSE
;
1507 if (HighlightOptionIndex
> 0) {
1508 HighlightOptionIndex
--;
1510 ASSERT (CurrentOption
!= NULL
);
1511 SwapListEntries (CurrentOption
->Link
.BackLink
, &CurrentOption
->Link
);
1518 // If an ordered list op-code, we will allow for a popup of +/- keys
1519 // to create an ordered list of items
1522 if (((TopOptionIndex
+ MenuLinesInView
) < PopUpMenuLines
) &&
1523 (HighlightOptionIndex
== (TopOptionIndex
+ MenuLinesInView
- 1))) {
1525 // Highlight reaches the bottom of the popup window, scroll one menu item.
1531 if ((TopOptionIndex
+ MenuLinesInView
) == PopUpMenuLines
) {
1532 ShowDownArrow
= FALSE
;
1535 if (HighlightOptionIndex
< (PopUpMenuLines
- 1)) {
1536 HighlightOptionIndex
++;
1538 ASSERT (CurrentOption
!= NULL
);
1539 SwapListEntries (&CurrentOption
->Link
, CurrentOption
->Link
.ForwardLink
);
1545 switch (Key
.ScanCode
) {
1548 if (Key
.ScanCode
== SCAN_UP
) {
1549 if ((TopOptionIndex
> 0) && (TopOptionIndex
== HighlightOptionIndex
)) {
1551 // Highlight reaches the top of the popup window, scroll one menu item.
1554 ShowDownArrow
= TRUE
;
1557 if (TopOptionIndex
== 0) {
1558 ShowUpArrow
= FALSE
;
1561 if (HighlightOptionIndex
> 0) {
1562 HighlightOptionIndex
--;
1565 if (((TopOptionIndex
+ MenuLinesInView
) < PopUpMenuLines
) &&
1566 (HighlightOptionIndex
== (TopOptionIndex
+ MenuLinesInView
- 1))) {
1568 // Highlight reaches the bottom of the popup window, scroll one menu item.
1574 if ((TopOptionIndex
+ MenuLinesInView
) == PopUpMenuLines
) {
1575 ShowDownArrow
= FALSE
;
1578 if (HighlightOptionIndex
< (PopUpMenuLines
- 1)) {
1579 HighlightOptionIndex
++;
1585 gST
->ConOut
->SetAttribute (gST
->ConOut
, SavedAttribute
);
1588 // Restore link list order for orderedlist
1591 HiiValue
.Type
= ValueType
;
1592 HiiValue
.Value
.u64
= 0;
1593 for (Index
= 0; Index
< OrderList
->MaxContainers
; Index
++) {
1594 HiiValue
.Value
.u64
= GetArrayData (ValueArray
, ValueType
, Index
);
1595 if (HiiValue
.Value
.u64
== 0) {
1599 OneOfOption
= ValueToOption (Question
, &HiiValue
);
1600 if (OneOfOption
== NULL
) {
1601 return EFI_NOT_FOUND
;
1604 RemoveEntryList (&OneOfOption
->Link
);
1605 InsertTailList (&Question
->OptionListHead
, &OneOfOption
->Link
);
1609 return EFI_DEVICE_ERROR
;
1617 case CHAR_CARRIAGE_RETURN
:
1619 // return the current selection
1622 ReturnValue
= AllocateZeroPool (Question
->CurrentValue
.BufferLen
);
1623 ASSERT (ReturnValue
!= NULL
);
1625 Link
= GetFirstNode (&Question
->OptionListHead
);
1626 while (!IsNull (&Question
->OptionListHead
, Link
)) {
1627 OneOfOption
= DISPLAY_QUESTION_OPTION_FROM_LINK (Link
);
1628 Link
= GetNextNode (&Question
->OptionListHead
, Link
);
1630 SetArrayData (ReturnValue
, ValueType
, Index
, OneOfOption
->OptionOpCode
->Value
.u64
);
1633 if (Index
> OrderList
->MaxContainers
) {
1637 if (CompareMem (ReturnValue
, ValueArray
, Question
->CurrentValue
.BufferLen
) == 0) {
1638 FreePool (ReturnValue
);
1639 return EFI_DEVICE_ERROR
;
1641 gUserInput
->InputValue
.Buffer
= ReturnValue
;
1642 gUserInput
->InputValue
.BufferLen
= Question
->CurrentValue
.BufferLen
;
1645 ASSERT (CurrentOption
!= NULL
);
1646 gUserInput
->InputValue
.Type
= CurrentOption
->OptionOpCode
->Type
;
1647 if (IsValuesEqual (&Question
->CurrentValue
.Value
, &CurrentOption
->OptionOpCode
->Value
, gUserInput
->InputValue
.Type
)) {
1648 return EFI_DEVICE_ERROR
;
1650 SetValuesByType (&gUserInput
->InputValue
.Value
, &CurrentOption
->OptionOpCode
->Value
, gUserInput
->InputValue
.Type
);
1654 gST
->ConOut
->SetAttribute (gST
->ConOut
, SavedAttribute
);