本文整理汇总了C++中HiiAllocateOpCodeHandle函数的典型用法代码示例。如果您正苦于以下问题:C++ HiiAllocateOpCodeHandle函数的具体用法?C++ HiiAllocateOpCodeHandle怎么用?C++ HiiAllocateOpCodeHandle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HiiAllocateOpCodeHandle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateUpdateData
/**
Create the global UpdateData structure.
**/
VOID
CreateUpdateData (
VOID
)
{
//
// Init OpCode Handle and Allocate space for creation of Buffer
//
mStartOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (mStartOpCodeHandle != NULL);
mEndOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (mEndOpCodeHandle != NULL);
//
// Create Hii Extend Label OpCode as the start opcode
//
mStartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (mStartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
mStartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
//
// Create Hii Extend Label OpCode as the end opcode
//
mEndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (mEndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
mEndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
mEndLabel->Number = LABEL_END;
}
示例2: UpdateFrontPageForm
/**
Update the menus in the front page.
**/
VOID
UpdateFrontPageForm (
VOID
)
{
VOID *StartOpCodeHandle;
VOID *EndOpCodeHandle;
EFI_IFR_GUID_LABEL *StartGuidLabel;
EFI_IFR_GUID_LABEL *EndGuidLabel;
//
// Allocate space for creation of UpdateData Buffer
//
StartOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (StartOpCodeHandle != NULL);
EndOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (EndOpCodeHandle != NULL);
//
// Create Hii Extend Label OpCode as the start opcode
//
StartGuidLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
StartGuidLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
StartGuidLabel->Number = LABEL_FRANTPAGE_INFORMATION;
//
// Create Hii Extend Label OpCode as the end opcode
//
EndGuidLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
EndGuidLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
EndGuidLabel->Number = LABEL_END;
//
//Updata Front Page form
//
UiCustomizeFrontPage (
gFrontPagePrivate.HiiHandle,
StartOpCodeHandle
);
HiiUpdateForm (
gFrontPagePrivate.HiiHandle,
&mFrontPageGuid,
FRONT_PAGE_FORM_ID,
StartOpCodeHandle,
EndOpCodeHandle
);
HiiFreeOpCodeHandle (StartOpCodeHandle);
HiiFreeOpCodeHandle (EndOpCodeHandle);
}
示例3: CustomizeMenus
/**
Update the menus in the BMM page.
**/
VOID
CustomizeMenus (
VOID
)
{
VOID *StartOpCodeHandle;
VOID *EndOpCodeHandle;
EFI_IFR_GUID_LABEL *StartGuidLabel;
EFI_IFR_GUID_LABEL *EndGuidLabel;
//
// Allocate space for creation of UpdateData Buffer
//
StartOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (StartOpCodeHandle != NULL);
EndOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (EndOpCodeHandle != NULL);
//
// Create Hii Extend Label OpCode as the start opcode
//
StartGuidLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
StartGuidLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
StartGuidLabel->Number = LABEL_FORM_MAIN_START;
//
// Create Hii Extend Label OpCode as the end opcode
//
EndGuidLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
EndGuidLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
EndGuidLabel->Number = LABEL_FORM_MAIN_END;
//
//Updata Front Page form
//
UiCustomizeBMMPage (
mBmmCallbackInfo->BmmHiiHandle,
StartOpCodeHandle
);
HiiUpdateForm (
mBmmCallbackInfo->BmmHiiHandle,
&mBootMaintGuid,
FORM_MAIN_ID,
StartOpCodeHandle,
EndOpCodeHandle
);
HiiFreeOpCodeHandle (StartOpCodeHandle);
HiiFreeOpCodeHandle (EndOpCodeHandle);
}
示例4: RefreshLegacyUpdateData
/**
Refresh the global UpdateData structure.
**/
VOID
RefreshLegacyUpdateData (
VOID
)
{
//
// Free current updated date
//
if (mLegacyStartOpCodeHandle != NULL) {
HiiFreeOpCodeHandle (mLegacyStartOpCodeHandle);
}
if (mLegacyEndOpCodeHandle != NULL) {
HiiFreeOpCodeHandle (mLegacyEndOpCodeHandle);
}
//
// Create new OpCode Handle
//
mLegacyStartOpCodeHandle = HiiAllocateOpCodeHandle ();
mLegacyEndOpCodeHandle = HiiAllocateOpCodeHandle ();
//
// Create Hii Extend Label OpCode as the start opcode
//
mLegacyStartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
mLegacyStartOpCodeHandle,
&gEfiIfrTianoGuid,
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
mLegacyStartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
mLegacyStartLabel->Number = FORM_BOOT_LEGACY_DEVICE_ID;
//
// Create Hii Extend Label OpCode as the start opcode
//
mLegacyEndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
mLegacyEndOpCodeHandle,
&gEfiIfrTianoGuid,
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
mLegacyEndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
mLegacyEndLabel->Number = FORM_BOOT_LEGACY_LABEL_END;
}
示例5: RefreshUpdateData
/**
Refresh the global UpdateData structure.
**/
VOID
RefreshUpdateData (
VOID
)
{
//
// Free current updated date
//
if (mStartOpCodeHandle != NULL) {
HiiFreeOpCodeHandle (mStartOpCodeHandle);
}
//
// Create new OpCode Handle
//
mStartOpCodeHandle = HiiAllocateOpCodeHandle ();
//
// Create Hii Extend Label OpCode as the start opcode
//
mStartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
mStartOpCodeHandle,
&gEfiIfrTianoGuid,
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
mStartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
}
示例6: UpdateTimeOutPage
/**
Create the dynamic page to allow user to set the "TimeOut" value.
@param CallbackData The BMM context data.
**/
VOID
UpdateTimeOutPage (
IN BMM_CALLBACK_DATA *CallbackData
)
{
VOID *DefaultOpCodeHandle;
CallbackData->BmmAskSaveOrNot = TRUE;
UpdatePageStart (CallbackData);
DefaultOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (DefaultOpCodeHandle != NULL);
HiiCreateDefaultOpCode (DefaultOpCodeHandle, EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_NUM_SIZE_16, CallbackData->BmmFakeNvData.BootTimeOut);
HiiCreateNumericOpCode (
mStartOpCodeHandle,
(EFI_QUESTION_ID) BOOT_TIME_OUT_QUESTION_ID,
VARSTORE_ID_BOOT_MAINT,
BOOT_TIME_OUT_VAR_OFFSET,
STRING_TOKEN (STR_NUM_AUTO_BOOT),
STRING_TOKEN (STR_HLP_AUTO_BOOT),
0,
EFI_IFR_NUMERIC_SIZE_2 | EFI_IFR_DISPLAY_UINT_DEC,
0,
65535,
0,
DefaultOpCodeHandle
);
HiiFreeOpCodeHandle (DefaultOpCodeHandle);
UpdatePageEnd (CallbackData);
}
示例7: LibRefreshUpdateData
/**
Refresh the global UpdateData structure.
**/
VOID
LibRefreshUpdateData (
VOID
)
{
//
// Free current updated date
//
if (mLibStartOpCodeHandle != NULL) {
HiiFreeOpCodeHandle (mLibStartOpCodeHandle);
}
if (mLibEndOpCodeHandle != NULL) {
HiiFreeOpCodeHandle (mLibEndOpCodeHandle);
}
//
// Create new OpCode Handle
//
mLibStartOpCodeHandle = HiiAllocateOpCodeHandle ();
mLibEndOpCodeHandle = HiiAllocateOpCodeHandle ();
//
// Create Hii Extend Label OpCode as the start opcode
//
mLibStartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
mLibStartOpCodeHandle,
&gEfiIfrTianoGuid,
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
mLibStartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
mLibStartLabel->Number = FORM_FILE_EXPLORER_ID;
//
// Create Hii Extend Label OpCode as the start opcode
//
mLibEndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
mLibEndOpCodeHandle,
&gEfiIfrTianoGuid,
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
mLibEndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
mLibEndLabel->Number = LABEL_END;
}
示例8: HiiFreeOpCodeHandle
/**
Create a set of "one-of-many" (ie. "drop down list") option IFR opcodes,
based on available GOP resolutions, to be placed under a "one-of-many" (ie.
"drop down list") opcode.
@param[in] PackageList The package list with the formset and form for
which the drop down options are produced. Option
names are added as new strings to PackageList.
@param[out] OpCodeBuffer On output, a dynamically allocated opcode buffer
with drop down list options corresponding to GOP
resolutions. The caller is responsible for freeing
OpCodeBuffer with HiiFreeOpCodeHandle() after use.
@param[in] NumGopModes Number of entries in GopModes.
@param[in] GopModes Array of resolutions retrieved from the GOP.
@retval EFI_SUCESS Opcodes have been successfully produced.
@return Status codes from underlying functions. PackageList may
have been extended with new strings. OpCodeBuffer is
unchanged.
**/
STATIC
EFI_STATUS
EFIAPI
CreateResolutionOptions (
IN EFI_HII_HANDLE *PackageList,
OUT VOID **OpCodeBuffer,
IN UINTN NumGopModes,
IN GOP_MODE *GopModes
)
{
EFI_STATUS Status;
VOID *OutputBuffer;
UINTN ModeNumber;
OutputBuffer = HiiAllocateOpCodeHandle ();
if (OutputBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
for (ModeNumber = 0; ModeNumber < NumGopModes; ++ModeNumber) {
CHAR16 Desc[MAXSIZE_RES_CUR];
EFI_STRING_ID NewString;
VOID *OpCode;
UnicodeSPrintAsciiFormat (Desc, sizeof Desc, "%Ldx%Ld",
(INT64) GopModes[ModeNumber].X, (INT64) GopModes[ModeNumber].Y);
NewString = HiiSetString (PackageList, 0 /* new string */, Desc,
NULL /* for all languages */);
if (NewString == 0) {
Status = EFI_OUT_OF_RESOURCES;
goto FreeOutputBuffer;
}
OpCode = HiiCreateOneOfOptionOpCode (OutputBuffer, NewString,
0 /* Flags */, EFI_IFR_NUMERIC_SIZE_4, ModeNumber);
if (OpCode == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto FreeOutputBuffer;
}
}
*OpCodeBuffer = OutputBuffer;
return EFI_SUCCESS;
FreeOutputBuffer:
HiiFreeOpCodeHandle (OutputBuffer);
return Status;
}
示例9: UpdateLegacyDeviceOrderPage
//.........这里部分代码省略.........
BbsType = BBS_CDROM;
Default = mLegacyBootOptionPrivate->MaintainMapData->CurrentNvData.LegacyCD;
break;
case FORM_NET_BOOT_ID:
OptionMenu = (LEGACY_MENU_OPTION *) &LegacyNETMenu;
Key = (UINT16) LEGACY_NET_QUESTION_ID;
TypeStr = STR_NET;
TypeStrHelp = STR_NET_HELP;
FormTitle = STR_NET_TITLE;
BbsType = BBS_EMBED_NETWORK;
Default = mLegacyBootOptionPrivate->MaintainMapData->CurrentNvData.LegacyNET;
break;
case FORM_BEV_BOOT_ID:
OptionMenu = (LEGACY_MENU_OPTION *) &LegacyBEVMenu;
Key = (UINT16) LEGACY_BEV_QUESTION_ID;
TypeStr = STR_BEV;
TypeStrHelp = STR_BEV_HELP;
FormTitle = STR_BEV_TITLE;
BbsType = BBS_BEV_DEVICE;
Default = mLegacyBootOptionPrivate->MaintainMapData->CurrentNvData.LegacyBEV;
break;
default:
DEBUG ((EFI_D_ERROR, "Invalid command ID for updating page!\n"));
return;
}
HiiSetString (mLegacyBootOptionPrivate->HiiHandle, STRING_TOKEN(STR_ORDER_CHANGE_PROMPT), FormTitle, NULL);
CreateLegacyMenuStringToken (mLegacyBootOptionPrivate->HiiHandle, OptionMenu);
OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (OptionsOpCodeHandle != NULL);
for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
NewMenuEntry = GetMenuEntry (OptionMenu, Index);
//
// Create OneOf for each legacy device
//
HiiCreateOneOfOptionOpCode (
OptionsOpCodeHandle,
NewMenuEntry->DisplayStringToken,
0,
EFI_IFR_TYPE_NUM_SIZE_16,
((LEGACY_DEVICE_CONTEXT *) NewMenuEntry->VariableContext)->BbsIndex
);
}
//
// Create OneOf for item "Disabled"
//
HiiCreateOneOfOptionOpCode (
OptionsOpCodeHandle,
STRING_TOKEN (STR_DISABLE_LEGACY_DEVICE),
0,
EFI_IFR_TYPE_NUM_SIZE_16,
0xFF
);
//
// Create oneof tag here for FD/HD/CD #1 #2
//
for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
示例10: InitializeDrivers
/**
Create dynamic code for BMM.
@param BmmCallbackInfo The BMM context data.
**/
VOID
InitializeDrivers(
IN BMM_CALLBACK_DATA *BmmCallbackInfo
)
{
EFI_HII_HANDLE HiiHandle;
VOID *StartOpCodeHandle;
VOID *EndOpCodeHandle;
EFI_IFR_GUID_LABEL *StartLabel;
EFI_IFR_GUID_LABEL *EndLabel;
UINTN Index;
EFI_STRING_ID FormSetTitle;
EFI_STRING_ID FormSetHelp;
EFI_STRING String;
EFI_STRING_ID Token;
EFI_STRING_ID TokenHelp;
EFI_HII_HANDLE *HiiHandles;
UINTN SkipCount;
EFI_GUID FormSetGuid;
CHAR16 *DevicePathStr;
EFI_STRING_ID DevicePathId;
HiiHandle = BmmCallbackInfo->BmmHiiHandle;
//
// Allocate space for creation of UpdateData Buffer
//
StartOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (StartOpCodeHandle != NULL);
EndOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (EndOpCodeHandle != NULL);
//
// Create Hii Extend Label OpCode as the start opcode
//
StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
StartLabel->Number = LABEL_BMM_PLATFORM_INFORMATION;
//
// Create Hii Extend Label OpCode as the end opcode
//
EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
EndLabel->Number = LABEL_END;
//
// Get all the Hii handles
//
HiiHandles = HiiGetHiiHandles (NULL);
ASSERT (HiiHandles != NULL);
//
// Search for formset of each class type
//
SkipCount = 0;
for (Index = 0; HiiHandles[Index] != NULL; Index++) {
if (!ExtractDisplayedHiiFormFromHiiHandle (HiiHandles[Index], &gEfiIfrBootMaintenanceGuid, SkipCount, &FormSetTitle, &FormSetHelp, &FormSetGuid)) {
SkipCount = 0;
continue;
}
String = HiiGetString (HiiHandles[Index], FormSetTitle, NULL);
if (String == NULL) {
String = HiiGetString (HiiHandle, STR_MISSING_STRING, NULL);
ASSERT (String != NULL);
}
Token = HiiSetString (HiiHandle, 0, String, NULL);
FreePool (String);
String = HiiGetString (HiiHandles[Index], FormSetHelp, NULL);
if (String == NULL) {
String = HiiGetString (HiiHandle, STR_MISSING_STRING, NULL);
ASSERT (String != NULL);
}
TokenHelp = HiiSetString (HiiHandle, 0, String, NULL);
FreePool (String);
DevicePathStr = ExtractDevicePathFromHiiHandle(HiiHandles[Index]);
DevicePathId = 0;
if (DevicePathStr != NULL){
DevicePathId = HiiSetString (HiiHandle, 0, DevicePathStr, NULL);
FreePool (DevicePathStr);
}
HiiCreateGotoExOpCode (
StartOpCodeHandle,
0,
Token,
TokenHelp,
0,
(EFI_QUESTION_ID) (Index + FRONT_PAGE_KEY_OFFSET),
0,
&FormSetGuid,
DevicePathId
//.........这里部分代码省略.........
示例11: CallBootManager
/**
This function invokes Boot Manager. If all devices have not a chance to be connected,
the connect all will be triggered. It then enumerate all boot options. If
a boot option from the Boot Manager page is selected, Boot Manager will boot
from this boot option.
**/
VOID
CallBootManager (
VOID
)
{
EFI_STATUS Status;
BDS_COMMON_OPTION *Option;
LIST_ENTRY *Link;
CHAR16 *ExitData;
UINTN ExitDataSize;
EFI_STRING_ID Token;
EFI_INPUT_KEY Key;
CHAR16 *HelpString;
UINTN HelpSize;
EFI_STRING_ID HelpToken;
UINT16 *TempStr;
EFI_HII_HANDLE HiiHandle;
EFI_BROWSER_ACTION_REQUEST ActionRequest;
VOID *StartOpCodeHandle;
VOID *EndOpCodeHandle;
EFI_IFR_GUID_LABEL *StartLabel;
EFI_IFR_GUID_LABEL *EndLabel;
UINT16 DeviceType;
BOOLEAN IsLegacyOption;
BOOLEAN NeedEndOp;
DeviceType = (UINT16) -1;
gOption = NULL;
InitializeListHead (&mBootOptionsList);
//
// Connect all prior to entering the platform setup menu.
//
if (!gConnectAllHappened) {
BdsLibConnectAllDriversToAllControllers ();
gConnectAllHappened = TRUE;
}
BdsLibEnumerateAllBootOption (&mBootOptionsList);
//
// Group the legacy boot options for the same device type
//
GroupMultipleLegacyBootOption4SameType ();
InitializeListHead (&mBootOptionsList);
BdsLibBuildOptionFromVar (&mBootOptionsList, L"BootOrder");
HiiHandle = gBootManagerPrivate.HiiHandle;
//
// Allocate space for creation of UpdateData Buffer
//
StartOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (StartOpCodeHandle != NULL);
EndOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (EndOpCodeHandle != NULL);
//
// Create Hii Extend Label OpCode as the start opcode
//
StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
StartLabel->Number = LABEL_BOOT_OPTION;
//
// Create Hii Extend Label OpCode as the end opcode
//
EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
EndLabel->Number = LABEL_BOOT_OPTION_END;
mKeyInput = 0;
NeedEndOp = FALSE;
for (Link = GetFirstNode (&mBootOptionsList); !IsNull (&mBootOptionsList, Link); Link = GetNextNode (&mBootOptionsList, Link)) {
Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
//
// At this stage we are creating a menu entry, thus the Keys are reproduceable
//
mKeyInput++;
//
// Don't display the hidden/inactive boot option
//
if (((Option->Attribute & LOAD_OPTION_HIDDEN) != 0) || ((Option->Attribute & LOAD_OPTION_ACTIVE) == 0)) {
continue;
}
//
// Group the legacy boot option in the sub title created dynamically
//
//.........这里部分代码省略.........
示例12: InitializeFrontPage
/**
Initialize HII information for the FrontPage
@param InitializeHiiData TRUE if HII elements need to be initialized.
@retval EFI_SUCCESS The operation is successful.
@retval EFI_DEVICE_ERROR If the dynamic opcode creation failed.
**/
EFI_STATUS
InitializeFrontPage (
IN BOOLEAN InitializeHiiData
)
{
EFI_STATUS Status;
CHAR8 *LangCode;
CHAR8 *Lang;
CHAR8 *CurrentLang;
UINTN OptionCount;
CHAR16 *StringBuffer;
EFI_HII_HANDLE HiiHandle;
VOID *OptionsOpCodeHandle;
VOID *StartOpCodeHandle;
VOID *EndOpCodeHandle;
EFI_IFR_GUID_LABEL *StartLabel;
EFI_IFR_GUID_LABEL *EndLabel;
EFI_HII_STRING_PROTOCOL *HiiString;
UINTN StringSize;
Lang = NULL;
StringBuffer = NULL;
if (InitializeHiiData) {
//
// Initialize the Device Manager
//
InitializeDeviceManager ();
//
// Initialize the Device Manager
//
InitializeBootManager ();
gCallbackKey = 0;
//
// Locate Hii relative protocols
//
Status = gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid, NULL, (VOID **) &gFormBrowser2);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Install Device Path Protocol and Config Access protocol to driver handle
//
Status = gBS->InstallMultipleProtocolInterfaces (
&gFrontPagePrivate.DriverHandle,
&gEfiDevicePathProtocolGuid,
&mFrontPageHiiVendorDevicePath,
&gEfiHiiConfigAccessProtocolGuid,
&gFrontPagePrivate.ConfigAccess,
NULL
);
ASSERT_EFI_ERROR (Status);
//
// Publish our HII data
//
gFrontPagePrivate.HiiHandle = HiiAddPackages (
&gFrontPageFormSetGuid,
gFrontPagePrivate.DriverHandle,
FrontPageVfrBin,
BdsDxeStrings,
NULL
);
if (gFrontPagePrivate.HiiHandle == NULL) {
return EFI_OUT_OF_RESOURCES;
}
}
//
// Init OpCode Handle and Allocate space for creation of UpdateData Buffer
//
StartOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (StartOpCodeHandle != NULL);
EndOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (EndOpCodeHandle != NULL);
OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (OptionsOpCodeHandle != NULL);
//
// Create Hii Extend Label OpCode as the start opcode
//
StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
StartLabel->Number = LABEL_SELECT_LANGUAGE;
//.........这里部分代码省略.........
示例13: DriverHealthManagerUpdateForm
/**
Update the form to include the driver health instances.
@param ConfigureOnly Only include the configure required driver health instances
when TRUE, include all the driver health instances otherwise.
**/
VOID
DriverHealthManagerUpdateForm (
BOOLEAN ConfigureOnly
)
{
EFI_STATUS Status;
EFI_IFR_GUID_LABEL *StartLabel;
EFI_IFR_GUID_LABEL *EndLabel;
VOID *StartOpCodeHandle;
VOID *EndOpCodeHandle;
UINTN Index;
EFI_STRING_ID Prompt;
EFI_STRING_ID Help;
CHAR16 String[512];
UINTN StringCount;
EFI_STRING TmpString;
EFI_STRING DriverName;
EFI_STRING ControllerName;
UINTN MessageIndex;
EFI_HANDLE DriverHandle;
EFI_STRING_ID DevicePath;
EFI_GUID FormsetGuid;
EfiBootManagerFreeDriverHealthInfo (mDriverHealthManagerHealthInfo, mDriverHealthManagerHealthInfoCount);
mDriverHealthManagerHealthInfo = EfiBootManagerGetDriverHealthInfo (&mDriverHealthManagerHealthInfoCount);
//
// Allocate space for creation of UpdateData Buffer
//
StartOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (StartOpCodeHandle != NULL);
EndOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (EndOpCodeHandle != NULL);
//
// Create Hii Extend Label OpCode as the start opcode
//
StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
StartLabel->Number = LABEL_BEGIN;
//
// Create Hii Extend Label OpCode as the end opcode
//
EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
EndLabel->Number = LABEL_END;
for (Index = 0; Index < mDriverHealthManagerHealthInfoCount; Index++) {
if (ConfigureOnly && mDriverHealthManagerHealthInfo[Index].HealthStatus != EfiDriverHealthStatusConfigurationRequired) {
continue;
}
DriverName = DriverHealthManagerGetDriverName (mDriverHealthManagerHealthInfo[Index].DriverHealthHandle);
ASSERT (DriverName != NULL);
if (mDriverHealthManagerHealthInfo[Index].ControllerHandle == NULL) {
//
// The ControllerHandle is set to NULL and the HealthStatus is set to EfiDriverHealthStatusHealthy
// if all the controllers managed by the driver are in healthy state.
//
ASSERT (mDriverHealthManagerHealthInfo[Index].HealthStatus == EfiDriverHealthStatusHealthy);
UnicodeSPrint (String, sizeof (String), L"%s", DriverName);
} else {
ControllerName = DriverHealthManagerGetControllerName (
mDriverHealthManagerHealthInfo[Index].DriverHealthHandle,
mDriverHealthManagerHealthInfo[Index].ControllerHandle,
mDriverHealthManagerHealthInfo[Index].ChildHandle
);
ASSERT (ControllerName != NULL);
UnicodeSPrint (String, sizeof (String), L"%s %s", DriverName, ControllerName);
FreePool (ControllerName);
}
FreePool (DriverName);
Prompt = HiiSetString (mDriverHealthManagerHiiHandle, 0, String, NULL);
switch(mDriverHealthManagerHealthInfo[Index].HealthStatus) {
case EfiDriverHealthStatusRepairRequired:
TmpString = HiiGetString (mDriverHealthManagerHiiHandle, STRING_TOKEN (STR_REPAIR_REQUIRED), NULL);
break;
case EfiDriverHealthStatusConfigurationRequired:
TmpString = HiiGetString (mDriverHealthManagerHiiHandle, STRING_TOKEN (STR_CONFIGURATION_REQUIRED), NULL);
break;
case EfiDriverHealthStatusFailed:
TmpString = HiiGetString (mDriverHealthManagerHiiHandle, STRING_TOKEN (STR_FAILED), NULL);
break;
case EfiDriverHealthStatusReconnectRequired:
TmpString = HiiGetString (mDriverHealthManagerHiiHandle, STRING_TOKEN (STR_RECONNECT_REQUIRED), NULL);
break;
case EfiDriverHealthStatusRebootRequired:
TmpString = HiiGetString (mDriverHealthManagerHiiHandle, STRING_TOKEN (STR_REBOOT_REQUIRED), NULL);
break;
default:
//.........这里部分代码省略.........
示例14: InitializeBM
//.........这里部分代码省略.........
NULL
);
if (EFI_ERROR (Status)) {
goto Exit;
}
//
// Post our Boot Maint VFR binary to the HII database.
//
BmmCallbackInfo->BmmHiiHandle = HiiAddPackages (
&gBootMaintFormSetGuid,
BmmCallbackInfo->BmmDriverHandle,
BmBin,
BdsDxeStrings,
NULL
);
ASSERT (BmmCallbackInfo->BmmHiiHandle != NULL);
//
// Post our File Explorer VFR binary to the HII database.
//
BmmCallbackInfo->FeHiiHandle = HiiAddPackages (
&gFileExploreFormSetGuid,
BmmCallbackInfo->FeDriverHandle,
FEBin,
BdsDxeStrings,
NULL
);
ASSERT (BmmCallbackInfo->FeHiiHandle != NULL);
//
// Init OpCode Handle and Allocate space for creation of Buffer
//
mStartOpCodeHandle = HiiAllocateOpCodeHandle ();
if (mStartOpCodeHandle == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Exit;
}
mEndOpCodeHandle = HiiAllocateOpCodeHandle ();
if (mEndOpCodeHandle == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Exit;
}
//
// Create Hii Extend Label OpCode as the start opcode
//
mStartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (mStartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
mStartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
//
// Create Hii Extend Label OpCode as the end opcode
//
mEndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (mEndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
mEndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
mEndLabel->Number = LABEL_END;
InitializeStringDepository ();
InitAllMenu (BmmCallbackInfo);
CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &ConsoleInpMenu);
CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &ConsoleOutMenu);
CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &ConsoleErrMenu);
CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &BootOptionMenu);
示例15: SelectUserToDelete
/**
Display user select form, cab select a user to delete.
**/
VOID
SelectUserToDelete (
VOID
)
{
EFI_STATUS Status;
UINT8 Index;
EFI_USER_PROFILE_HANDLE User;
EFI_USER_PROFILE_HANDLE CurrentUser;
VOID *StartOpCodeHandle;
VOID *EndOpCodeHandle;
EFI_IFR_GUID_LABEL *StartLabel;
EFI_IFR_GUID_LABEL *EndLabel;
//
// Initialize the container for dynamic opcodes.
//
StartOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (StartOpCodeHandle != NULL);
EndOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (EndOpCodeHandle != NULL);
//
// Create Hii Extend Label OpCode.
//
StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
StartOpCodeHandle,
&gEfiIfrTianoGuid,
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
StartLabel->Number = LABEL_USER_DEL_FUNC;
EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
EndOpCodeHandle,
&gEfiIfrTianoGuid,
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
EndLabel->Number = LABEL_END;
//
// Add each user can be deleted.
//
User = NULL;
Index = 1;
mUserManager->Current (mUserManager, &CurrentUser);
while (TRUE) {
Status = mUserManager->GetNext (mUserManager, &User);
if (EFI_ERROR (Status)) {
break;
}
if (User != CurrentUser) {
AddUserToForm (
User,
(UINT16)(KEY_DEL_USER | KEY_SELECT_USER | Index),
StartOpCodeHandle
);
}
Index++;
}
HiiUpdateForm (
mCallbackInfo->HiiHandle, // HII handle
&gUserProfileManagerGuid, // Formset GUID
FORMID_DEL_USER, // Form ID
StartOpCodeHandle, // Label for where to insert opcodes
EndOpCodeHandle // Replace data
);
HiiFreeOpCodeHandle (StartOpCodeHandle);
HiiFreeOpCodeHandle (EndOpCodeHandle);
}