UEFI HII: Merge UEFI HII support changes from branch.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4599 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
55
MdeModulePkg/Universal/SetupBrowserDxe/Colors.h
Normal file
55
MdeModulePkg/Universal/SetupBrowserDxe/Colors.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2004, Intel Corporation
|
||||
All rights reserved. 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
Colors.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _COLORS_H
|
||||
#define _COLORS_H
|
||||
|
||||
//
|
||||
// Screen Color Settings
|
||||
//
|
||||
#define PICKLIST_HIGHLIGHT_TEXT EFI_WHITE
|
||||
#define PICKLIST_HIGHLIGHT_BACKGROUND EFI_BACKGROUND_CYAN
|
||||
#define TITLE_TEXT EFI_WHITE
|
||||
#define TITLE_BACKGROUND EFI_BACKGROUND_BLUE
|
||||
#define KEYHELP_TEXT EFI_LIGHTGRAY
|
||||
#define KEYHELP_BACKGROUND EFI_BACKGROUND_BLACK
|
||||
#define SUBTITLE_TEXT EFI_BLUE
|
||||
#define SUBTITLE_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
|
||||
#define BANNER_TEXT EFI_BLUE
|
||||
#define BANNER_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
|
||||
#define FIELD_TEXT EFI_BLACK
|
||||
#define FIELD_TEXT_GRAYED EFI_DARKGRAY
|
||||
#define FIELD_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
|
||||
#define FIELD_TEXT_HIGHLIGHT EFI_LIGHTGRAY
|
||||
#define FIELD_BACKGROUND_HIGHLIGHT EFI_BACKGROUND_BLACK
|
||||
#define POPUP_TEXT EFI_LIGHTGRAY
|
||||
#define POPUP_BACKGROUND EFI_BACKGROUND_BLUE
|
||||
#define POPUP_INVERSE_TEXT EFI_LIGHTGRAY
|
||||
#define POPUP_INVERSE_BACKGROUND EFI_BACKGROUND_BLACK
|
||||
#define HELP_TEXT EFI_BLUE
|
||||
#define ERROR_TEXT EFI_RED | EFI_BRIGHT
|
||||
#define INFO_TEXT EFI_YELLOW | EFI_BRIGHT
|
||||
#define ARROW_TEXT EFI_RED | EFI_BRIGHT
|
||||
#define ARROW_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
|
||||
|
||||
#endif
|
1938
MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
Normal file
1938
MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
Normal file
File diff suppressed because it is too large
Load Diff
1640
MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
Normal file
1640
MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
Normal file
File diff suppressed because it is too large
Load Diff
1146
MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
Normal file
1146
MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
Normal file
File diff suppressed because it is too large
Load Diff
928
MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
Normal file
928
MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
Normal file
@@ -0,0 +1,928 @@
|
||||
/** @file
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
Presentation.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Some presentation routines.
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "Setup.h"
|
||||
#include "Ui.h"
|
||||
|
||||
BOOLEAN mHiiPackageListUpdated;
|
||||
UI_MENU_SELECTION *gCurrentSelection;
|
||||
|
||||
|
||||
/**
|
||||
Clear retangle with specified text attribute.
|
||||
|
||||
@param LeftColumn Left column of retangle.
|
||||
@param RightColumn Right column of retangle.
|
||||
@param TopRow Start row of retangle.
|
||||
@param BottomRow End row of retangle.
|
||||
@param TextAttribute The character foreground and background.
|
||||
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
ClearLines (
|
||||
UINTN LeftColumn,
|
||||
UINTN RightColumn,
|
||||
UINTN TopRow,
|
||||
UINTN BottomRow,
|
||||
UINTN TextAttribute
|
||||
)
|
||||
{
|
||||
CHAR16 *Buffer;
|
||||
UINTN Row;
|
||||
|
||||
//
|
||||
// For now, allocate an arbitrarily long buffer
|
||||
//
|
||||
Buffer = AllocateZeroPool (0x10000);
|
||||
ASSERT (Buffer != NULL);
|
||||
|
||||
//
|
||||
// Set foreground and background as defined
|
||||
//
|
||||
gST->ConOut->SetAttribute (gST->ConOut, TextAttribute);
|
||||
|
||||
//
|
||||
// Much faster to buffer the long string instead of print it a character at a time
|
||||
//
|
||||
SetUnicodeMem (Buffer, RightColumn - LeftColumn, L' ');
|
||||
|
||||
//
|
||||
// Clear the desired area with the appropriate foreground/background
|
||||
//
|
||||
for (Row = TopRow; Row <= BottomRow; Row++) {
|
||||
PrintStringAt (LeftColumn, Row, Buffer);
|
||||
}
|
||||
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, LeftColumn, TopRow);
|
||||
|
||||
gBS->FreePool (Buffer);
|
||||
return ;
|
||||
}
|
||||
|
||||
VOID
|
||||
NewStrCat (
|
||||
CHAR16 *Destination,
|
||||
CHAR16 *Source
|
||||
)
|
||||
{
|
||||
UINTN Length;
|
||||
|
||||
for (Length = 0; Destination[Length] != 0; Length++)
|
||||
;
|
||||
|
||||
//
|
||||
// We now have the length of the original string
|
||||
// We can safely assume for now that we are concatenating a narrow value to this string.
|
||||
// For instance, the string is "XYZ" and cat'ing ">"
|
||||
// If this assumption changes, we need to make this routine a bit more complex
|
||||
//
|
||||
Destination[Length] = NARROW_CHAR;
|
||||
Length++;
|
||||
|
||||
StrCpy (Destination + Length, Source);
|
||||
}
|
||||
|
||||
UINTN
|
||||
GetStringWidth (
|
||||
CHAR16 *String
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN Count;
|
||||
UINTN IncrementValue;
|
||||
|
||||
Index = 0;
|
||||
Count = 0;
|
||||
IncrementValue = 1;
|
||||
|
||||
do {
|
||||
//
|
||||
// Advance to the null-terminator or to the first width directive
|
||||
//
|
||||
for (;
|
||||
(String[Index] != NARROW_CHAR) && (String[Index] != WIDE_CHAR) && (String[Index] != 0);
|
||||
Index++, Count = Count + IncrementValue
|
||||
)
|
||||
;
|
||||
|
||||
//
|
||||
// We hit the null-terminator, we now have a count
|
||||
//
|
||||
if (String[Index] == 0) {
|
||||
break;
|
||||
}
|
||||
//
|
||||
// We encountered a narrow directive - strip it from the size calculation since it doesn't get printed
|
||||
// and also set the flag that determines what we increment by.(if narrow, increment by 1, if wide increment by 2)
|
||||
//
|
||||
if (String[Index] == NARROW_CHAR) {
|
||||
//
|
||||
// Skip to the next character
|
||||
//
|
||||
Index++;
|
||||
IncrementValue = 1;
|
||||
} else {
|
||||
//
|
||||
// Skip to the next character
|
||||
//
|
||||
Index++;
|
||||
IncrementValue = 2;
|
||||
}
|
||||
} while (String[Index] != 0);
|
||||
|
||||
//
|
||||
// Increment by one to include the null-terminator in the size
|
||||
//
|
||||
Count++;
|
||||
|
||||
return Count * sizeof (CHAR16);
|
||||
}
|
||||
|
||||
VOID
|
||||
DisplayPageFrame (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINT8 Line;
|
||||
UINT8 Alignment;
|
||||
CHAR16 Character;
|
||||
CHAR16 *Buffer;
|
||||
CHAR16 *StrFrontPageBanner;
|
||||
UINTN Row;
|
||||
EFI_SCREEN_DESCRIPTOR LocalScreen;
|
||||
|
||||
ZeroMem (&LocalScreen, sizeof (EFI_SCREEN_DESCRIPTOR));
|
||||
gST->ConOut->QueryMode (gST->ConOut, gST->ConOut->Mode->Mode, &LocalScreen.RightColumn, &LocalScreen.BottomRow);
|
||||
ClearLines (0, LocalScreen.RightColumn, 0, LocalScreen.BottomRow, KEYHELP_BACKGROUND);
|
||||
|
||||
CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
|
||||
|
||||
//
|
||||
// For now, allocate an arbitrarily long buffer
|
||||
//
|
||||
Buffer = AllocateZeroPool (0x10000);
|
||||
ASSERT (Buffer != NULL);
|
||||
|
||||
Character = BOXDRAW_HORIZONTAL;
|
||||
|
||||
for (Index = 0; Index + 2 < (LocalScreen.RightColumn - LocalScreen.LeftColumn); Index++) {
|
||||
Buffer[Index] = Character;
|
||||
}
|
||||
|
||||
if (gClassOfVfr == EFI_FRONT_PAGE_SUBCLASS) {
|
||||
//
|
||||
// ClearLines(0, LocalScreen.RightColumn, 0, BANNER_HEIGHT-1, BANNER_TEXT | BANNER_BACKGROUND);
|
||||
//
|
||||
ClearLines (
|
||||
LocalScreen.LeftColumn,
|
||||
LocalScreen.RightColumn,
|
||||
LocalScreen.TopRow,
|
||||
FRONT_PAGE_HEADER_HEIGHT - 1 + LocalScreen.TopRow,
|
||||
BANNER_TEXT | BANNER_BACKGROUND
|
||||
);
|
||||
//
|
||||
// for (Line = 0; Line < BANNER_HEIGHT; Line++) {
|
||||
//
|
||||
for (Line = (UINT8) LocalScreen.TopRow; Line < BANNER_HEIGHT + (UINT8) LocalScreen.TopRow; Line++) {
|
||||
//
|
||||
// for (Alignment = 0; Alignment < BANNER_COLUMNS; Alignment++) {
|
||||
//
|
||||
for (Alignment = (UINT8) LocalScreen.LeftColumn;
|
||||
Alignment < BANNER_COLUMNS + (UINT8) LocalScreen.LeftColumn;
|
||||
Alignment++
|
||||
) {
|
||||
if (BannerData->Banner[Line - (UINT8) LocalScreen.TopRow][Alignment - (UINT8) LocalScreen.LeftColumn] != 0x0000) {
|
||||
StrFrontPageBanner = GetToken (
|
||||
BannerData->Banner[Line - (UINT8) LocalScreen.TopRow][Alignment - (UINT8) LocalScreen.LeftColumn],
|
||||
FrontPageHandle
|
||||
);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (Alignment - LocalScreen.LeftColumn) {
|
||||
case 0:
|
||||
//
|
||||
// Handle left column
|
||||
//
|
||||
PrintStringAt (LocalScreen.LeftColumn, Line, StrFrontPageBanner);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
//
|
||||
// Handle center column
|
||||
//
|
||||
PrintStringAt (
|
||||
LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 3,
|
||||
Line,
|
||||
StrFrontPageBanner
|
||||
);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
//
|
||||
// Handle right column
|
||||
//
|
||||
PrintStringAt (
|
||||
LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) * 2 / 3,
|
||||
Line,
|
||||
StrFrontPageBanner
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
gBS->FreePool (StrFrontPageBanner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ClearLines (
|
||||
LocalScreen.LeftColumn,
|
||||
LocalScreen.RightColumn,
|
||||
LocalScreen.BottomRow - STATUS_BAR_HEIGHT - FOOTER_HEIGHT,
|
||||
LocalScreen.BottomRow - STATUS_BAR_HEIGHT - 1,
|
||||
KEYHELP_TEXT | KEYHELP_BACKGROUND
|
||||
);
|
||||
|
||||
if (gClassOfVfr != EFI_FRONT_PAGE_SUBCLASS) {
|
||||
ClearLines (
|
||||
LocalScreen.LeftColumn,
|
||||
LocalScreen.RightColumn,
|
||||
LocalScreen.TopRow,
|
||||
LocalScreen.TopRow + NONE_FRONT_PAGE_HEADER_HEIGHT - 1,
|
||||
TITLE_TEXT | TITLE_BACKGROUND
|
||||
);
|
||||
//
|
||||
// Print Top border line
|
||||
// +------------------------------------------------------------------------------+
|
||||
// ? ?
|
||||
// +------------------------------------------------------------------------------+
|
||||
//
|
||||
Character = BOXDRAW_DOWN_RIGHT;
|
||||
|
||||
PrintChar (Character);
|
||||
PrintString (Buffer);
|
||||
|
||||
Character = BOXDRAW_DOWN_LEFT;
|
||||
PrintChar (Character);
|
||||
|
||||
Character = BOXDRAW_VERTICAL;
|
||||
for (Row = LocalScreen.TopRow + 1; Row <= LocalScreen.TopRow + NONE_FRONT_PAGE_HEADER_HEIGHT - 2; Row++) {
|
||||
PrintCharAt (LocalScreen.LeftColumn, Row, Character);
|
||||
PrintCharAt (LocalScreen.RightColumn - 1, Row, Character);
|
||||
}
|
||||
|
||||
Character = BOXDRAW_UP_RIGHT;
|
||||
PrintCharAt (LocalScreen.LeftColumn, LocalScreen.TopRow + NONE_FRONT_PAGE_HEADER_HEIGHT - 1, Character);
|
||||
PrintString (Buffer);
|
||||
|
||||
Character = BOXDRAW_UP_LEFT;
|
||||
PrintChar (Character);
|
||||
|
||||
if (gClassOfVfr == EFI_SETUP_APPLICATION_SUBCLASS) {
|
||||
//
|
||||
// Print Bottom border line
|
||||
// +------------------------------------------------------------------------------+
|
||||
// ? ?
|
||||
// +------------------------------------------------------------------------------+
|
||||
//
|
||||
Character = BOXDRAW_DOWN_RIGHT;
|
||||
PrintCharAt (LocalScreen.LeftColumn, LocalScreen.BottomRow - STATUS_BAR_HEIGHT - FOOTER_HEIGHT, Character);
|
||||
|
||||
PrintString (Buffer);
|
||||
|
||||
Character = BOXDRAW_DOWN_LEFT;
|
||||
PrintChar (Character);
|
||||
Character = BOXDRAW_VERTICAL;
|
||||
for (Row = LocalScreen.BottomRow - STATUS_BAR_HEIGHT - FOOTER_HEIGHT + 1;
|
||||
Row <= LocalScreen.BottomRow - STATUS_BAR_HEIGHT - 2;
|
||||
Row++
|
||||
) {
|
||||
PrintCharAt (LocalScreen.LeftColumn, Row, Character);
|
||||
PrintCharAt (LocalScreen.RightColumn - 1, Row, Character);
|
||||
}
|
||||
|
||||
Character = BOXDRAW_UP_RIGHT;
|
||||
PrintCharAt (LocalScreen.LeftColumn, LocalScreen.BottomRow - STATUS_BAR_HEIGHT - 1, Character);
|
||||
|
||||
PrintString (Buffer);
|
||||
|
||||
Character = BOXDRAW_UP_LEFT;
|
||||
PrintChar (Character);
|
||||
}
|
||||
}
|
||||
|
||||
gBS->FreePool (Buffer);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Evaluate all expressions in a Form.
|
||||
|
||||
@param FormSet FormSet this Form belongs to.
|
||||
@param Form The Form.
|
||||
|
||||
@retval EFI_SUCCESS The expression evaluated successfuly
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EvaluateFormExpressions (
|
||||
IN FORM_BROWSER_FORMSET *FormSet,
|
||||
IN FORM_BROWSER_FORM *Form
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Link;
|
||||
FORM_EXPRESSION *Expression;
|
||||
|
||||
Link = GetFirstNode (&Form->ExpressionListHead);
|
||||
while (!IsNull (&Form->ExpressionListHead, Link)) {
|
||||
Expression = FORM_EXPRESSION_FROM_LINK (Link);
|
||||
Link = GetNextNode (&Form->ExpressionListHead, Link);
|
||||
|
||||
if (Expression->Type == EFI_HII_EXPRESSION_INCONSISTENT_IF ||
|
||||
Expression->Type == EFI_HII_EXPRESSION_NO_SUBMIT_IF) {
|
||||
//
|
||||
// Postpone Form validation to Question editing or Form submiting
|
||||
//
|
||||
continue;
|
||||
}
|
||||
|
||||
Status = EvaluateExpression (FormSet, Form, Expression);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
+------------------------------------------------------------------------------+
|
||||
?F2=Previous Page Setup Page ?
|
||||
+------------------------------------------------------------------------------+
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+------------------------------------------------------------------------------+
|
||||
?F1=Scroll Help F9=Reset to Defaults F10=Save and Exit ?
|
||||
| ^"=Move Highlight <Spacebar> Toggles Checkbox Esc=Discard Changes |
|
||||
+------------------------------------------------------------------------------+
|
||||
*/
|
||||
EFI_STATUS
|
||||
DisplayForm (
|
||||
IN OUT UI_MENU_SELECTION *Selection
|
||||
)
|
||||
{
|
||||
CHAR16 *StringPtr;
|
||||
UINT16 MenuItemCount;
|
||||
EFI_HII_HANDLE Handle;
|
||||
BOOLEAN Suppress;
|
||||
EFI_SCREEN_DESCRIPTOR LocalScreen;
|
||||
UINT16 Width;
|
||||
UINTN ArrayEntry;
|
||||
CHAR16 *OutputString;
|
||||
LIST_ENTRY *Link;
|
||||
FORM_BROWSER_STATEMENT *Statement;
|
||||
UINT16 NumberOfLines;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Handle = Selection->Handle;
|
||||
MenuItemCount = 0;
|
||||
ArrayEntry = 0;
|
||||
OutputString = NULL;
|
||||
|
||||
UiInitMenu ();
|
||||
|
||||
CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
|
||||
|
||||
StringPtr = GetToken (Selection->FormSet->FormSetTitle, Handle);
|
||||
|
||||
if (gClassOfVfr != EFI_FRONT_PAGE_SUBCLASS) {
|
||||
gST->ConOut->SetAttribute (gST->ConOut, TITLE_TEXT | TITLE_BACKGROUND);
|
||||
PrintStringAt (
|
||||
(LocalScreen.RightColumn + LocalScreen.LeftColumn - GetStringWidth (StringPtr) / 2) / 2,
|
||||
LocalScreen.TopRow + 1,
|
||||
StringPtr
|
||||
);
|
||||
}
|
||||
|
||||
if (gClassOfVfr == EFI_SETUP_APPLICATION_SUBCLASS) {
|
||||
gST->ConOut->SetAttribute (gST->ConOut, KEYHELP_TEXT | KEYHELP_BACKGROUND);
|
||||
|
||||
//
|
||||
// Display the infrastructure strings
|
||||
//
|
||||
if (!IsListEmpty (&gMenuList)) {
|
||||
PrintStringAt (LocalScreen.LeftColumn + 2, LocalScreen.TopRow + 1, gFunctionTwoString);
|
||||
}
|
||||
|
||||
PrintStringAt (LocalScreen.LeftColumn + 2, LocalScreen.BottomRow - 4, gFunctionOneString);
|
||||
PrintStringAt (
|
||||
LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 3,
|
||||
LocalScreen.BottomRow - 4,
|
||||
gFunctionNineString
|
||||
);
|
||||
PrintStringAt (
|
||||
LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) * 2 / 3,
|
||||
LocalScreen.BottomRow - 4,
|
||||
gFunctionTenString
|
||||
);
|
||||
PrintAt (LocalScreen.LeftColumn + 2, LocalScreen.BottomRow - 3, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
|
||||
PrintStringAt (
|
||||
LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 3,
|
||||
LocalScreen.BottomRow - 3,
|
||||
gEscapeString
|
||||
);
|
||||
}
|
||||
//
|
||||
// Remove Buffer allocated for StringPtr after it has been used.
|
||||
//
|
||||
gBS->FreePool (StringPtr);
|
||||
|
||||
//
|
||||
// Evaluate all the Expressions in this Form
|
||||
//
|
||||
Status = EvaluateFormExpressions (Selection->FormSet, Selection->Form);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Link = GetFirstNode (&Selection->Form->StatementListHead);
|
||||
while (!IsNull (&Selection->Form->StatementListHead, Link)) {
|
||||
Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
|
||||
|
||||
if (Statement->SuppressExpression != NULL) {
|
||||
Suppress = Statement->SuppressExpression->Result.Value.b;
|
||||
} else {
|
||||
Suppress = FALSE;
|
||||
}
|
||||
|
||||
if (!Suppress) {
|
||||
StringPtr = GetToken (Statement->Prompt, Handle);
|
||||
|
||||
Width = GetWidth (Statement, Handle);
|
||||
|
||||
NumberOfLines = 1;
|
||||
ArrayEntry = 0;
|
||||
for (; GetLineByWidth (StringPtr, Width, &ArrayEntry, &OutputString) != 0x0000;) {
|
||||
//
|
||||
// If there is more string to process print on the next row and increment the Skip value
|
||||
//
|
||||
if (StrLen (&StringPtr[ArrayEntry])) {
|
||||
NumberOfLines++;
|
||||
}
|
||||
|
||||
gBS->FreePool (OutputString);
|
||||
}
|
||||
|
||||
//
|
||||
// We are NOT!! removing this StringPtr buffer via FreePool since it is being used in the menuoptions, we will do
|
||||
// it in UiFreeMenu.
|
||||
//
|
||||
UiAddMenuOption (StringPtr, Selection->Handle, Statement, NumberOfLines, MenuItemCount);
|
||||
MenuItemCount++;
|
||||
}
|
||||
|
||||
Link = GetNextNode (&Selection->Form->StatementListHead, Link);
|
||||
}
|
||||
|
||||
Status = UiDisplayMenu (Selection);
|
||||
|
||||
UiFreeMenu ();
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
VOID
|
||||
InitializeBrowserStrings (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
gFunctionOneString = GetToken (STRING_TOKEN (FUNCTION_ONE_STRING), gHiiHandle);
|
||||
gFunctionTwoString = GetToken (STRING_TOKEN (FUNCTION_TWO_STRING), gHiiHandle);
|
||||
gFunctionNineString = GetToken (STRING_TOKEN (FUNCTION_NINE_STRING), gHiiHandle);
|
||||
gFunctionTenString = GetToken (STRING_TOKEN (FUNCTION_TEN_STRING), gHiiHandle);
|
||||
gEnterString = GetToken (STRING_TOKEN (ENTER_STRING), gHiiHandle);
|
||||
gEnterCommitString = GetToken (STRING_TOKEN (ENTER_COMMIT_STRING), gHiiHandle);
|
||||
gEscapeString = GetToken (STRING_TOKEN (ESCAPE_STRING), gHiiHandle);
|
||||
gSaveFailed = GetToken (STRING_TOKEN (SAVE_FAILED), gHiiHandle);
|
||||
gMoveHighlight = GetToken (STRING_TOKEN (MOVE_HIGHLIGHT), gHiiHandle);
|
||||
gMakeSelection = GetToken (STRING_TOKEN (MAKE_SELECTION), gHiiHandle);
|
||||
gDecNumericInput = GetToken (STRING_TOKEN (DEC_NUMERIC_INPUT), gHiiHandle);
|
||||
gHexNumericInput = GetToken (STRING_TOKEN (HEX_NUMERIC_INPUT), gHiiHandle);
|
||||
gToggleCheckBox = GetToken (STRING_TOKEN (TOGGLE_CHECK_BOX), gHiiHandle);
|
||||
gPromptForData = GetToken (STRING_TOKEN (PROMPT_FOR_DATA), gHiiHandle);
|
||||
gPromptForPassword = GetToken (STRING_TOKEN (PROMPT_FOR_PASSWORD), gHiiHandle);
|
||||
gPromptForNewPassword = GetToken (STRING_TOKEN (PROMPT_FOR_NEW_PASSWORD), gHiiHandle);
|
||||
gConfirmPassword = GetToken (STRING_TOKEN (CONFIRM_PASSWORD), gHiiHandle);
|
||||
gConfirmError = GetToken (STRING_TOKEN (CONFIRM_ERROR), gHiiHandle);
|
||||
gPassowordInvalid = GetToken (STRING_TOKEN (PASSWORD_INVALID), gHiiHandle);
|
||||
gPressEnter = GetToken (STRING_TOKEN (PRESS_ENTER), gHiiHandle);
|
||||
gEmptyString = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
|
||||
gAreYouSure = GetToken (STRING_TOKEN (ARE_YOU_SURE), gHiiHandle);
|
||||
gYesResponse = GetToken (STRING_TOKEN (ARE_YOU_SURE_YES), gHiiHandle);
|
||||
gNoResponse = GetToken (STRING_TOKEN (ARE_YOU_SURE_NO), gHiiHandle);
|
||||
gMiniString = GetToken (STRING_TOKEN (MINI_STRING), gHiiHandle);
|
||||
gPlusString = GetToken (STRING_TOKEN (PLUS_STRING), gHiiHandle);
|
||||
gMinusString = GetToken (STRING_TOKEN (MINUS_STRING), gHiiHandle);
|
||||
gAdjustNumber = GetToken (STRING_TOKEN (ADJUST_NUMBER), gHiiHandle);
|
||||
return ;
|
||||
}
|
||||
|
||||
VOID
|
||||
FreeBrowserStrings (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
SafeFreePool (gFunctionOneString);
|
||||
SafeFreePool (gFunctionTwoString);
|
||||
SafeFreePool (gFunctionNineString);
|
||||
SafeFreePool (gFunctionTenString);
|
||||
SafeFreePool (gEnterString);
|
||||
SafeFreePool (gEnterCommitString);
|
||||
SafeFreePool (gEscapeString);
|
||||
SafeFreePool (gMoveHighlight);
|
||||
SafeFreePool (gMakeSelection);
|
||||
SafeFreePool (gDecNumericInput);
|
||||
SafeFreePool (gHexNumericInput);
|
||||
SafeFreePool (gToggleCheckBox);
|
||||
SafeFreePool (gPromptForData);
|
||||
SafeFreePool (gPromptForPassword);
|
||||
SafeFreePool (gPromptForNewPassword);
|
||||
SafeFreePool (gConfirmPassword);
|
||||
SafeFreePool (gPassowordInvalid);
|
||||
SafeFreePool (gConfirmError);
|
||||
SafeFreePool (gPressEnter);
|
||||
SafeFreePool (gEmptyString);
|
||||
SafeFreePool (gAreYouSure);
|
||||
SafeFreePool (gYesResponse);
|
||||
SafeFreePool (gNoResponse);
|
||||
SafeFreePool (gMiniString);
|
||||
SafeFreePool (gPlusString);
|
||||
SafeFreePool (gMinusString);
|
||||
SafeFreePool (gAdjustNumber);
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Update key's help imformation
|
||||
|
||||
@param MenuOption The Menu option
|
||||
@param Selected Whether or not a tag be selected
|
||||
|
||||
@return None
|
||||
|
||||
**/
|
||||
VOID
|
||||
UpdateKeyHelp (
|
||||
IN UI_MENU_OPTION *MenuOption,
|
||||
IN BOOLEAN Selected
|
||||
)
|
||||
{
|
||||
UINTN SecCol;
|
||||
UINTN ThdCol;
|
||||
UINTN LeftColumnOfHelp;
|
||||
UINTN RightColumnOfHelp;
|
||||
UINTN TopRowOfHelp;
|
||||
UINTN BottomRowOfHelp;
|
||||
UINTN StartColumnOfHelp;
|
||||
EFI_SCREEN_DESCRIPTOR LocalScreen;
|
||||
FORM_BROWSER_STATEMENT *Statement;
|
||||
|
||||
CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
|
||||
|
||||
SecCol = LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 3;
|
||||
ThdCol = LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) * 2 / 3;
|
||||
|
||||
StartColumnOfHelp = LocalScreen.LeftColumn + 2;
|
||||
LeftColumnOfHelp = LocalScreen.LeftColumn + 1;
|
||||
RightColumnOfHelp = LocalScreen.RightColumn - 2;
|
||||
TopRowOfHelp = LocalScreen.BottomRow - 4;
|
||||
BottomRowOfHelp = LocalScreen.BottomRow - 3;
|
||||
|
||||
if (gClassOfVfr == EFI_GENERAL_APPLICATION_SUBCLASS) {
|
||||
return ;
|
||||
}
|
||||
|
||||
gST->ConOut->SetAttribute (gST->ConOut, KEYHELP_TEXT | KEYHELP_BACKGROUND);
|
||||
|
||||
Statement = MenuOption->ThisTag;
|
||||
switch (Statement->Operand) {
|
||||
case EFI_IFR_ORDERED_LIST_OP:
|
||||
case EFI_IFR_ONE_OF_OP:
|
||||
case EFI_IFR_NUMERIC_OP:
|
||||
case EFI_IFR_TIME_OP:
|
||||
case EFI_IFR_DATE_OP:
|
||||
ClearLines (LeftColumnOfHelp, RightColumnOfHelp, TopRowOfHelp, BottomRowOfHelp, KEYHELP_TEXT | KEYHELP_BACKGROUND);
|
||||
|
||||
if (!Selected) {
|
||||
if (gClassOfVfr == EFI_SETUP_APPLICATION_SUBCLASS) {
|
||||
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gFunctionOneString);
|
||||
PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString);
|
||||
PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString);
|
||||
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
|
||||
}
|
||||
|
||||
if ((Statement->Operand == EFI_IFR_DATE_OP) ||
|
||||
(Statement->Operand == EFI_IFR_TIME_OP) ||
|
||||
(Statement->Operand == EFI_IFR_NUMERIC_OP && Statement->Step != 0)) {
|
||||
PrintAt (
|
||||
StartColumnOfHelp,
|
||||
BottomRowOfHelp,
|
||||
L"%c%c%c%c%s",
|
||||
ARROW_UP,
|
||||
ARROW_DOWN,
|
||||
ARROW_RIGHT,
|
||||
ARROW_LEFT,
|
||||
gMoveHighlight
|
||||
);
|
||||
PrintStringAt (SecCol, BottomRowOfHelp, gAdjustNumber);
|
||||
} else {
|
||||
PrintAt (StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
|
||||
PrintStringAt (SecCol, BottomRowOfHelp, gEnterString);
|
||||
}
|
||||
} else {
|
||||
PrintStringAt (SecCol, BottomRowOfHelp, gEnterCommitString);
|
||||
|
||||
//
|
||||
// If it is a selected numeric with manual input, display different message
|
||||
//
|
||||
if ((Statement->Operand == EFI_IFR_NUMERIC_OP) && (Statement->Step == 0)) {
|
||||
PrintStringAt (
|
||||
SecCol,
|
||||
TopRowOfHelp,
|
||||
(Statement->Flags & EFI_IFR_DISPLAY_UINT_HEX) ? gHexNumericInput : gDecNumericInput
|
||||
);
|
||||
} else if (Statement->Operand != EFI_IFR_ORDERED_LIST_OP) {
|
||||
PrintAt (StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
|
||||
}
|
||||
|
||||
if (Statement->Operand == EFI_IFR_ORDERED_LIST_OP) {
|
||||
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gPlusString);
|
||||
PrintStringAt (ThdCol, TopRowOfHelp, gMinusString);
|
||||
}
|
||||
|
||||
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_IFR_CHECKBOX_OP:
|
||||
ClearLines (LeftColumnOfHelp, RightColumnOfHelp, TopRowOfHelp, BottomRowOfHelp, KEYHELP_TEXT | KEYHELP_BACKGROUND);
|
||||
|
||||
if (gClassOfVfr == EFI_SETUP_APPLICATION_SUBCLASS) {
|
||||
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gFunctionOneString);
|
||||
PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString);
|
||||
PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString);
|
||||
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
|
||||
}
|
||||
|
||||
PrintAt (StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
|
||||
PrintStringAt (SecCol, BottomRowOfHelp, gToggleCheckBox);
|
||||
break;
|
||||
|
||||
case EFI_IFR_REF_OP:
|
||||
case EFI_IFR_PASSWORD_OP:
|
||||
case EFI_IFR_STRING_OP:
|
||||
case EFI_IFR_TEXT_OP:
|
||||
case EFI_IFR_ACTION_OP:
|
||||
case EFI_IFR_RESET_BUTTON_OP:
|
||||
ClearLines (LeftColumnOfHelp, RightColumnOfHelp, TopRowOfHelp, BottomRowOfHelp, KEYHELP_TEXT | KEYHELP_BACKGROUND);
|
||||
|
||||
if (!Selected) {
|
||||
if (gClassOfVfr == EFI_SETUP_APPLICATION_SUBCLASS) {
|
||||
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gFunctionOneString);
|
||||
PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString);
|
||||
PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString);
|
||||
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
|
||||
}
|
||||
|
||||
PrintAt (StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
|
||||
if (Statement->Operand != EFI_IFR_TEXT_OP) {
|
||||
PrintStringAt (SecCol, BottomRowOfHelp, gEnterString);
|
||||
}
|
||||
} else {
|
||||
if (Statement->Operand != EFI_IFR_REF_OP) {
|
||||
PrintStringAt (
|
||||
(LocalScreen.RightColumn - GetStringWidth (gEnterCommitString) / 2) / 2,
|
||||
BottomRowOfHelp,
|
||||
gEnterCommitString
|
||||
);
|
||||
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
FormUpdateNotify (
|
||||
IN UINT8 PackageType,
|
||||
IN CONST EFI_GUID *PackageGuid,
|
||||
IN CONST EFI_HII_PACKAGE_HEADER *Package,
|
||||
IN EFI_HII_HANDLE Handle,
|
||||
IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType
|
||||
)
|
||||
{
|
||||
mHiiPackageListUpdated = TRUE;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
SetupBrowser (
|
||||
IN OUT UI_MENU_SELECTION *Selection
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Link;
|
||||
EFI_BROWSER_ACTION_REQUEST ActionRequest;
|
||||
EFI_HANDLE NotifyHandle;
|
||||
EFI_HII_VALUE *HiiValue;
|
||||
FORM_BROWSER_STATEMENT *Statement;
|
||||
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
|
||||
|
||||
gMenuRefreshHead = NULL;
|
||||
gResetRequired = FALSE;
|
||||
gNvUpdateRequired = FALSE;
|
||||
|
||||
UiInitMenuList ();
|
||||
|
||||
//
|
||||
// Register notify for Form package update
|
||||
//
|
||||
Status = mHiiDatabase->RegisterPackageNotify (
|
||||
mHiiDatabase,
|
||||
EFI_HII_PACKAGE_FORM,
|
||||
NULL,
|
||||
FormUpdateNotify,
|
||||
EFI_HII_DATABASE_NOTIFY_REMOVE_PACK,
|
||||
&NotifyHandle
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
do {
|
||||
//
|
||||
// Displays the Header and Footer borders
|
||||
//
|
||||
DisplayPageFrame ();
|
||||
|
||||
//
|
||||
// Initialize Selection->Form
|
||||
//
|
||||
if (Selection->FormId == 0) {
|
||||
//
|
||||
// Zero FormId indicates display the first Form in a FormSet
|
||||
//
|
||||
Link = GetFirstNode (&Selection->FormSet->FormListHead);
|
||||
|
||||
Selection->Form = FORM_BROWSER_FORM_FROM_LINK (Link);
|
||||
Selection->FormId = Selection->Form->FormId;
|
||||
} else {
|
||||
Selection->Form = IdToForm (Selection->FormSet, Selection->FormId);
|
||||
}
|
||||
|
||||
//
|
||||
// Load Questions' Value for display
|
||||
//
|
||||
Status = LoadFormConfig (Selection->FormSet, Selection->Form);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Display form
|
||||
//
|
||||
Status = DisplayForm (Selection);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Selected Statement (if press ESC, Selection->Statement will be NULL)
|
||||
//
|
||||
Statement = Selection->Statement;
|
||||
if (Statement != NULL) {
|
||||
if (Statement->QuestionFlags & EFI_IFR_FLAG_RESET_REQUIRED) {
|
||||
gResetRequired = TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// Reset FormPackage update flag
|
||||
//
|
||||
mHiiPackageListUpdated = FALSE;
|
||||
|
||||
if (Statement->QuestionFlags & EFI_IFR_FLAG_CALLBACK && Statement->Operand != EFI_IFR_PASSWORD_OP) {
|
||||
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
|
||||
|
||||
HiiValue = &Statement->HiiValue;
|
||||
if (HiiValue->Type == EFI_IFR_TYPE_STRING) {
|
||||
//
|
||||
// Create String in HII database for Configuration Driver to retrieve
|
||||
//
|
||||
HiiValue->Value.string = NewString ((CHAR16 *) Statement->BufferValue, Selection->FormSet->HiiHandle);
|
||||
}
|
||||
|
||||
ConfigAccess = Selection->FormSet->ConfigAccess;
|
||||
if (ConfigAccess == NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
Status = ConfigAccess->Callback (
|
||||
ConfigAccess,
|
||||
EFI_BROWSER_ACTION_CHANGING,
|
||||
Statement->QuestionId,
|
||||
HiiValue->Type,
|
||||
&HiiValue->Value,
|
||||
&ActionRequest
|
||||
);
|
||||
|
||||
if (HiiValue->Type == EFI_IFR_TYPE_STRING) {
|
||||
//
|
||||
// Clean the String in HII Database
|
||||
//
|
||||
DeleteString (HiiValue->Value.string, Selection->FormSet->HiiHandle);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
switch (ActionRequest) {
|
||||
case EFI_BROWSER_ACTION_REQUEST_RESET:
|
||||
gResetRequired = TRUE;
|
||||
break;
|
||||
|
||||
case EFI_BROWSER_ACTION_REQUEST_SUBMIT:
|
||||
SubmitForm (Selection->FormSet, Selection->Form);
|
||||
break;
|
||||
|
||||
case EFI_BROWSER_ACTION_REQUEST_EXIT:
|
||||
Selection->Action = UI_ACTION_EXIT;
|
||||
gNvUpdateRequired = FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check whether Form Package has been updated during Callback
|
||||
//
|
||||
if (mHiiPackageListUpdated && (Selection->Action == UI_ACTION_REFRESH_FORM)) {
|
||||
//
|
||||
// Force to reparse IFR binary of target Formset
|
||||
//
|
||||
Selection->Action = UI_ACTION_REFRESH_FORMSET;
|
||||
}
|
||||
}
|
||||
} while (Selection->Action == UI_ACTION_REFRESH_FORM);
|
||||
|
||||
//
|
||||
// Unregister notify for Form package update
|
||||
//
|
||||
Status = mHiiDatabase->UnregisterPackageNotify (
|
||||
mHiiDatabase,
|
||||
NotifyHandle
|
||||
);
|
||||
return Status;
|
||||
}
|
331
MdeModulePkg/Universal/SetupBrowserDxe/Print.c
Normal file
331
MdeModulePkg/Universal/SetupBrowserDxe/Print.c
Normal file
@@ -0,0 +1,331 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
Print.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Basic Ascii AvSPrintf() function named VSPrint(). VSPrint() enables very
|
||||
simple implemenation of SPrint() and Print() to support debug.
|
||||
|
||||
You can not Print more than EFI_DRIVER_LIB_MAX_PRINT_BUFFER characters at a
|
||||
time. This makes the implementation very simple.
|
||||
|
||||
VSPrint, Print, SPrint format specification has the follwoing form
|
||||
|
||||
%type
|
||||
|
||||
type:
|
||||
'S','s' - argument is an Unicode string
|
||||
'c' - argument is an ascii character
|
||||
'%' - Print a %
|
||||
|
||||
|
||||
**/
|
||||
|
||||
//@MT:#include "Tiano.h"
|
||||
//@MT:#include "EfiDriverLib.h"
|
||||
//@MT:#include "EfiPrintLib.h"
|
||||
//@MT:#include "EfiStdArg.h"
|
||||
//@MT:#include "TianoHii.h"
|
||||
#include "Setup.h"
|
||||
|
||||
UINTN
|
||||
ValueToString (
|
||||
IN OUT CHAR16 *Buffer,
|
||||
IN BOOLEAN Flags,
|
||||
IN INT64 Value
|
||||
);
|
||||
|
||||
UINTN
|
||||
PrintInternal (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Out,
|
||||
IN CHAR16 *fmt,
|
||||
IN VA_LIST args
|
||||
)
|
||||
//
|
||||
// Display string worker for: Print, PrintAt, IPrint, IPrintAt
|
||||
//
|
||||
{
|
||||
CHAR16 *Buffer;
|
||||
CHAR16 *BackupBuffer;
|
||||
UINTN Index;
|
||||
UINTN PreviousIndex;
|
||||
|
||||
//
|
||||
// For now, allocate an arbitrarily long buffer
|
||||
//
|
||||
Buffer = AllocateZeroPool (0x10000);
|
||||
BackupBuffer = AllocateZeroPool (0x10000);
|
||||
ASSERT (Buffer);
|
||||
ASSERT (BackupBuffer);
|
||||
|
||||
if (Column != (UINTN) -1) {
|
||||
Out->SetCursorPosition (Out, Column, Row);
|
||||
}
|
||||
|
||||
UnicodeVSPrint (Buffer, 0x10000, fmt, args);
|
||||
|
||||
Out->Mode->Attribute = Out->Mode->Attribute & 0x7f;
|
||||
|
||||
Out->SetAttribute (Out, Out->Mode->Attribute);
|
||||
|
||||
Index = 0;
|
||||
PreviousIndex = 0;
|
||||
|
||||
do {
|
||||
for (; (Buffer[Index] != NARROW_CHAR) && (Buffer[Index] != WIDE_CHAR) && (Buffer[Index] != 0); Index++) {
|
||||
BackupBuffer[Index] = Buffer[Index];
|
||||
}
|
||||
|
||||
if (Buffer[Index] == 0) {
|
||||
break;
|
||||
}
|
||||
//
|
||||
// Null-terminate the temporary string
|
||||
//
|
||||
BackupBuffer[Index] = 0;
|
||||
|
||||
//
|
||||
// Print this out, we are about to switch widths
|
||||
//
|
||||
Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
|
||||
|
||||
//
|
||||
// Preserve the current index + 1, since this is where we will start printing from next
|
||||
//
|
||||
PreviousIndex = Index + 1;
|
||||
|
||||
//
|
||||
// We are at a narrow or wide character directive. Set attributes and strip it and print it
|
||||
//
|
||||
if (Buffer[Index] == NARROW_CHAR) {
|
||||
//
|
||||
// Preserve bits 0 - 6 and zero out the rest
|
||||
//
|
||||
Out->Mode->Attribute = Out->Mode->Attribute & 0x7f;
|
||||
Out->SetAttribute (Out, Out->Mode->Attribute);
|
||||
} else {
|
||||
//
|
||||
// Must be wide, set bit 7 ON
|
||||
//
|
||||
Out->Mode->Attribute = Out->Mode->Attribute | EFI_WIDE_ATTRIBUTE;
|
||||
Out->SetAttribute (Out, Out->Mode->Attribute);
|
||||
}
|
||||
|
||||
Index++;
|
||||
|
||||
} while (Buffer[Index] != 0);
|
||||
|
||||
//
|
||||
// We hit the end of the string - print it
|
||||
//
|
||||
Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
|
||||
|
||||
gBS->FreePool (Buffer);
|
||||
gBS->FreePool (BackupBuffer);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prints a formatted unicode string to the default console
|
||||
|
||||
@param fmt Format string
|
||||
|
||||
@return Length of string printed to the console
|
||||
|
||||
**/
|
||||
UINTN
|
||||
ConsolePrint (
|
||||
IN CHAR16 *fmt,
|
||||
...
|
||||
)
|
||||
{
|
||||
VA_LIST args;
|
||||
|
||||
VA_START (args, fmt);
|
||||
return PrintInternal ((UINTN) -1, (UINTN) -1, gST->ConOut, fmt, args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prints a unicode string to the default console,
|
||||
using L"%s" format.
|
||||
|
||||
@param String String pointer.
|
||||
|
||||
@return Length of string printed to the console
|
||||
|
||||
**/
|
||||
UINTN
|
||||
PrintString (
|
||||
CHAR16 *String
|
||||
)
|
||||
{
|
||||
return ConsolePrint (L"%s", String);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prints a chracter to the default console,
|
||||
using L"%c" format.
|
||||
|
||||
@param Character Character to print.
|
||||
|
||||
@return Length of string printed to the console.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
PrintChar (
|
||||
CHAR16 Character
|
||||
)
|
||||
{
|
||||
return ConsolePrint (L"%c", Character);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prints a formatted unicode string to the default console, at
|
||||
the supplied cursor position
|
||||
|
||||
@param Row The cursor position to print the string at
|
||||
@param fmt Format string
|
||||
|
||||
@return Length of string printed to the console
|
||||
|
||||
**/
|
||||
UINTN
|
||||
PrintAt (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
IN CHAR16 *fmt,
|
||||
...
|
||||
)
|
||||
{
|
||||
VA_LIST args;
|
||||
|
||||
VA_START (args, fmt);
|
||||
return PrintInternal (Column, Row, gST->ConOut, fmt, args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prints a unicode string to the default console, at
|
||||
the supplied cursor position, using L"%s" format.
|
||||
|
||||
@param Row The cursor position to print the string at
|
||||
@param String String pointer.
|
||||
|
||||
@return Length of string printed to the console
|
||||
|
||||
**/
|
||||
UINTN
|
||||
PrintStringAt (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
CHAR16 *String
|
||||
)
|
||||
{
|
||||
return PrintAt (Column, Row, L"%s", String);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prints a chracter to the default console, at
|
||||
the supplied cursor position, using L"%c" format.
|
||||
|
||||
@param Row The cursor position to print the string at
|
||||
@param Character Character to print.
|
||||
|
||||
@return Length of string printed to the console.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
PrintCharAt (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
CHAR16 Character
|
||||
)
|
||||
{
|
||||
return PrintAt (Column, Row, L"%c", Character);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
VSPrint worker function that prints a Value as a decimal number in Buffer
|
||||
|
||||
@param Buffer Location to place ascii decimal number string of Value.
|
||||
@param Value Decimal value to convert to a string in Buffer.
|
||||
@param Flags Flags to use in printing decimal string, see file header for
|
||||
details.
|
||||
|
||||
@return Number of characters printed.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
ValueToString (
|
||||
IN OUT CHAR16 *Buffer,
|
||||
IN BOOLEAN Flags,
|
||||
IN INT64 Value
|
||||
)
|
||||
{
|
||||
CHAR16 TempBuffer[30];
|
||||
CHAR16 *TempStr;
|
||||
CHAR16 *BufferPtr;
|
||||
UINTN Count;
|
||||
UINTN NumberCount;
|
||||
UINT32 Remainder;
|
||||
BOOLEAN Negative;
|
||||
|
||||
Negative = FALSE;
|
||||
TempStr = TempBuffer;
|
||||
BufferPtr = Buffer;
|
||||
Count = 0;
|
||||
NumberCount = 0;
|
||||
|
||||
if (Value < 0) {
|
||||
Negative = TRUE;
|
||||
Value = -Value;
|
||||
}
|
||||
|
||||
do {
|
||||
Value = (INT64) DivU64x32Remainder ((UINT64) Value, 10, &Remainder);
|
||||
*(TempStr++) = (CHAR16) (Remainder + '0');
|
||||
Count++;
|
||||
NumberCount++;
|
||||
if ((Flags & COMMA_TYPE) == COMMA_TYPE) {
|
||||
if (NumberCount % 3 == 0 && Value != 0) {
|
||||
*(TempStr++) = ',';
|
||||
Count++;
|
||||
}
|
||||
}
|
||||
} while (Value != 0);
|
||||
|
||||
if (Negative) {
|
||||
*(BufferPtr++) = '-';
|
||||
Count++;
|
||||
}
|
||||
|
||||
//
|
||||
// Reverse temp string into Buffer.
|
||||
//
|
||||
while (TempStr != TempBuffer) {
|
||||
*(BufferPtr++) = *(--TempStr);
|
||||
}
|
||||
|
||||
*BufferPtr = 0;
|
||||
return Count;
|
||||
}
|
38
MdeModulePkg/Universal/SetupBrowserDxe/Print.h
Normal file
38
MdeModulePkg/Universal/SetupBrowserDxe/Print.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2004, Intel Corporation
|
||||
All rights reserved. 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
Print.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Private data for Print.c
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _PRINT_H_
|
||||
#define _PRINT_H_
|
||||
|
||||
#define LEFT_JUSTIFY 0x01
|
||||
#define PREFIX_SIGN 0x02
|
||||
#define PREFIX_BLANK 0x04
|
||||
#define COMMA_TYPE 0x08
|
||||
#define LONG_TYPE 0x10
|
||||
#define PREFIX_ZERO 0x20
|
||||
|
||||
//
|
||||
// Largest number of characters that can be printed out.
|
||||
//
|
||||
#define EFI_DRIVER_LIB_MAX_PRINT_BUFFER (80 * 4)
|
||||
|
||||
#endif
|
986
MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c
Normal file
986
MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c
Normal file
@@ -0,0 +1,986 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
ProcessOptions.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Implementation for handling the User Interface option processing.
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "Ui.h"
|
||||
#include "Setup.h"
|
||||
|
||||
|
||||
/**
|
||||
Process Question Config.
|
||||
|
||||
@param Selection The UI menu selection.
|
||||
@param Question The Question to be peocessed.
|
||||
|
||||
@retval EFI_SUCCESS Question Config process success.
|
||||
@retval Other Question Config process fail.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
ProcessQuestionConfig (
|
||||
IN UI_MENU_SELECTION *Selection,
|
||||
IN FORM_BROWSER_STATEMENT *Question
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR16 *ConfigResp;
|
||||
CHAR16 *Progress;
|
||||
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
|
||||
|
||||
if (Question->QuestionConfig == 0) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Get <ConfigResp>
|
||||
//
|
||||
ConfigResp = GetToken (Question->QuestionConfig, Selection->FormSet->HiiHandle);
|
||||
if (ConfigResp == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
//
|
||||
// Send config to Configuration Driver
|
||||
//
|
||||
ConfigAccess = Selection->FormSet->ConfigAccess;
|
||||
if (ConfigAccess == NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
Status = ConfigAccess->RouteConfig (
|
||||
ConfigAccess,
|
||||
ConfigResp,
|
||||
&Progress
|
||||
);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Search an Option of a Question by its value.
|
||||
|
||||
@param Question The Question
|
||||
@param OptionValue Value for Option to be searched.
|
||||
|
||||
@retval Pointer Pointer to the found Option.
|
||||
@retval NULL Option not found.
|
||||
|
||||
**/
|
||||
QUESTION_OPTION *
|
||||
ValueToOption (
|
||||
IN FORM_BROWSER_STATEMENT *Question,
|
||||
IN EFI_HII_VALUE *OptionValue
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Link;
|
||||
QUESTION_OPTION *Option;
|
||||
|
||||
Link = GetFirstNode (&Question->OptionListHead);
|
||||
while (!IsNull (&Question->OptionListHead, Link)) {
|
||||
Option = QUESTION_OPTION_FROM_LINK (Link);
|
||||
|
||||
if (CompareHiiValue (&Option->Value, OptionValue, NULL) == 0) {
|
||||
return Option;
|
||||
}
|
||||
|
||||
Link = GetNextNode (&Question->OptionListHead, Link);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Print Question Value according to it's storage width and display attributes.
|
||||
|
||||
@param Event The event to wait for
|
||||
@param FormattedNumber Buffer for output string.
|
||||
@param BufferSize The FormattedNumber buffer size in bytes.
|
||||
|
||||
@retval EFI_SUCCESS Print success.
|
||||
@retval EFI_BUFFER_TOO_SMALL Buffer size is not enough for formatted number.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
PrintFormattedNumber (
|
||||
IN FORM_BROWSER_STATEMENT *Question,
|
||||
IN OUT CHAR16 *FormattedNumber,
|
||||
IN UINTN BufferSize
|
||||
)
|
||||
{
|
||||
INT64 Value;
|
||||
CHAR16 *Format;
|
||||
EFI_HII_VALUE *QuestionValue;
|
||||
|
||||
if (BufferSize < (21 * sizeof (CHAR16))) {
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
QuestionValue = &Question->HiiValue;
|
||||
|
||||
Value = (INT64) QuestionValue->Value.u64;
|
||||
switch (Question->Flags & EFI_IFR_DISPLAY) {
|
||||
case EFI_IFR_DISPLAY_INT_DEC:
|
||||
switch (QuestionValue->Type) {
|
||||
case EFI_IFR_NUMERIC_SIZE_1:
|
||||
Value = (INT64) ((INT8) QuestionValue->Value.u8);
|
||||
break;
|
||||
|
||||
case EFI_IFR_NUMERIC_SIZE_2:
|
||||
Value = (INT64) ((INT16) QuestionValue->Value.u16);
|
||||
break;
|
||||
|
||||
case EFI_IFR_NUMERIC_SIZE_4:
|
||||
Value = (INT64) ((INT32) QuestionValue->Value.u32);
|
||||
break;
|
||||
|
||||
case EFI_IFR_NUMERIC_SIZE_8:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (Value < 0) {
|
||||
Value = -Value;
|
||||
Format = L"-%ld";
|
||||
} else {
|
||||
Format = L"%ld";
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_IFR_DISPLAY_UINT_DEC:
|
||||
Format = L"%ld";
|
||||
break;
|
||||
|
||||
case EFI_IFR_DISPLAY_UINT_HEX:
|
||||
Format = L"%lx";
|
||||
break;
|
||||
|
||||
default:
|
||||
return EFI_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
UnicodeSPrint (FormattedNumber, BufferSize, Format, Value);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Password may be stored as encrypted by Configuration Driver. When change a
|
||||
password, user will be challenged with old password. To validate user input old
|
||||
password, we will send the clear text to Configuration Driver via Callback().
|
||||
Configuration driver is responsible to check the passed in password and return
|
||||
the validation result. If validation pass, state machine in password Callback()
|
||||
will transit from BROWSER_STATE_VALIDATE_PASSWORD to BROWSER_STATE_SET_PASSWORD.
|
||||
After user type in new password twice, Callback() will be invoked to send the
|
||||
new password to Configuration Driver.
|
||||
|
||||
@param Selection Pointer to UI_MENU_SELECTION.
|
||||
@param MenuOption The MenuOption for this password Question.
|
||||
@param String The clear text of password.
|
||||
|
||||
@retval EFI_NOT_AVAILABLE_YET Callback() request to terminate password input.
|
||||
@return In state of BROWSER_STATE_VALIDATE_PASSWORD:
|
||||
@retval EFI_SUCCESS Password correct, Browser will prompt for new
|
||||
password.
|
||||
@retval EFI_NOT_READY Password incorrect, Browser will show error
|
||||
message.
|
||||
@retval Other Browser will do nothing.
|
||||
@return In state of BROWSER_STATE_SET_PASSWORD:
|
||||
@retval EFI_SUCCESS Set password success.
|
||||
@retval Other Set password failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
PasswordCallback (
|
||||
IN UI_MENU_SELECTION *Selection,
|
||||
IN UI_MENU_OPTION *MenuOption,
|
||||
IN CHAR16 *String
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
|
||||
EFI_BROWSER_ACTION_REQUEST ActionRequest;
|
||||
EFI_HII_VALUE *QuestionValue;
|
||||
|
||||
QuestionValue = &MenuOption->ThisTag->HiiValue;
|
||||
ConfigAccess = Selection->FormSet->ConfigAccess;
|
||||
if (ConfigAccess == NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Prepare password string in HII database
|
||||
//
|
||||
if (String != NULL) {
|
||||
QuestionValue->Value.string = NewString (String, Selection->FormSet->HiiHandle);
|
||||
} else {
|
||||
QuestionValue->Value.string = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Send password to Configuration Driver for validation
|
||||
//
|
||||
Status = ConfigAccess->Callback (
|
||||
ConfigAccess,
|
||||
EFI_BROWSER_ACTION_CHANGING,
|
||||
MenuOption->ThisTag->QuestionId,
|
||||
QuestionValue->Type,
|
||||
&QuestionValue->Value,
|
||||
&ActionRequest
|
||||
);
|
||||
|
||||
//
|
||||
// Remove password string from HII database
|
||||
//
|
||||
if (String != NULL) {
|
||||
DeleteString (QuestionValue->Value.string, Selection->FormSet->HiiHandle);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Display error message for invalid password.
|
||||
|
||||
None.
|
||||
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
PasswordInvalid (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_INPUT_KEY Key;
|
||||
|
||||
//
|
||||
// Invalid password, prompt error message
|
||||
//
|
||||
do {
|
||||
CreateDialog (4, TRUE, 0, NULL, &Key, gEmptyString, gPassowordInvalid, gPressEnter, gEmptyString);
|
||||
} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Process a Question's Option (whether selected or un-selected).
|
||||
|
||||
@param Selection Pointer to UI_MENU_SELECTION.
|
||||
@param MenuOption The MenuOption for this Question.
|
||||
@param Selected TRUE: if Question is selected.
|
||||
@param OptionString Pointer of the Option String to be displayed.
|
||||
|
||||
@retval EFI_SUCCESS Question Option process success.
|
||||
@retval Other Question Option process fail.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
ProcessOptions (
|
||||
IN UI_MENU_SELECTION *Selection,
|
||||
IN UI_MENU_OPTION *MenuOption,
|
||||
IN BOOLEAN Selected,
|
||||
OUT CHAR16 **OptionString
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR16 *StringPtr;
|
||||
CHAR16 *TempString;
|
||||
UINTN Index;
|
||||
FORM_BROWSER_STATEMENT *Question;
|
||||
CHAR16 FormattedNumber[21];
|
||||
UINT16 Number;
|
||||
CHAR16 Character[2];
|
||||
EFI_INPUT_KEY Key;
|
||||
UINTN BufferSize;
|
||||
QUESTION_OPTION *OneOfOption;
|
||||
LIST_ENTRY *Link;
|
||||
EFI_HII_VALUE HiiValue;
|
||||
EFI_HII_VALUE *QuestionValue;
|
||||
BOOLEAN Suppress;
|
||||
UINT16 Maximum;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
StringPtr = NULL;
|
||||
Character[1] = L'\0';
|
||||
*OptionString = NULL;
|
||||
|
||||
ZeroMem (FormattedNumber, 21 * sizeof (CHAR16));
|
||||
BufferSize = (gOptionBlockWidth + 1) * 2 * gScreenDimensions.BottomRow;
|
||||
|
||||
Question = MenuOption->ThisTag;
|
||||
QuestionValue = &Question->HiiValue;
|
||||
Maximum = (UINT16) Question->Maximum;
|
||||
|
||||
switch (Question->Operand) {
|
||||
case EFI_IFR_ORDERED_LIST_OP:
|
||||
//
|
||||
// Initialize Option value array
|
||||
//
|
||||
if (Question->BufferValue[0] == 0) {
|
||||
GetQuestionDefault (Selection->FormSet, Selection->Form, Question, 0);
|
||||
}
|
||||
|
||||
if (Selected) {
|
||||
//
|
||||
// Go ask for input
|
||||
//
|
||||
Status = GetSelectionInputPopUp (Selection, MenuOption);
|
||||
} else {
|
||||
//
|
||||
// We now know how many strings we will have, so we can allocate the
|
||||
// space required for the array or strings.
|
||||
//
|
||||
*OptionString = AllocateZeroPool (Question->MaxContainers * BufferSize);
|
||||
ASSERT (*OptionString);
|
||||
|
||||
HiiValue.Type = EFI_IFR_TYPE_NUM_SIZE_8;
|
||||
HiiValue.Value.u64 = 0;
|
||||
for (Index = 0; Index < Question->MaxContainers; Index++) {
|
||||
HiiValue.Value.u8 = Question->BufferValue[Index];
|
||||
if (HiiValue.Value.u8 == 0) {
|
||||
//
|
||||
// Values for the options in ordered lists should never be a 0
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
OneOfOption = ValueToOption (Question, &HiiValue);
|
||||
if (OneOfOption == NULL) {
|
||||
gBS->FreePool (*OptionString);
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
Suppress = FALSE;
|
||||
if ((OneOfOption->SuppressExpression != NULL) &&
|
||||
(OneOfOption->SuppressExpression->Result.Value.b)) {
|
||||
//
|
||||
// This option is suppressed
|
||||
//
|
||||
Suppress = TRUE;
|
||||
}
|
||||
|
||||
if (!Suppress) {
|
||||
Character[0] = LEFT_ONEOF_DELIMITER;
|
||||
NewStrCat (OptionString[0], Character);
|
||||
StringPtr = GetToken (OneOfOption->Text, Selection->Handle);
|
||||
NewStrCat (OptionString[0], StringPtr);
|
||||
Character[0] = RIGHT_ONEOF_DELIMITER;
|
||||
NewStrCat (OptionString[0], Character);
|
||||
Character[0] = CHAR_CARRIAGE_RETURN;
|
||||
NewStrCat (OptionString[0], Character);
|
||||
|
||||
gBS->FreePool (StringPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_IFR_ONE_OF_OP:
|
||||
if (Selected) {
|
||||
//
|
||||
// Go ask for input
|
||||
//
|
||||
Status = GetSelectionInputPopUp (Selection, MenuOption);
|
||||
} else {
|
||||
*OptionString = AllocateZeroPool (BufferSize);
|
||||
ASSERT (*OptionString);
|
||||
|
||||
OneOfOption = ValueToOption (Question, QuestionValue);
|
||||
if (OneOfOption == NULL) {
|
||||
gBS->FreePool (*OptionString);
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
if ((OneOfOption->SuppressExpression != NULL) &&
|
||||
(OneOfOption->SuppressExpression->Result.Value.b)) {
|
||||
//
|
||||
// This option is suppressed
|
||||
//
|
||||
Suppress = TRUE;
|
||||
} else {
|
||||
Suppress = FALSE;
|
||||
}
|
||||
|
||||
if (Suppress) {
|
||||
//
|
||||
// Current selected option happen to be suppressed,
|
||||
// enforce to select on a non-suppressed option
|
||||
//
|
||||
Link = GetFirstNode (&Question->OptionListHead);
|
||||
while (!IsNull (&Question->OptionListHead, Link)) {
|
||||
OneOfOption = QUESTION_OPTION_FROM_LINK (Link);
|
||||
|
||||
if ((OneOfOption->SuppressExpression == NULL) ||
|
||||
!OneOfOption->SuppressExpression->Result.Value.b) {
|
||||
Suppress = FALSE;
|
||||
CopyMem (QuestionValue, &OneOfOption->Value, sizeof (EFI_HII_VALUE));
|
||||
SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);
|
||||
break;
|
||||
}
|
||||
|
||||
Link = GetNextNode (&Question->OptionListHead, Link);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Suppress) {
|
||||
Character[0] = LEFT_ONEOF_DELIMITER;
|
||||
NewStrCat (OptionString[0], Character);
|
||||
StringPtr = GetToken (OneOfOption->Text, Selection->Handle);
|
||||
NewStrCat (OptionString[0], StringPtr);
|
||||
Character[0] = RIGHT_ONEOF_DELIMITER;
|
||||
NewStrCat (OptionString[0], Character);
|
||||
|
||||
gBS->FreePool (StringPtr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_IFR_CHECKBOX_OP:
|
||||
*OptionString = AllocateZeroPool (BufferSize);
|
||||
ASSERT (*OptionString);
|
||||
|
||||
*OptionString[0] = LEFT_CHECKBOX_DELIMITER;
|
||||
|
||||
if (Selected) {
|
||||
//
|
||||
// Since this is a BOOLEAN operation, flip it upon selection
|
||||
//
|
||||
QuestionValue->Value.b = (BOOLEAN) (QuestionValue->Value.b ? FALSE : TRUE);
|
||||
|
||||
//
|
||||
// Perform inconsistent check
|
||||
//
|
||||
Status = ValidateQuestion (Selection->FormSet, Selection->Form, Question, EFI_HII_EXPRESSION_INCONSISTENT_IF);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// Inconsistent check fail, restore Question Value
|
||||
//
|
||||
QuestionValue->Value.b = (BOOLEAN) (QuestionValue->Value.b ? FALSE : TRUE);
|
||||
gBS->FreePool (*OptionString);
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Save Question value
|
||||
//
|
||||
Status = SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);
|
||||
UpdateStatusBar (NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);
|
||||
}
|
||||
|
||||
if (QuestionValue->Value.b) {
|
||||
*(OptionString[0] + 1) = CHECK_ON;
|
||||
} else {
|
||||
*(OptionString[0] + 1) = CHECK_OFF;
|
||||
}
|
||||
*(OptionString[0] + 2) = RIGHT_CHECKBOX_DELIMITER;
|
||||
break;
|
||||
|
||||
case EFI_IFR_NUMERIC_OP:
|
||||
if (Selected) {
|
||||
//
|
||||
// Go ask for input
|
||||
//
|
||||
Status = GetNumericInput (Selection, MenuOption);
|
||||
} else {
|
||||
*OptionString = AllocateZeroPool (BufferSize);
|
||||
ASSERT (*OptionString);
|
||||
|
||||
*OptionString[0] = LEFT_NUMERIC_DELIMITER;
|
||||
|
||||
//
|
||||
// Formatted print
|
||||
//
|
||||
PrintFormattedNumber (Question, FormattedNumber, 21 * sizeof (CHAR16));
|
||||
Number = (UINT16) GetStringWidth (FormattedNumber);
|
||||
CopyMem (OptionString[0] + 1, FormattedNumber, Number);
|
||||
|
||||
*(OptionString[0] + Number / 2) = RIGHT_NUMERIC_DELIMITER;
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_IFR_DATE_OP:
|
||||
if (Selected) {
|
||||
//
|
||||
// This is similar to numerics
|
||||
//
|
||||
Status = GetNumericInput (Selection, MenuOption);
|
||||
} else {
|
||||
*OptionString = AllocateZeroPool (BufferSize);
|
||||
ASSERT (*OptionString);
|
||||
|
||||
switch (MenuOption->Sequence) {
|
||||
case 0:
|
||||
*OptionString[0] = LEFT_NUMERIC_DELIMITER;
|
||||
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);
|
||||
*(OptionString[0] + 6) = DATE_SEPARATOR;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
SetUnicodeMem (OptionString[0], 7, L' ');
|
||||
UnicodeSPrint (OptionString[0] + 7, 21 * sizeof (CHAR16), L"%4d", QuestionValue->Value.date.Year);
|
||||
*(OptionString[0] + 11) = RIGHT_NUMERIC_DELIMITER;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_IFR_TIME_OP:
|
||||
if (Selected) {
|
||||
//
|
||||
// This is similar to numerics
|
||||
//
|
||||
Status = GetNumericInput (Selection, MenuOption);
|
||||
} else {
|
||||
*OptionString = AllocateZeroPool (BufferSize);
|
||||
ASSERT (*OptionString);
|
||||
|
||||
switch (MenuOption->Sequence) {
|
||||
case 0:
|
||||
*OptionString[0] = LEFT_NUMERIC_DELIMITER;
|
||||
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);
|
||||
*(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);
|
||||
*(OptionString[0] + 9) = RIGHT_NUMERIC_DELIMITER;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_IFR_STRING_OP:
|
||||
if (Selected) {
|
||||
StringPtr = AllocateZeroPool ((Maximum + 1) * sizeof (CHAR16));
|
||||
ASSERT (StringPtr);
|
||||
|
||||
Status = ReadString (MenuOption, gPromptForData, StringPtr);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
CopyMem (Question->BufferValue, StringPtr, Maximum * sizeof (CHAR16));
|
||||
SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);
|
||||
|
||||
UpdateStatusBar (NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);
|
||||
}
|
||||
|
||||
gBS->FreePool (StringPtr);
|
||||
} else {
|
||||
*OptionString = AllocateZeroPool (BufferSize);
|
||||
ASSERT (*OptionString);
|
||||
|
||||
if (((CHAR16 *) Question->BufferValue)[0] == 0x0000) {
|
||||
*(OptionString[0]) = '_';
|
||||
} else {
|
||||
if ((Maximum * sizeof (CHAR16)) < BufferSize) {
|
||||
BufferSize = Maximum * sizeof (CHAR16);
|
||||
}
|
||||
CopyMem (OptionString[0], (CHAR16 *) Question->BufferValue, BufferSize);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_IFR_PASSWORD_OP:
|
||||
if (Selected) {
|
||||
StringPtr = AllocateZeroPool ((Maximum + 1) * sizeof (CHAR16));
|
||||
ASSERT (StringPtr);
|
||||
|
||||
//
|
||||
// For interactive passwords, old password is validated by callback
|
||||
//
|
||||
if (Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) {
|
||||
//
|
||||
// Use a NULL password to test whether old password is required
|
||||
//
|
||||
*StringPtr = 0;
|
||||
Status = PasswordCallback (Selection, MenuOption, StringPtr);
|
||||
if (Status == EFI_NOT_AVAILABLE_YET) {
|
||||
//
|
||||
// Callback request to terminate password input
|
||||
//
|
||||
gBS->FreePool (StringPtr);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// Old password exist, ask user for the old password
|
||||
//
|
||||
Status = ReadString (MenuOption, gPromptForPassword, StringPtr);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->FreePool (StringPtr);
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Check user input old password
|
||||
//
|
||||
Status = PasswordCallback (Selection, MenuOption, StringPtr);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Status == EFI_NOT_READY) {
|
||||
//
|
||||
// Typed in old password incorrect
|
||||
//
|
||||
PasswordInvalid ();
|
||||
} else {
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
gBS->FreePool (StringPtr);
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// For non-interactive password, validate old password in local
|
||||
//
|
||||
if (*((CHAR16 *) Question->BufferValue) != 0) {
|
||||
//
|
||||
// There is something there! Prompt for password
|
||||
//
|
||||
Status = ReadString (MenuOption, gPromptForPassword, StringPtr);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->FreePool (StringPtr);
|
||||
return Status;
|
||||
}
|
||||
|
||||
TempString = AllocateCopyPool ((Maximum + 1) * sizeof (CHAR16), Question->BufferValue);
|
||||
TempString[Maximum] = L'\0';
|
||||
|
||||
if (StrCmp (StringPtr, TempString) != 0) {
|
||||
//
|
||||
// Typed in old password incorrect
|
||||
//
|
||||
PasswordInvalid ();
|
||||
|
||||
gBS->FreePool (StringPtr);
|
||||
gBS->FreePool (TempString);
|
||||
return Status;
|
||||
}
|
||||
|
||||
gBS->FreePool (TempString);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Ask for new password
|
||||
//
|
||||
ZeroMem (StringPtr, (Maximum + 1) * sizeof (CHAR16));
|
||||
Status = ReadString (MenuOption, gPromptForNewPassword, StringPtr);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// Reset state machine for interactive password
|
||||
//
|
||||
if (Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) {
|
||||
PasswordCallback (Selection, MenuOption, NULL);
|
||||
}
|
||||
|
||||
gBS->FreePool (StringPtr);
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Confirm new password
|
||||
//
|
||||
TempString = AllocateZeroPool ((Maximum + 1) * sizeof (CHAR16));
|
||||
ASSERT (TempString);
|
||||
Status = ReadString (MenuOption, gConfirmPassword, TempString);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// Reset state machine for interactive password
|
||||
//
|
||||
if (Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) {
|
||||
PasswordCallback (Selection, MenuOption, NULL);
|
||||
}
|
||||
|
||||
gBS->FreePool (StringPtr);
|
||||
gBS->FreePool (TempString);
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Compare two typed-in new passwords
|
||||
//
|
||||
if (StrCmp (StringPtr, TempString) == 0) {
|
||||
//
|
||||
// Two password match, send it to Configuration Driver
|
||||
//
|
||||
if (Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) {
|
||||
PasswordCallback (Selection, MenuOption, StringPtr);
|
||||
} else {
|
||||
CopyMem (Question->BufferValue, StringPtr, Maximum * sizeof (CHAR16));
|
||||
SetQuestionValue (Selection->FormSet, Selection->Form, Question, FALSE);
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// Reset state machine for interactive password
|
||||
//
|
||||
if (Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) {
|
||||
PasswordCallback (Selection, MenuOption, NULL);
|
||||
}
|
||||
|
||||
//
|
||||
// Two password mismatch, prompt error message
|
||||
//
|
||||
do {
|
||||
CreateDialog (4, TRUE, 0, NULL, &Key, gEmptyString, gConfirmError, gPressEnter, gEmptyString);
|
||||
} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
|
||||
}
|
||||
|
||||
gBS->FreePool (TempString);
|
||||
gBS->FreePool (StringPtr);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Process the help string: Split StringPtr to several lines of strings stored in
|
||||
FormattedString and the glyph width of each line cannot exceed gHelpBlockWidth.
|
||||
|
||||
@param StringPtr The entire help string.
|
||||
@param MenuOption The MenuOption for this Question.
|
||||
@param RowCount TRUE: if Question is selected.
|
||||
@param OptionString Pointer of the Option String to be displayed.
|
||||
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
ProcessHelpString (
|
||||
IN CHAR16 *StringPtr,
|
||||
OUT CHAR16 **FormattedString,
|
||||
IN UINTN RowCount
|
||||
)
|
||||
{
|
||||
CONST UINTN BlockWidth = (UINTN) gHelpBlockWidth - 1;
|
||||
UINTN AllocateSize;
|
||||
//
|
||||
// [PrevCurrIndex, CurrIndex) forms a range of a screen-line
|
||||
//
|
||||
UINTN CurrIndex;
|
||||
UINTN PrevCurrIndex;
|
||||
UINTN LineCount;
|
||||
UINTN VirtualLineCount;
|
||||
//
|
||||
// GlyphOffset stores glyph width of current screen-line
|
||||
//
|
||||
UINTN GlyphOffset;
|
||||
//
|
||||
// GlyphWidth equals to 2 if we meet width directive
|
||||
//
|
||||
UINTN GlyphWidth;
|
||||
//
|
||||
// during scanning, we remember the position of last space character
|
||||
// in case that if next word cannot put in current line, we could restore back to the position
|
||||
// of last space character
|
||||
// while we should also remmeber the glyph width of the last space character for restoring
|
||||
//
|
||||
UINTN LastSpaceIndex;
|
||||
UINTN LastSpaceGlyphWidth;
|
||||
//
|
||||
// every time we begin to form a new screen-line, we should remember glyph width of single character
|
||||
// of last line
|
||||
//
|
||||
UINTN LineStartGlyphWidth;
|
||||
UINTN *IndexArray;
|
||||
UINTN *OldIndexArray;
|
||||
|
||||
//
|
||||
// every three elements of IndexArray form a screen-line of string:[ IndexArray[i*3], IndexArray[i*3+1] )
|
||||
// IndexArray[i*3+2] stores the initial glyph width of single character. to save this is because we want
|
||||
// to bring the width directive of the last line to current screen-line.
|
||||
// e.g.: "\wideabcde ... fghi", if "fghi" also has width directive but is splitted to the next screen-line
|
||||
// different from that of "\wideabcde", we should remember the width directive.
|
||||
//
|
||||
AllocateSize = 0x20;
|
||||
IndexArray = AllocatePool (AllocateSize * sizeof (UINTN) * 3);
|
||||
|
||||
if (*FormattedString != NULL) {
|
||||
gBS->FreePool (*FormattedString);
|
||||
*FormattedString = NULL;
|
||||
}
|
||||
|
||||
for (PrevCurrIndex = 0, CurrIndex = 0, LineCount = 0, LastSpaceIndex = 0,
|
||||
IndexArray[0] = 0, GlyphWidth = 1, GlyphOffset = 0, LastSpaceGlyphWidth = 1, LineStartGlyphWidth = 1;
|
||||
(StringPtr[CurrIndex] != CHAR_NULL);
|
||||
CurrIndex ++) {
|
||||
|
||||
if (LineCount == AllocateSize) {
|
||||
AllocateSize += 0x10;
|
||||
OldIndexArray = IndexArray;
|
||||
IndexArray = AllocatePool (AllocateSize * sizeof (UINTN) * 3);
|
||||
CopyMem (IndexArray, OldIndexArray, LineCount * sizeof (UINTN) * 3);
|
||||
gBS->FreePool (OldIndexArray);
|
||||
}
|
||||
switch (StringPtr[CurrIndex]) {
|
||||
|
||||
case NARROW_CHAR:
|
||||
case WIDE_CHAR:
|
||||
GlyphWidth = ((StringPtr[CurrIndex] == WIDE_CHAR) ? 2 : 1);
|
||||
if (CurrIndex == 0) {
|
||||
LineStartGlyphWidth = GlyphWidth;
|
||||
}
|
||||
break;
|
||||
|
||||
//
|
||||
// char is '\n'
|
||||
// "\r\n" isn't handled here, handled by case CHAR_CARRIAGE_RETURN
|
||||
//
|
||||
case CHAR_LINEFEED:
|
||||
//
|
||||
// Store a range of string as a line
|
||||
//
|
||||
IndexArray[LineCount*3] = PrevCurrIndex;
|
||||
IndexArray[LineCount*3+1] = CurrIndex;
|
||||
IndexArray[LineCount*3+2] = LineStartGlyphWidth;
|
||||
LineCount ++;
|
||||
//
|
||||
// Reset offset and save begin position of line
|
||||
//
|
||||
GlyphOffset = 0;
|
||||
LineStartGlyphWidth = GlyphWidth;
|
||||
PrevCurrIndex = CurrIndex + 1;
|
||||
break;
|
||||
|
||||
//
|
||||
// char is '\r'
|
||||
// "\r\n" and "\r" both are handled here
|
||||
//
|
||||
case CHAR_CARRIAGE_RETURN:
|
||||
if (StringPtr[CurrIndex + 1] == CHAR_LINEFEED) {
|
||||
//
|
||||
// next char is '\n'
|
||||
//
|
||||
IndexArray[LineCount*3] = PrevCurrIndex;
|
||||
IndexArray[LineCount*3+1] = CurrIndex;
|
||||
IndexArray[LineCount*3+2] = LineStartGlyphWidth;
|
||||
LineCount ++;
|
||||
CurrIndex ++;
|
||||
}
|
||||
GlyphOffset = 0;
|
||||
LineStartGlyphWidth = GlyphWidth;
|
||||
PrevCurrIndex = CurrIndex + 1;
|
||||
break;
|
||||
|
||||
//
|
||||
// char is space or other char
|
||||
//
|
||||
default:
|
||||
GlyphOffset += GlyphWidth;
|
||||
if (GlyphOffset >= BlockWidth) {
|
||||
if (LastSpaceIndex > PrevCurrIndex) {
|
||||
//
|
||||
// LastSpaceIndex points to space inside current screen-line,
|
||||
// restore to LastSpaceIndex
|
||||
// (Otherwise the word is too long to fit one screen-line, just cut it)
|
||||
//
|
||||
CurrIndex = LastSpaceIndex;
|
||||
GlyphWidth = LastSpaceGlyphWidth;
|
||||
} else if (GlyphOffset > BlockWidth) {
|
||||
//
|
||||
// the word is too long to fit one screen-line and we don't get the chance
|
||||
// of GlyphOffset == BlockWidth because GlyphWidth = 2
|
||||
//
|
||||
CurrIndex --;
|
||||
}
|
||||
|
||||
IndexArray[LineCount*3] = PrevCurrIndex;
|
||||
IndexArray[LineCount*3+1] = CurrIndex + 1;
|
||||
IndexArray[LineCount*3+2] = LineStartGlyphWidth;
|
||||
LineStartGlyphWidth = GlyphWidth;
|
||||
LineCount ++;
|
||||
//
|
||||
// Reset offset and save begin position of line
|
||||
//
|
||||
GlyphOffset = 0;
|
||||
PrevCurrIndex = CurrIndex + 1;
|
||||
}
|
||||
|
||||
//
|
||||
// LastSpaceIndex: remember position of last space
|
||||
//
|
||||
if (StringPtr[CurrIndex] == CHAR_SPACE) {
|
||||
LastSpaceIndex = CurrIndex;
|
||||
LastSpaceGlyphWidth = GlyphWidth;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (GlyphOffset > 0) {
|
||||
IndexArray[LineCount*3] = PrevCurrIndex;
|
||||
IndexArray[LineCount*3+1] = CurrIndex;
|
||||
IndexArray[LineCount*3+2] = GlyphWidth;
|
||||
LineCount ++;
|
||||
}
|
||||
|
||||
if (LineCount == 0) {
|
||||
//
|
||||
// in case we meet null string
|
||||
//
|
||||
IndexArray[0] = 0;
|
||||
IndexArray[1] = 1;
|
||||
//
|
||||
// we assume null string's glyph width is 1
|
||||
//
|
||||
IndexArray[1] = 1;
|
||||
LineCount ++;
|
||||
}
|
||||
|
||||
VirtualLineCount = RowCount * (LineCount / RowCount + (LineCount % RowCount > 0));
|
||||
*FormattedString = AllocateZeroPool (VirtualLineCount * (BlockWidth + 1) * sizeof (CHAR16) * 2);
|
||||
|
||||
for (CurrIndex = 0; CurrIndex < LineCount; CurrIndex ++) {
|
||||
*(*FormattedString + CurrIndex * 2 * (BlockWidth + 1)) = (CHAR16) ((IndexArray[CurrIndex*3+2] == 2) ? WIDE_CHAR : NARROW_CHAR);
|
||||
StrnCpy (
|
||||
*FormattedString + CurrIndex * 2 * (BlockWidth + 1) + 1,
|
||||
StringPtr + IndexArray[CurrIndex*3],
|
||||
IndexArray[CurrIndex*3+1]-IndexArray[CurrIndex*3]
|
||||
);
|
||||
}
|
||||
|
||||
gBS->FreePool (IndexArray);
|
||||
}
|
243
MdeModulePkg/Universal/SetupBrowserDxe/R8Lib.c
Normal file
243
MdeModulePkg/Universal/SetupBrowserDxe/R8Lib.c
Normal file
@@ -0,0 +1,243 @@
|
||||
/**@file
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
|
||||
All rights reserved. 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "Setup.h"
|
||||
|
||||
CHAR16
|
||||
NibbleToHexChar (
|
||||
IN UINT8 Nibble
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Converts the low nibble of a byte to hex unicode character.
|
||||
|
||||
Arguments:
|
||||
Nibble - lower nibble of a byte.
|
||||
|
||||
Returns:
|
||||
Hex unicode character.
|
||||
|
||||
--*/
|
||||
{
|
||||
Nibble &= 0x0F;
|
||||
if (Nibble <= 0x9) {
|
||||
return (CHAR16)(Nibble + L'0');
|
||||
}
|
||||
|
||||
return (CHAR16)(Nibble - 0xA + L'A');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Converts binary buffer to Unicode string.
|
||||
At a minimum, any blob of data could be represented as a hex string.
|
||||
|
||||
@param Str Pointer to the string.
|
||||
@param HexStringBufferLength Length in bytes of buffer to hold the hex string.
|
||||
Includes tailing '\0' character. If routine return
|
||||
with EFI_SUCCESS, containing length of hex string
|
||||
buffer. If routine return with
|
||||
EFI_BUFFER_TOO_SMALL, containg length of hex
|
||||
string buffer desired.
|
||||
@param Buf Buffer to be converted from.
|
||||
@param Len Length in bytes of the buffer to be converted.
|
||||
|
||||
@retval EFI_SUCCESS Routine success.
|
||||
@retval EFI_BUFFER_TOO_SMALL The hex string buffer is too small.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
R8_BufToHexString (
|
||||
IN OUT CHAR16 *Str,
|
||||
IN OUT UINTN *HexStringBufferLength,
|
||||
IN UINT8 *Buf,
|
||||
IN UINTN Len
|
||||
)
|
||||
{
|
||||
//
|
||||
// Porting Guide:
|
||||
// This library interface is simply obsolete.
|
||||
// Include the source code to user code.
|
||||
//
|
||||
UINTN Idx;
|
||||
UINT8 Byte;
|
||||
UINTN StrLen;
|
||||
|
||||
//
|
||||
// Make sure string is either passed or allocate enough.
|
||||
// It takes 2 Unicode characters (4 bytes) to represent 1 byte of the binary buffer.
|
||||
// Plus the Unicode termination character.
|
||||
//
|
||||
StrLen = Len * 2;
|
||||
if (StrLen > ((*HexStringBufferLength) - 1)) {
|
||||
*HexStringBufferLength = StrLen + 1;
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
*HexStringBufferLength = StrLen + 1;
|
||||
//
|
||||
// Ends the string.
|
||||
//
|
||||
Str[StrLen] = L'\0';
|
||||
|
||||
for (Idx = 0; Idx < Len; Idx++) {
|
||||
|
||||
Byte = Buf[Idx];
|
||||
Str[StrLen - 1 - Idx * 2] = NibbleToHexChar (Byte);
|
||||
Str[StrLen - 2 - Idx * 2] = NibbleToHexChar ((UINT8)(Byte >> 4));
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Converts Unicode string to binary buffer.
|
||||
The conversion may be partial.
|
||||
The first character in the string that is not hex digit stops the conversion.
|
||||
At a minimum, any blob of data could be represented as a hex string.
|
||||
|
||||
@param Buf Pointer to buffer that receives the data.
|
||||
@param Len Length in bytes of the buffer to hold converted
|
||||
data. If routine return with EFI_SUCCESS,
|
||||
containing length of converted data. If routine
|
||||
return with EFI_BUFFER_TOO_SMALL, containg length
|
||||
of buffer desired.
|
||||
@param Str String to be converted from.
|
||||
@param ConvertedStrLen Length of the Hex String consumed.
|
||||
|
||||
@retval EFI_SUCCESS Routine Success.
|
||||
@retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold converted data.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
R8_HexStringToBuf (
|
||||
IN OUT UINT8 *Buf,
|
||||
IN OUT UINTN *Len,
|
||||
IN CHAR16 *Str,
|
||||
OUT UINTN *ConvertedStrLen OPTIONAL
|
||||
)
|
||||
{
|
||||
//
|
||||
// Porting Guide:
|
||||
// This library interface is simply obsolete.
|
||||
// Include the source code to user code.
|
||||
//
|
||||
|
||||
UINTN HexCnt;
|
||||
UINTN Idx;
|
||||
UINTN BufferLength;
|
||||
UINT8 Digit;
|
||||
UINT8 Byte;
|
||||
|
||||
//
|
||||
// Find out how many hex characters the string has.
|
||||
//
|
||||
for (Idx = 0, HexCnt = 0; R8_IsHexDigit (&Digit, Str[Idx]); Idx++, HexCnt++);
|
||||
|
||||
if (HexCnt == 0) {
|
||||
*Len = 0;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
//
|
||||
// Two Unicode characters make up 1 buffer byte. Round up.
|
||||
//
|
||||
BufferLength = (HexCnt + 1) / 2;
|
||||
|
||||
//
|
||||
// Test if buffer is passed enough.
|
||||
//
|
||||
if (BufferLength > (*Len)) {
|
||||
*Len = BufferLength;
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
*Len = BufferLength;
|
||||
|
||||
for (Idx = 0; Idx < HexCnt; Idx++) {
|
||||
|
||||
R8_IsHexDigit (&Digit, Str[HexCnt - 1 - Idx]);
|
||||
|
||||
//
|
||||
// For odd charaters, write the lower nibble for each buffer byte,
|
||||
// and for even characters, the upper nibble.
|
||||
//
|
||||
if ((Idx & 1) == 0) {
|
||||
Byte = Digit;
|
||||
} else {
|
||||
Byte = Buf[Idx / 2];
|
||||
Byte &= 0x0F;
|
||||
Byte = (UINT8) (Byte | Digit << 4);
|
||||
}
|
||||
|
||||
Buf[Idx / 2] = Byte;
|
||||
}
|
||||
|
||||
if (ConvertedStrLen != NULL) {
|
||||
*ConvertedStrLen = HexCnt;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Determines if a Unicode character is a hexadecimal digit.
|
||||
The test is case insensitive.
|
||||
|
||||
@param Digit Pointer to byte that receives the value of the hex
|
||||
character.
|
||||
@param Char Unicode character to test.
|
||||
|
||||
@retval TRUE If the character is a hexadecimal digit.
|
||||
@retval FALSE Otherwise.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
R8_IsHexDigit (
|
||||
OUT UINT8 *Digit,
|
||||
IN CHAR16 Char
|
||||
)
|
||||
{
|
||||
//
|
||||
// Porting Guide:
|
||||
// This library interface is simply obsolete.
|
||||
// Include the source code to user code.
|
||||
//
|
||||
|
||||
if ((Char >= L'0') && (Char <= L'9')) {
|
||||
*Digit = (UINT8) (Char - L'0');
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ((Char >= L'A') && (Char <= L'F')) {
|
||||
*Digit = (UINT8) (Char - L'A' + 0x0A);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ((Char >= L'a') && (Char <= L'f')) {
|
||||
*Digit = (UINT8) (Char - L'a' + 0x0A);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
97
MdeModulePkg/Universal/SetupBrowserDxe/R8Lib.h
Normal file
97
MdeModulePkg/Universal/SetupBrowserDxe/R8Lib.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/**@file
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
|
||||
All rights reserved. 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
|
||||
**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Converts binary buffer to Unicode string.
|
||||
At a minimum, any blob of data could be represented as a hex string.
|
||||
|
||||
@param Str Pointer to the string.
|
||||
@param HexStringBufferLength Length in bytes of buffer to hold the hex string.
|
||||
Includes tailing '\0' character. If routine return
|
||||
with EFI_SUCCESS, containing length of hex string
|
||||
buffer. If routine return with
|
||||
EFI_BUFFER_TOO_SMALL, containg length of hex
|
||||
string buffer desired.
|
||||
@param Buf Buffer to be converted from.
|
||||
@param Len Length in bytes of the buffer to be converted.
|
||||
|
||||
@retval EFI_SUCCESS Routine success.
|
||||
@retval EFI_BUFFER_TOO_SMALL The hex string buffer is too small.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
R8_BufToHexString (
|
||||
IN OUT CHAR16 *Str,
|
||||
IN OUT UINTN *HexStringBufferLength,
|
||||
IN UINT8 *Buf,
|
||||
IN UINTN Len
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Converts Unicode string to binary buffer.
|
||||
The conversion may be partial.
|
||||
The first character in the string that is not hex digit stops the conversion.
|
||||
At a minimum, any blob of data could be represented as a hex string.
|
||||
|
||||
@param Buf Pointer to buffer that receives the data.
|
||||
@param Len Length in bytes of the buffer to hold converted
|
||||
data. If routine return with EFI_SUCCESS,
|
||||
containing length of converted data. If routine
|
||||
return with EFI_BUFFER_TOO_SMALL, containg length
|
||||
of buffer desired.
|
||||
@param Str String to be converted from.
|
||||
@param ConvertedStrLen Length of the Hex String consumed.
|
||||
|
||||
@retval EFI_SUCCESS Routine Success.
|
||||
@retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold converted data.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
R8_HexStringToBuf (
|
||||
IN OUT UINT8 *Buf,
|
||||
IN OUT UINTN *Len,
|
||||
IN CHAR16 *Str,
|
||||
OUT UINTN *ConvertedStrLen OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Determines if a Unicode character is a hexadecimal digit.
|
||||
The test is case insensitive.
|
||||
|
||||
@param Digit Pointer to byte that receives the value of the hex
|
||||
character.
|
||||
@param Char Unicode character to test.
|
||||
|
||||
@retval TRUE If the character is a hexadecimal digit.
|
||||
@retval FALSE Otherwise.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
R8_IsHexDigit (
|
||||
OUT UINT8 *Digit,
|
||||
IN CHAR16 Char
|
||||
)
|
||||
;
|
||||
|
||||
|
2286
MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
Normal file
2286
MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
Normal file
File diff suppressed because it is too large
Load Diff
760
MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
Normal file
760
MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
Normal file
@@ -0,0 +1,760 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
All rights reserved. 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
Setup.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _SETUP_H
|
||||
#define _SETUP_H
|
||||
|
||||
|
||||
#include <PiDxe.h>
|
||||
|
||||
#include <Protocol/Print.h>
|
||||
#include <Protocol/SimpleTextOut.h>
|
||||
#include <Protocol/SimpleTextIn.h>
|
||||
#include <Protocol/FormBrowser2.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/UnicodeCollation.h>
|
||||
#include <Protocol/HiiConfigAccess.h>
|
||||
#include <Protocol/HiiConfigRouting.h>
|
||||
#include <Protocol/HiiDatabase.h>
|
||||
#include <Protocol/HiiString.h>
|
||||
|
||||
#include <MdeModuleHii.h>
|
||||
|
||||
#include <Library/GraphicsLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/IfrSupportLib.h>
|
||||
#include <Library/HiiLib.h>
|
||||
|
||||
#include "R8Lib.h"
|
||||
|
||||
#include "Colors.h"
|
||||
|
||||
//@MT:#include EFI_PROTOCOL_DEFINITION (HiiDatabase)
|
||||
//@MT:#include EFI_PROTOCOL_DEFINITION (HiiString)
|
||||
//@MT:#include EFI_PROTOCOL_DEFINITION (HiiConfigRouting)
|
||||
//@MT:#include EFI_PROTOCOL_DEFINITION (HiiConfigAccess)
|
||||
//@MT:#include EFI_PROTOCOL_DEFINITION (FormBrowser2)
|
||||
|
||||
//@MT:#include EFI_GUID_DEFINITION (GlobalVariable)
|
||||
//@MT:#include EFI_PROTOCOL_DEFINITION (DevicePath)
|
||||
//@MT:#include EFI_PROTOCOL_DEFINITION (SimpleTextOut)
|
||||
//@MT:#include EFI_PROTOCOL_DEFINITION (SimpleTextIn)
|
||||
//@MT:#include EFI_PROTOCOL_DEFINITION (Print)
|
||||
//@MT:#include EFI_PROTOCOL_DEFINITION (UnicodeCollation)
|
||||
|
||||
//
|
||||
// This is the generated header file which includes whatever needs to be exported (strings + IFR)
|
||||
//
|
||||
|
||||
extern UINT8 SetupBrowserStrings[];
|
||||
|
||||
//
|
||||
// Screen definitions
|
||||
//
|
||||
#define BANNER_HEIGHT 6
|
||||
#define BANNER_COLUMNS 3
|
||||
|
||||
#define FRONT_PAGE_HEADER_HEIGHT 6
|
||||
#define NONE_FRONT_PAGE_HEADER_HEIGHT 3
|
||||
#define LEFT_SKIPPED_COLUMNS 4
|
||||
#define FOOTER_HEIGHT 4
|
||||
#define STATUS_BAR_HEIGHT 1
|
||||
#define SCROLL_ARROW_HEIGHT 1
|
||||
#define POPUP_PAD_SPACE_COUNT 5
|
||||
#define POPUP_FRAME_WIDTH 2
|
||||
|
||||
//
|
||||
// Definition for function key setting
|
||||
//
|
||||
#define NONE_FUNCTION_KEY_SETTING 0
|
||||
#define DEFAULT_FUNCTION_KEY_SETTING (FUNCTION_ONE | FUNCTION_TWO | FUNCTION_NINE | FUNCTION_TEN)
|
||||
|
||||
#define FUNCTION_ONE (1 << 0)
|
||||
#define FUNCTION_TWO (1 << 1)
|
||||
#define FUNCTION_NINE (1 << 2)
|
||||
#define FUNCTION_TEN (1 << 3)
|
||||
|
||||
typedef struct {
|
||||
EFI_GUID FormSetGuid;
|
||||
UINTN KeySetting;
|
||||
} FUNCTIION_KEY_SETTING;
|
||||
|
||||
//
|
||||
// Character definitions
|
||||
//
|
||||
#define CHAR_SPACE 0x0020
|
||||
#define UPPER_LOWER_CASE_OFFSET 0x20
|
||||
|
||||
//
|
||||
// Time definitions
|
||||
//
|
||||
#define ONE_SECOND 10000000
|
||||
|
||||
//
|
||||
// Display definitions
|
||||
//
|
||||
#define LEFT_HYPER_DELIMITER L'<'
|
||||
#define RIGHT_HYPER_DELIMITER L'>'
|
||||
|
||||
#define LEFT_ONEOF_DELIMITER L'<'
|
||||
#define RIGHT_ONEOF_DELIMITER L'>'
|
||||
|
||||
#define LEFT_NUMERIC_DELIMITER L'['
|
||||
#define RIGHT_NUMERIC_DELIMITER L']'
|
||||
|
||||
#define LEFT_CHECKBOX_DELIMITER L'['
|
||||
#define RIGHT_CHECKBOX_DELIMITER L']'
|
||||
|
||||
#define CHECK_ON L'X'
|
||||
#define CHECK_OFF L' '
|
||||
|
||||
#define TIME_SEPARATOR L':'
|
||||
#define DATE_SEPARATOR L'/'
|
||||
|
||||
#define YES_ANSWER L'Y'
|
||||
#define NO_ANSWER L'N'
|
||||
|
||||
//
|
||||
// This is the Input Error Message
|
||||
//
|
||||
#define INPUT_ERROR 1
|
||||
|
||||
//
|
||||
// This is the NV RAM update required Message
|
||||
//
|
||||
#define NV_UPDATE_REQUIRED 2
|
||||
|
||||
//
|
||||
// Refresh the Status Bar with flags
|
||||
//
|
||||
#define REFRESH_STATUS_BAR 0xff
|
||||
|
||||
//
|
||||
// Incremental string lenght of ConfigRequest
|
||||
//
|
||||
#define CONFIG_REQUEST_STRING_INCREMENTAL 1024
|
||||
|
||||
//
|
||||
// HII value compare result
|
||||
//
|
||||
#define HII_VALUE_UNDEFINED 0
|
||||
#define HII_VALUE_EQUAL 1
|
||||
#define HII_VALUE_LESS_THAN 2
|
||||
#define HII_VALUE_GREATER_THAN 3
|
||||
|
||||
//
|
||||
// Incremental size of stack for expression
|
||||
//
|
||||
#define EXPRESSION_STACK_SIZE_INCREMENT 0x100
|
||||
|
||||
|
||||
#define EFI_SPECIFICATION_ERRATA_VERSION 0
|
||||
|
||||
#define EFI_IFR_SPECIFICATION_VERSION \
|
||||
((((EFI_SPECIFICATION_VERSION) >> 8) & 0xff00) | \
|
||||
(((EFI_SPECIFICATION_VERSION) & 0xf) << 4) | \
|
||||
((EFI_SPECIFICATION_ERRATA_VERSION) & 0xf))
|
||||
|
||||
#define SETUP_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('F', 'B', 'D', 'V')
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
|
||||
EFI_HANDLE Handle;
|
||||
|
||||
//
|
||||
// Produced protocol
|
||||
//
|
||||
EFI_FORM_BROWSER2_PROTOCOL FormBrowser2;
|
||||
EFI_PRINT_PROTOCOL Print;
|
||||
|
||||
} SETUP_DRIVER_PRIVATE_DATA;
|
||||
|
||||
typedef struct {
|
||||
EFI_STRING_ID Banner[BANNER_HEIGHT][BANNER_COLUMNS];
|
||||
} BANNER_DATA;
|
||||
|
||||
//
|
||||
// IFR relative definition
|
||||
//
|
||||
#define EFI_HII_EXPRESSION_INCONSISTENT_IF 0
|
||||
#define EFI_HII_EXPRESSION_NO_SUBMIT_IF 1
|
||||
#define EFI_HII_EXPRESSION_GRAY_OUT_IF 2
|
||||
#define EFI_HII_EXPRESSION_SUPPRESS_IF 3
|
||||
#define EFI_HII_EXPRESSION_DISABLE_IF 4
|
||||
#define EFI_HII_EXPRESSION_VALUE 5
|
||||
#define EFI_HII_EXPRESSION_RULE 6
|
||||
|
||||
#define EFI_HII_VARSTORE_BUFFER 0
|
||||
#define EFI_HII_VARSTORE_NAME_VALUE 1
|
||||
#define EFI_HII_VARSTORE_EFI_VARIABLE 2
|
||||
|
||||
#define FORM_INCONSISTENT_VALIDATION 0
|
||||
#define FORM_NO_SUBMIT_VALIDATION 1
|
||||
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
EFI_IFR_TYPE_VALUE Value;
|
||||
} EFI_HII_VALUE;
|
||||
|
||||
#define NAME_VALUE_NODE_SIGNATURE EFI_SIGNATURE_32 ('N', 'V', 'S', 'T')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
CHAR16 *Name;
|
||||
CHAR16 *Value;
|
||||
CHAR16 *EditValue;
|
||||
} NAME_VALUE_NODE;
|
||||
|
||||
#define NAME_VALUE_NODE_FROM_LINK(a) CR (a, NAME_VALUE_NODE, Link, NAME_VALUE_NODE_SIGNATURE)
|
||||
|
||||
#define FORMSET_STORAGE_SIGNATURE EFI_SIGNATURE_32 ('F', 'S', 'T', 'G')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
UINT8 Type; // Storage type
|
||||
|
||||
UINT16 VarStoreId;
|
||||
EFI_GUID Guid;
|
||||
|
||||
CHAR16 *Name; // For EFI_IFR_VARSTORE
|
||||
UINT16 Size;
|
||||
UINT8 *Buffer;
|
||||
UINT8 *EditBuffer; // Edit copy for Buffer Storage
|
||||
|
||||
LIST_ENTRY NameValueListHead; // List of NAME_VALUE_NODE
|
||||
|
||||
UINT32 Attributes; // For EFI_IFR_VARSTORE_EFI: EFI Variable attribute
|
||||
|
||||
CHAR16 *ConfigHdr; // <ConfigHdr>
|
||||
CHAR16 *ConfigRequest; // <ConfigRequest> = <ConfigHdr> + <RequestElement>
|
||||
UINTN ElementCount; // Number of <RequestElement> in the <ConfigRequest>
|
||||
UINTN SpareStrLen; // Spare length of ConfigRequest string buffer
|
||||
} FORMSET_STORAGE;
|
||||
|
||||
#define FORMSET_STORAGE_FROM_LINK(a) CR (a, FORMSET_STORAGE, Link, FORMSET_STORAGE_SIGNATURE)
|
||||
|
||||
#define EXPRESSION_OPCODE_SIGNATURE EFI_SIGNATURE_32 ('E', 'X', 'O', 'P')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
UINT8 Operand;
|
||||
|
||||
UINT8 Format; // For EFI_IFR_TO_STRING, EFI_IFR_FIND
|
||||
UINT8 Flags; // For EFI_IFR_SPAN
|
||||
UINT8 RuleId; // For EFI_IFR_RULE_REF
|
||||
|
||||
EFI_HII_VALUE Value; // For EFI_IFR_EQ_ID_VAL, EFI_IFR_UINT64, EFI_IFR_UINT32, EFI_IFR_UINT16, EFI_IFR_UINT8, EFI_IFR_STRING_REF1
|
||||
|
||||
EFI_QUESTION_ID QuestionId; // For EFI_IFR_EQ_ID_ID, EFI_IFR_EQ_ID_LIST, EFI_IFR_QUESTION_REF1
|
||||
EFI_QUESTION_ID QuestionId2;
|
||||
|
||||
UINT16 ListLength; // For EFI_IFR_EQ_ID_LIST
|
||||
UINT16 *ValueList;
|
||||
|
||||
EFI_STRING_ID DevicePath; // For EFI_IFR_QUESTION_REF3_2, EFI_IFR_QUESTION_REF3_3
|
||||
EFI_GUID Guid;
|
||||
} EXPRESSION_OPCODE;
|
||||
|
||||
#define EXPRESSION_OPCODE_FROM_LINK(a) CR (a, EXPRESSION_OPCODE, Link, EXPRESSION_OPCODE_SIGNATURE)
|
||||
|
||||
#define FORM_EXPRESSION_SIGNATURE EFI_SIGNATURE_32 ('F', 'E', 'X', 'P')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
UINT8 Type; // Type for this expression
|
||||
|
||||
UINT8 RuleId; // For EFI_IFR_RULE only
|
||||
EFI_STRING_ID Error; // For EFI_IFR_NO_SUBMIT_IF, EFI_IFR_INCONSISTENT_IF only
|
||||
|
||||
EFI_HII_VALUE Result; // Expression evaluation result
|
||||
|
||||
LIST_ENTRY OpCodeListHead; // OpCodes consist of this expression (EXPRESSION_OPCODE)
|
||||
} FORM_EXPRESSION;
|
||||
|
||||
#define FORM_EXPRESSION_FROM_LINK(a) CR (a, FORM_EXPRESSION, Link, FORM_EXPRESSION_SIGNATURE)
|
||||
|
||||
#define QUESTION_DEFAULT_SIGNATURE EFI_SIGNATURE_32 ('Q', 'D', 'F', 'T')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
UINT16 DefaultId;
|
||||
EFI_HII_VALUE Value; // Default value
|
||||
|
||||
FORM_EXPRESSION *ValueExpression; // Not-NULL indicates default value is provided by EFI_IFR_VALUE
|
||||
} QUESTION_DEFAULT;
|
||||
|
||||
#define QUESTION_DEFAULT_FROM_LINK(a) CR (a, QUESTION_DEFAULT, Link, QUESTION_DEFAULT_SIGNATURE)
|
||||
|
||||
#define QUESTION_OPTION_SIGNATURE EFI_SIGNATURE_32 ('Q', 'O', 'P', 'T')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
EFI_STRING_ID Text;
|
||||
UINT8 Flags;
|
||||
EFI_HII_VALUE Value;
|
||||
EFI_IMAGE_ID ImageId;
|
||||
|
||||
FORM_EXPRESSION *SuppressExpression; // Non-NULL indicates nested inside of SuppressIf
|
||||
} QUESTION_OPTION;
|
||||
|
||||
#define QUESTION_OPTION_FROM_LINK(a) CR (a, QUESTION_OPTION, Link, QUESTION_OPTION_SIGNATURE)
|
||||
|
||||
#define FORM_BROWSER_STATEMENT_SIGNATURE EFI_SIGNATURE_32 ('F', 'S', 'T', 'A')
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
UINT8 Operand; // The operand (first byte) of this Statement or Question
|
||||
|
||||
//
|
||||
// Statement Header
|
||||
//
|
||||
EFI_STRING_ID Prompt;
|
||||
EFI_STRING_ID Help;
|
||||
EFI_STRING_ID TextTwo; // For EFI_IFR_TEXT
|
||||
|
||||
//
|
||||
// Question Header
|
||||
//
|
||||
EFI_QUESTION_ID QuestionId; // The value of zero is reserved
|
||||
EFI_VARSTORE_ID VarStoreId; // A value of zero indicates no variable storage
|
||||
FORMSET_STORAGE *Storage;
|
||||
union {
|
||||
EFI_STRING_ID VarName;
|
||||
UINT16 VarOffset;
|
||||
} VarStoreInfo;
|
||||
UINT16 StorageWidth;
|
||||
UINT8 QuestionFlags;
|
||||
CHAR16 *VariableName; // Name/Value or EFI Variable name
|
||||
CHAR16 *BlockName; // Buffer storage block name: "OFFSET=...WIDTH=..."
|
||||
|
||||
EFI_HII_VALUE HiiValue; // Edit copy for checkbox, numberic, oneof
|
||||
UINT8 *BufferValue; // Edit copy for string, password, orderedlist
|
||||
|
||||
//
|
||||
// OpCode specific members
|
||||
//
|
||||
UINT8 Flags; // for EFI_IFR_CHECKBOX, EFI_IFR_DATE, EFI_IFR_NUMERIC, EFI_IFR_ONE_OF,
|
||||
// EFI_IFR_ORDERED_LIST, EFI_IFR_STRING,EFI_IFR_SUBTITLE,EFI_IFR_TIME, EFI_IFR_BANNER
|
||||
UINT8 MaxContainers; // for EFI_IFR_ORDERED_LIST
|
||||
|
||||
UINT16 BannerLineNumber; // for EFI_IFR_BANNER, 1-based line number
|
||||
EFI_STRING_ID QuestionConfig; // for EFI_IFR_ACTION, if 0 then no configuration string will be processed
|
||||
|
||||
UINT64 Minimum; // for EFI_IFR_ONE_OF/EFI_IFR_NUMERIC, it's Min/Max value
|
||||
UINT64 Maximum; // for EFI_IFR_STRING/EFI_IFR_PASSWORD, it's Min/Max length
|
||||
UINT64 Step;
|
||||
|
||||
EFI_DEFAULT_ID DefaultId; // for EFI_IFR_RESET_BUTTON
|
||||
EFI_FORM_ID RefFormId; // for EFI_IFR_REF
|
||||
EFI_QUESTION_ID RefQuestionId; // for EFI_IFR_REF2
|
||||
EFI_GUID RefFormSetId; // for EFI_IFR_REF3
|
||||
EFI_STRING_ID RefDevicePath; // for EFI_IFR_REF4
|
||||
|
||||
//
|
||||
// Get from IFR parsing
|
||||
//
|
||||
FORM_EXPRESSION *ValueExpression; // nested EFI_IFR_VALUE, provide Question value and indicate Question is ReadOnly
|
||||
LIST_ENTRY DefaultListHead; // nested EFI_IFR_DEFAULT list (QUESTION_DEFAULT), provide default values
|
||||
LIST_ENTRY OptionListHead; // nested EFI_IFR_ONE_OF_OPTION list (QUESTION_OPTION)
|
||||
|
||||
EFI_IMAGE_ID ImageId; // nested EFI_IFR_IMAGE
|
||||
UINT8 RefreshInterval; // nested EFI_IFR_REFRESH, refresh interval(in seconds) for Question value, 0 means no refresh
|
||||
BOOLEAN InSubtitle; // nesting inside of EFI_IFR_SUBTITLE
|
||||
|
||||
LIST_ENTRY InconsistentListHead;// nested inconsistent expression list (FORM_EXPRESSION)
|
||||
LIST_ENTRY NoSubmitListHead; // nested nosubmit expression list (FORM_EXPRESSION)
|
||||
FORM_EXPRESSION *GrayOutExpression; // nesting inside of GrayOutIf
|
||||
FORM_EXPRESSION *SuppressExpression; // nesting inside of SuppressIf
|
||||
|
||||
} FORM_BROWSER_STATEMENT;
|
||||
|
||||
#define FORM_BROWSER_STATEMENT_FROM_LINK(a) CR (a, FORM_BROWSER_STATEMENT, Link, FORM_BROWSER_STATEMENT_SIGNATURE)
|
||||
|
||||
#define FORM_BROWSER_FORM_SIGNATURE EFI_SIGNATURE_32 ('F', 'F', 'R', 'M')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
UINT16 FormId;
|
||||
EFI_STRING_ID FormTitle;
|
||||
|
||||
EFI_IMAGE_ID ImageId;
|
||||
|
||||
LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)
|
||||
LIST_ENTRY StatementListHead; // List of Statements and Questions (FORM_BROWSER_STATEMENT)
|
||||
} FORM_BROWSER_FORM;
|
||||
|
||||
#define FORM_BROWSER_FORM_FROM_LINK(a) CR (a, FORM_BROWSER_FORM, Link, FORM_BROWSER_FORM_SIGNATURE)
|
||||
|
||||
#define FORMSET_DEFAULTSTORE_SIGNATURE EFI_SIGNATURE_32 ('F', 'D', 'F', 'S')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
UINT16 DefaultId;
|
||||
EFI_STRING_ID DefaultName;
|
||||
} FORMSET_DEFAULTSTORE;
|
||||
|
||||
#define FORMSET_DEFAULTSTORE_FROM_LINK(a) CR (a, FORMSET_DEFAULTSTORE, Link, FORMSET_DEFAULTSTORE_SIGNATURE)
|
||||
|
||||
typedef struct {
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
EFI_HANDLE DriverHandle;
|
||||
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
|
||||
UINTN IfrBinaryLength;
|
||||
UINT8 *IfrBinaryData;
|
||||
|
||||
EFI_GUID Guid;
|
||||
EFI_STRING_ID FormSetTitle;
|
||||
EFI_STRING_ID Help;
|
||||
UINT16 Class;
|
||||
UINT16 SubClass;
|
||||
EFI_IMAGE_ID ImageId;
|
||||
|
||||
FORM_BROWSER_STATEMENT *StatementBuffer; // Buffer for all Statements and Questions
|
||||
EXPRESSION_OPCODE *ExpressionBuffer; // Buffer for all Expression OpCode
|
||||
|
||||
LIST_ENTRY StorageListHead; // Storage list (FORMSET_STORAGE)
|
||||
LIST_ENTRY DefaultStoreListHead; // DefaultStore list (FORMSET_DEFAULTSTORE)
|
||||
LIST_ENTRY FormListHead; // Form list (FORM_BROWSER_FORM)
|
||||
} FORM_BROWSER_FORMSET;
|
||||
|
||||
|
||||
extern EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
|
||||
extern EFI_HII_STRING_PROTOCOL *mHiiString;
|
||||
extern EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting;
|
||||
|
||||
extern BANNER_DATA *BannerData;
|
||||
extern EFI_HII_HANDLE FrontPageHandle;
|
||||
extern UINTN gClassOfVfr;
|
||||
extern UINTN gFunctionKeySetting;
|
||||
extern BOOLEAN gResetRequired;
|
||||
extern BOOLEAN gNvUpdateRequired;
|
||||
extern EFI_HII_HANDLE gHiiHandle;
|
||||
extern BOOLEAN gFirstIn;
|
||||
extern UINT16 gDirection;
|
||||
extern EFI_SCREEN_DESCRIPTOR gScreenDimensions;
|
||||
extern BOOLEAN gUpArrow;
|
||||
extern BOOLEAN gDownArrow;
|
||||
|
||||
//
|
||||
// Browser Global Strings
|
||||
//
|
||||
extern CHAR16 *gFunctionOneString;
|
||||
extern CHAR16 *gFunctionTwoString;
|
||||
extern CHAR16 *gFunctionNineString;
|
||||
extern CHAR16 *gFunctionTenString;
|
||||
extern CHAR16 *gEnterString;
|
||||
extern CHAR16 *gEnterCommitString;
|
||||
extern CHAR16 *gEscapeString;
|
||||
extern CHAR16 *gSaveFailed;
|
||||
extern CHAR16 *gMoveHighlight;
|
||||
extern CHAR16 *gMakeSelection;
|
||||
extern CHAR16 *gDecNumericInput;
|
||||
extern CHAR16 *gHexNumericInput;
|
||||
extern CHAR16 *gToggleCheckBox;
|
||||
extern CHAR16 *gPromptForData;
|
||||
extern CHAR16 *gPromptForPassword;
|
||||
extern CHAR16 *gPromptForNewPassword;
|
||||
extern CHAR16 *gConfirmPassword;
|
||||
extern CHAR16 *gConfirmError;
|
||||
extern CHAR16 *gPassowordInvalid;
|
||||
extern CHAR16 *gPressEnter;
|
||||
extern CHAR16 *gEmptyString;
|
||||
extern CHAR16 *gAreYouSure;
|
||||
extern CHAR16 *gYesResponse;
|
||||
extern CHAR16 *gNoResponse;
|
||||
extern CHAR16 *gMiniString;
|
||||
extern CHAR16 *gPlusString;
|
||||
extern CHAR16 *gMinusString;
|
||||
extern CHAR16 *gAdjustNumber;
|
||||
|
||||
extern CHAR16 gPromptBlockWidth;
|
||||
extern CHAR16 gOptionBlockWidth;
|
||||
extern CHAR16 gHelpBlockWidth;
|
||||
|
||||
extern EFI_GUID gZeroGuid;
|
||||
extern EFI_GUID gTianoHiiIfrGuid;
|
||||
|
||||
//
|
||||
// Global Procedure Defines
|
||||
//
|
||||
VOID
|
||||
InitializeBrowserStrings (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
UINTN
|
||||
_Print (
|
||||
IN CHAR16 *fmt,
|
||||
...
|
||||
)
|
||||
;
|
||||
|
||||
UINTN
|
||||
PrintString (
|
||||
CHAR16 *String
|
||||
)
|
||||
;
|
||||
|
||||
UINTN
|
||||
PrintChar (
|
||||
CHAR16 Character
|
||||
)
|
||||
;
|
||||
|
||||
UINTN
|
||||
PrintAt (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
IN CHAR16 *fmt,
|
||||
...
|
||||
)
|
||||
;
|
||||
|
||||
UINTN
|
||||
PrintStringAt (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
CHAR16 *String
|
||||
)
|
||||
;
|
||||
|
||||
UINTN
|
||||
PrintCharAt (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
CHAR16 Character
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ParseOpCodes (
|
||||
IN FORM_BROWSER_FORMSET *FormSet
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
DestroyFormSet (
|
||||
IN OUT FORM_BROWSER_FORMSET *FormSet
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
DisplayPageFrame (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STRING_ID
|
||||
NewString (
|
||||
IN CHAR16 *String,
|
||||
IN EFI_HII_HANDLE HiiHandle
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
DeleteString (
|
||||
IN EFI_STRING_ID StringId,
|
||||
IN EFI_HII_HANDLE HiiHandle
|
||||
)
|
||||
;
|
||||
CHAR16 *
|
||||
GetToken (
|
||||
IN EFI_STRING_ID Token,
|
||||
IN EFI_HII_HANDLE HiiHandle
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
CreateSharedPopUp (
|
||||
IN UINTN RequestedWidth,
|
||||
IN UINTN NumberOfLines,
|
||||
IN CHAR16 **ArrayOfStrings
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
CreateDialog (
|
||||
IN UINTN NumberOfLines,
|
||||
IN BOOLEAN HotKey,
|
||||
IN UINTN MaximumStringSize,
|
||||
OUT CHAR16 *StringBuffer,
|
||||
OUT EFI_INPUT_KEY *KeyValue,
|
||||
IN CHAR16 *String,
|
||||
...
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetQuestionValue (
|
||||
IN FORM_BROWSER_FORMSET *FormSet,
|
||||
IN FORM_BROWSER_FORM *Form,
|
||||
IN OUT FORM_BROWSER_STATEMENT *Question,
|
||||
IN BOOLEAN Cached
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
SetQuestionValue (
|
||||
IN FORM_BROWSER_FORMSET *FormSet,
|
||||
IN FORM_BROWSER_FORM *Form,
|
||||
IN OUT FORM_BROWSER_STATEMENT *Question,
|
||||
IN BOOLEAN Cached
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ValidateQuestion (
|
||||
IN FORM_BROWSER_FORMSET *FormSet,
|
||||
IN FORM_BROWSER_FORM *Form,
|
||||
IN FORM_BROWSER_STATEMENT *Question,
|
||||
IN UINTN Type
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
SubmitForm (
|
||||
IN FORM_BROWSER_FORMSET *FormSet,
|
||||
IN FORM_BROWSER_FORM *Form
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetQuestionDefault (
|
||||
IN FORM_BROWSER_FORMSET *FormSet,
|
||||
IN FORM_BROWSER_FORM *Form,
|
||||
IN FORM_BROWSER_STATEMENT *Question,
|
||||
IN UINT16 DefaultId
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InitializeCurrentSetting (
|
||||
IN OUT FORM_BROWSER_FORMSET *FormSet
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InitializeFormSet (
|
||||
IN EFI_HII_HANDLE Handle,
|
||||
IN OUT EFI_GUID *FormSetGuid,
|
||||
OUT FORM_BROWSER_FORMSET *FormSet
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ExtractFormDefault (
|
||||
IN FORM_BROWSER_FORMSET *FormSet,
|
||||
IN FORM_BROWSER_FORM *Form,
|
||||
IN UINT16 DefaultId
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
LoadFormConfig (
|
||||
IN FORM_BROWSER_FORMSET *FormSet,
|
||||
IN FORM_BROWSER_FORM *Form
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
StorageToConfigResp (
|
||||
IN FORMSET_STORAGE *Storage,
|
||||
IN CHAR16 **ConfigResp
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ConfigRespToStorage (
|
||||
IN FORMSET_STORAGE *Storage,
|
||||
IN CHAR16 *ConfigResp
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
LoadStorage (
|
||||
IN FORM_BROWSER_FORMSET *FormSet,
|
||||
IN FORMSET_STORAGE *Storage
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetIfrBinaryData (
|
||||
IN EFI_HII_HANDLE Handle,
|
||||
IN OUT EFI_GUID *FormSetGuid,
|
||||
OUT UINTN *BinaryLength,
|
||||
OUT UINT8 **BinaryData
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SendForm (
|
||||
IN CONST EFI_FORM_BROWSER2_PROTOCOL *This,
|
||||
IN EFI_HII_HANDLE *Handles,
|
||||
IN UINTN HandleCount,
|
||||
IN EFI_GUID *FormSetGuid, OPTIONAL
|
||||
IN UINT16 FormId, OPTIONAL
|
||||
IN CONST EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL
|
||||
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BrowserCallback (
|
||||
IN CONST EFI_FORM_BROWSER2_PROTOCOL *This,
|
||||
IN OUT UINTN *ResultsDataSize,
|
||||
IN OUT EFI_STRING ResultsData,
|
||||
IN BOOLEAN RetrieveData,
|
||||
IN CONST EFI_GUID *VariableGuid, OPTIONAL
|
||||
IN CONST CHAR16 *VariableName OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
#endif
|
84
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowser.msa
Normal file
84
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowser.msa
Normal file
@@ -0,0 +1,84 @@
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<MsaHeader>
|
||||
<ModuleName>SetupBrowser</ModuleName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<GuidValue>EBf342FE-B1D3-4EF8-957C-8048606FF671</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Component name for module SetupBrowser</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2007, Intel Corporation. All rights reserved.</Copyright>
|
||||
<License>All rights reserved. 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>SetupBrowser</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PrintLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DebugLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseMemoryLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiRuntimeServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiDriverEntryPoint</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiBootServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>MemoryAllocationLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>R8Lib.h</Filename>
|
||||
<Filename>Print.h</Filename>
|
||||
<Filename>Setup.c</Filename>
|
||||
<Filename>Setup.h</Filename>
|
||||
<Filename>Ui.h</Filename>
|
||||
<Filename>Print.c</Filename>
|
||||
<Filename>SetupBrowser.dxs</Filename>
|
||||
<Filename>R8Lib.c</Filename>
|
||||
<Filename>ProcessOptions.c</Filename>
|
||||
<Filename>InputHandler.c</Filename>
|
||||
<Filename>Ui.c</Filename>
|
||||
<Filename>IfrParse.c</Filename>
|
||||
<Filename>Expression.c</Filename>
|
||||
<Filename>Colors.h</Filename>
|
||||
<Filename>Presentation.c</Filename>
|
||||
<Filename>SetupBrowserStr.uni</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
|
||||
</PackageDependencies>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiPrintProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
</Protocols>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>InitializeSetup</ModuleEntryPoint>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
82
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
Normal file
82
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
Normal file
@@ -0,0 +1,82 @@
|
||||
#/** @file
|
||||
# Component name for module SetupBrowser
|
||||
#
|
||||
# FIX ME!
|
||||
# Copyright (c) 2007, Intel Corporation. All rights reserved.
|
||||
#
|
||||
# All rights reserved. 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
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = SetupBrowser
|
||||
FILE_GUID = EBf342FE-B1D3-4EF8-957C-8048606FF671
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x0002000A
|
||||
|
||||
ENTRY_POINT = InitializeSetup
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
[Sources.common]
|
||||
SetupBrowserStr.uni
|
||||
Setup.c
|
||||
Setup.h
|
||||
IfrParse.c
|
||||
Expression.c
|
||||
InputHandler.c
|
||||
Print.c
|
||||
Print.h
|
||||
Presentation.c
|
||||
ProcessOptions.c
|
||||
Ui.c
|
||||
Ui.h
|
||||
R8Lib.c
|
||||
R8Lib.h
|
||||
Colors.h
|
||||
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
|
||||
[LibraryClasses]
|
||||
MemoryAllocationLib
|
||||
BaseLib
|
||||
UefiBootServicesTableLib
|
||||
UefiDriverEntryPoint
|
||||
UefiRuntimeServicesTableLib
|
||||
BaseMemoryLib
|
||||
DebugLib
|
||||
PrintLib
|
||||
GraphicsLib
|
||||
IfrSupportLib
|
||||
HiiLib
|
||||
|
||||
[Protocols]
|
||||
gEfiPrintProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiHiiConfigAccessProtocolGuid
|
||||
gEfiHiiStringProtocolGuid
|
||||
gEfiFormBrowser2ProtocolGuid
|
||||
gEfiHiiConfigRoutingProtocolGuid
|
||||
gEfiHiiDatabaseProtocolGuid
|
||||
gEfiUnicodeCollation2ProtocolGuid
|
||||
|
||||
[Depex]
|
||||
gEfiHiiDatabaseProtocolGuid AND gEfiHiiConfigRoutingProtocolGuid
|
||||
|
BIN
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserStr.uni
Normal file
BIN
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserStr.uni
Normal file
Binary file not shown.
2830
MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
Normal file
2830
MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
Normal file
File diff suppressed because it is too large
Load Diff
478
MdeModulePkg/Universal/SetupBrowserDxe/Ui.h
Normal file
478
MdeModulePkg/Universal/SetupBrowserDxe/Ui.h
Normal file
@@ -0,0 +1,478 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
Ui.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Head file UI
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _UI_H
|
||||
#define _UI_H
|
||||
|
||||
//@MT:#include "Tiano.h"
|
||||
//@MT:#include "EfiDriverLib.h"
|
||||
#include "Setup.h"
|
||||
//@MT:#include "GraphicsLib.h"
|
||||
//@MT:#include "EfiPrintLib.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
#define REGULAR_NUMERIC 0
|
||||
#define TIME_NUMERIC 1
|
||||
#define DATE_NUMERIC 2
|
||||
|
||||
#define SUBTITLE_INDENT 2
|
||||
|
||||
typedef enum {
|
||||
UiNoOperation,
|
||||
UiDefault,
|
||||
UiSelect,
|
||||
UiUp,
|
||||
UiDown,
|
||||
UiLeft,
|
||||
UiRight,
|
||||
UiReset,
|
||||
UiSave,
|
||||
UiPrevious,
|
||||
UiPageUp,
|
||||
UiPageDown,
|
||||
UiMaxOperation
|
||||
} UI_SCREEN_OPERATION;
|
||||
|
||||
typedef enum {
|
||||
CfInitialization,
|
||||
CfCheckSelection,
|
||||
CfRepaint,
|
||||
CfRefreshHighLight,
|
||||
CfUpdateHelpString,
|
||||
CfPrepareToReadKey,
|
||||
CfReadKey,
|
||||
CfScreenOperation,
|
||||
CfUiPrevious,
|
||||
CfUiSelect,
|
||||
CfUiReset,
|
||||
CfUiLeft,
|
||||
CfUiRight,
|
||||
CfUiUp,
|
||||
CfUiPageUp,
|
||||
CfUiPageDown,
|
||||
CfUiDown,
|
||||
CfUiSave,
|
||||
CfUiDefault,
|
||||
CfUiNoOperation,
|
||||
CfExit,
|
||||
CfMaxControlFlag
|
||||
} UI_CONTROL_FLAG;
|
||||
|
||||
#define UI_ACTION_NONE 0
|
||||
#define UI_ACTION_REFRESH_FORM 1
|
||||
#define UI_ACTION_REFRESH_FORMSET 2
|
||||
#define UI_ACTION_EXIT 3
|
||||
|
||||
typedef struct {
|
||||
EFI_HII_HANDLE Handle;
|
||||
|
||||
//
|
||||
// Target formset/form/Question information
|
||||
//
|
||||
EFI_GUID FormSetGuid;
|
||||
UINT16 FormId;
|
||||
UINT16 QuestionId;
|
||||
|
||||
UINTN TopRow;
|
||||
UINTN BottomRow;
|
||||
UINTN PromptCol;
|
||||
UINTN OptionCol;
|
||||
UINTN CurrentRow;
|
||||
|
||||
//
|
||||
// Ation for Browser to taken:
|
||||
// UI_ACTION_NONE - navigation inside a form
|
||||
// UI_ACTION_REFRESH_FORM - re-evaluate expressions and repaint form
|
||||
// UI_ACTION_REFRESH_FORMSET - re-parse formset IFR binary
|
||||
//
|
||||
UINTN Action;
|
||||
|
||||
//
|
||||
// Current selected fomset/form/Question
|
||||
//
|
||||
FORM_BROWSER_FORMSET *FormSet;
|
||||
FORM_BROWSER_FORM *Form;
|
||||
FORM_BROWSER_STATEMENT *Statement;
|
||||
} UI_MENU_SELECTION;
|
||||
|
||||
#define UI_MENU_OPTION_SIGNATURE EFI_SIGNATURE_32 ('u', 'i', 'm', 'm')
|
||||
#define UI_MENU_LIST_SIGNATURE EFI_SIGNATURE_32 ('u', 'i', 'm', 'l')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
EFI_HII_HANDLE Handle;
|
||||
FORM_BROWSER_STATEMENT *ThisTag;
|
||||
UINT16 EntryNumber;
|
||||
|
||||
UINTN Row;
|
||||
UINTN Col;
|
||||
UINTN OptCol;
|
||||
CHAR16 *Description;
|
||||
UINTN Skip; // Number of lines
|
||||
|
||||
//
|
||||
// Display item sequence for date/time
|
||||
// Date: Month/Day/Year
|
||||
// Sequence: 0 1 2
|
||||
//
|
||||
// Time: Hour : Minute : Second
|
||||
// Sequence: 0 1 2
|
||||
//
|
||||
//
|
||||
UINTN Sequence;
|
||||
|
||||
BOOLEAN GrayOut;
|
||||
BOOLEAN ReadOnly;
|
||||
} UI_MENU_OPTION;
|
||||
|
||||
#define MENU_OPTION_FROM_LINK(a) CR (a, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE)
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY MenuLink;
|
||||
|
||||
UINT16 FormId;
|
||||
UINT16 QuestionId;
|
||||
} UI_MENU_LIST;
|
||||
|
||||
typedef struct _MENU_REFRESH_ENTRY {
|
||||
struct _MENU_REFRESH_ENTRY *Next;
|
||||
UI_MENU_OPTION *MenuOption; // Describes the entry needing an update
|
||||
UI_MENU_SELECTION *Selection;
|
||||
UINTN CurrentColumn;
|
||||
UINTN CurrentRow;
|
||||
UINTN CurrentAttribute;
|
||||
} MENU_REFRESH_ENTRY;
|
||||
|
||||
typedef struct {
|
||||
UINT16 ScanCode;
|
||||
UI_SCREEN_OPERATION ScreenOperation;
|
||||
} SCAN_CODE_TO_SCREEN_OPERATION;
|
||||
|
||||
typedef struct {
|
||||
UI_SCREEN_OPERATION ScreenOperation;
|
||||
UI_CONTROL_FLAG ControlFlag;
|
||||
} SCREEN_OPERATION_T0_CONTROL_FLAG;
|
||||
|
||||
|
||||
extern LIST_ENTRY gMenuList;
|
||||
extern MENU_REFRESH_ENTRY *gMenuRefreshHead;
|
||||
extern UI_MENU_SELECTION *gCurrentSelection;
|
||||
|
||||
//
|
||||
// Global Functions
|
||||
//
|
||||
VOID
|
||||
UiInitMenu (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
UiInitMenuList (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
UiRemoveMenuListEntry (
|
||||
OUT UI_MENU_SELECTION *Selection
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
UiFreeMenuList (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
UiAddMenuListEntry (
|
||||
IN UI_MENU_SELECTION *Selection
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
UiFreeMenu (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
UiAddMenuOption (
|
||||
IN CHAR16 *String,
|
||||
IN EFI_HII_HANDLE Handle,
|
||||
IN FORM_BROWSER_STATEMENT *Statement,
|
||||
IN UINT16 NumberOfLines,
|
||||
IN UINT16 MenuItemCount
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
UiDisplayMenu (
|
||||
IN OUT UI_MENU_SELECTION *Selection
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
FreeBrowserStrings (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
SetupBrowser (
|
||||
IN OUT UI_MENU_SELECTION *Selection
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
ValueToString (
|
||||
IN CHAR16 *Buffer,
|
||||
IN BOOLEAN Comma,
|
||||
IN INT64 v
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
UiIntToString (
|
||||
IN UINTN num,
|
||||
IN OUT CHAR16 *str,
|
||||
IN UINT16 size
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
SetUnicodeMem (
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Size,
|
||||
IN CHAR16 Value
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
UiWaitForSingleEvent (
|
||||
IN EFI_EVENT Event,
|
||||
IN UINT64 Timeout, OPTIONAL
|
||||
IN UINT8 RefreshInterval OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
CreatePopUp (
|
||||
IN UINTN ScreenWidth,
|
||||
IN UINTN NumberOfLines,
|
||||
IN CHAR16 *ArrayOfStrings,
|
||||
...
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ReadString (
|
||||
IN UI_MENU_OPTION *MenuOption,
|
||||
IN CHAR16 *Prompt,
|
||||
OUT CHAR16 *StringPtr
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetSelectionInputPopUp (
|
||||
IN UI_MENU_SELECTION *Selection,
|
||||
IN UI_MENU_OPTION *MenuOption
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetNumericInput (
|
||||
IN UI_MENU_SELECTION *Selection,
|
||||
IN UI_MENU_OPTION *MenuOption
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
UpdateStatusBar (
|
||||
IN UINTN MessageType,
|
||||
IN UINT8 Flags,
|
||||
IN BOOLEAN State
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ProcessQuestionConfig (
|
||||
IN UI_MENU_SELECTION *Selection,
|
||||
IN FORM_BROWSER_STATEMENT *Question
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PrintFormattedNumber (
|
||||
IN FORM_BROWSER_STATEMENT *Question,
|
||||
IN OUT CHAR16 *FormattedNumber,
|
||||
IN UINTN BufferSize
|
||||
)
|
||||
;
|
||||
|
||||
QUESTION_OPTION *
|
||||
ValueToOption (
|
||||
IN FORM_BROWSER_STATEMENT *Question,
|
||||
IN EFI_HII_VALUE *OptionValue
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ProcessOptions (
|
||||
IN UI_MENU_SELECTION *Selection,
|
||||
IN UI_MENU_OPTION *MenuOption,
|
||||
IN BOOLEAN Selected,
|
||||
OUT CHAR16 **OptionString
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
ProcessHelpString (
|
||||
IN CHAR16 *StringPtr,
|
||||
OUT CHAR16 **FormattedString,
|
||||
IN UINTN RowCount
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
UpdateKeyHelp (
|
||||
IN UI_MENU_OPTION *MenuOption,
|
||||
IN BOOLEAN Selected
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
ClearLines (
|
||||
UINTN LeftColumn,
|
||||
UINTN RightColumn,
|
||||
UINTN TopRow,
|
||||
UINTN BottomRow,
|
||||
UINTN TextAttribute
|
||||
)
|
||||
;
|
||||
|
||||
UINTN
|
||||
GetStringWidth (
|
||||
CHAR16 *String
|
||||
)
|
||||
;
|
||||
|
||||
UINT16
|
||||
GetLineByWidth (
|
||||
IN CHAR16 *InputString,
|
||||
IN UINT16 LineWidth,
|
||||
IN OUT UINTN *Index,
|
||||
OUT CHAR16 **OutputString
|
||||
)
|
||||
;
|
||||
|
||||
UINT16
|
||||
GetWidth (
|
||||
IN FORM_BROWSER_STATEMENT *Statement,
|
||||
IN EFI_HII_HANDLE Handle
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
NewStrCat (
|
||||
CHAR16 *Destination,
|
||||
CHAR16 *Source
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
WaitForKeyStroke (
|
||||
OUT EFI_INPUT_KEY *Key
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
ResetScopeStack (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PushScope (
|
||||
IN UINT8 Operand
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PopScope (
|
||||
OUT UINT8 *Operand
|
||||
)
|
||||
;
|
||||
|
||||
FORM_BROWSER_FORM *
|
||||
IdToForm (
|
||||
IN FORM_BROWSER_FORMSET *FormSet,
|
||||
IN UINT16 FormId
|
||||
)
|
||||
;
|
||||
|
||||
FORM_BROWSER_STATEMENT *
|
||||
IdToQuestion (
|
||||
IN FORM_BROWSER_FORMSET *FormSet,
|
||||
IN FORM_BROWSER_FORM *Form,
|
||||
IN UINT16 QuestionId
|
||||
)
|
||||
;
|
||||
|
||||
FORM_EXPRESSION *
|
||||
IdToExpression (
|
||||
IN FORM_BROWSER_FORM *Form,
|
||||
IN UINT8 RuleId
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
ExtendValueToU64 (
|
||||
IN EFI_HII_VALUE *Value
|
||||
)
|
||||
;
|
||||
|
||||
INTN
|
||||
CompareHiiValue (
|
||||
IN EFI_HII_VALUE *Value1,
|
||||
IN EFI_HII_VALUE *Value2,
|
||||
IN EFI_HII_HANDLE HiiHandle OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EvaluateExpression (
|
||||
IN FORM_BROWSER_FORMSET *FormSet,
|
||||
IN FORM_BROWSER_FORM *Form,
|
||||
IN OUT FORM_EXPRESSION *Expression
|
||||
)
|
||||
;
|
||||
|
||||
#endif // _UI_H
|
Reference in New Issue
Block a user