本文整理汇总了C++中HiiSetString函数的典型用法代码示例。如果您正苦于以下问题:C++ HiiSetString函数的具体用法?C++ HiiSetString怎么用?C++ HiiSetString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HiiSetString函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CreateMenuStringToken
/**
Create string tokens for a menu from its help strings and display strings
@param CallbackData The BMM context data.
@param HiiHandle Hii Handle of the package to be updated.
@param MenuOption The Menu whose string tokens need to be created
@retval EFI_SUCCESS String tokens created successfully
@retval others contain some errors
**/
EFI_STATUS
CreateMenuStringToken (
IN BMM_CALLBACK_DATA *CallbackData,
IN EFI_HII_HANDLE HiiHandle,
IN BM_MENU_OPTION *MenuOption
)
{
BM_MENU_ENTRY *NewMenuEntry;
UINTN Index;
for (Index = 0; Index < MenuOption->MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (MenuOption, Index);
NewMenuEntry->DisplayStringToken = HiiSetString (
HiiHandle,
0,
NewMenuEntry->DisplayString,
NULL
);
if (NULL == NewMenuEntry->HelpString) {
NewMenuEntry->HelpStringToken = NewMenuEntry->DisplayStringToken;
} else {
NewMenuEntry->HelpStringToken = HiiSetString (
HiiHandle,
0,
NewMenuEntry->HelpString,
NULL
);
}
}
return EFI_SUCCESS;
}
开发者ID:Cutty,项目名称:edk2,代码行数:44,代码来源:BootMaint.c
示例2: CreateLegacyMenuStringToken
/**
Create string tokens for a menu from its help strings and display strings
@param HiiHandle Hii Handle of the package to be updated.
@param MenuOption The Menu whose string tokens need to be created
@retval EFI_SUCCESS String tokens created successfully
@retval others contain some errors
**/
VOID
CreateLegacyMenuStringToken (
IN EFI_HII_HANDLE HiiHandle,
IN LEGACY_MENU_OPTION *MenuOption
)
{
LEGACY_MENU_ENTRY *NewMenuEntry;
UINTN Index;
for (Index = 0; Index < MenuOption->MenuNumber; Index++) {
NewMenuEntry = GetMenuEntry (MenuOption, Index);
NewMenuEntry->DisplayStringToken = HiiSetString (
HiiHandle,
0,
NewMenuEntry->DisplayString,
NULL
);
if (NULL == NewMenuEntry->HelpString) {
NewMenuEntry->HelpStringToken = NewMenuEntry->DisplayStringToken;
} else {
NewMenuEntry->HelpStringToken = HiiSetString (
HiiHandle,
0,
NewMenuEntry->HelpString,
NULL
);
}
}
}
开发者ID:FrozenXZeus,项目名称:edk2,代码行数:40,代码来源:LegacyBootMaintUi.c
示例3: UpdateOptionPage
/**
Update add boot/driver option page.
@param CallbackData The BMM context data.
@param FormId The form ID to be updated.
@param DevicePath Device path.
**/
VOID
UpdateOptionPage(
IN BMM_CALLBACK_DATA *CallbackData,
IN EFI_FORM_ID FormId,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
CHAR16 *String;
EFI_STRING_ID StringToken;
if (DevicePath != NULL){
String = ExtractFileNameFromDevicePath(DevicePath);
StringToken = HiiSetString (CallbackData->BmmHiiHandle, 0, String, NULL);
FreePool(String);
} else {
String = HiiGetString (CallbackData->BmmHiiHandle, STRING_TOKEN (STR_NULL_STRING), NULL);
ASSERT (String != NULL);
StringToken = HiiSetString (CallbackData->BmmHiiHandle, 0, String, NULL);
FreePool (String);
}
if(FormId == FORM_BOOT_ADD_ID){
if (!CallbackData->BmmFakeNvData.BootOptionChanged) {
ZeroMem (CallbackData->BmmFakeNvData.BootOptionalData, sizeof (CallbackData->BmmFakeNvData.BootOptionalData));
ZeroMem (CallbackData->BmmFakeNvData.BootDescriptionData, sizeof (CallbackData->BmmFakeNvData.BootDescriptionData));
}
} else if (FormId == FORM_DRV_ADD_FILE_ID){
if (!CallbackData->BmmFakeNvData.DriverOptionChanged) {
ZeroMem (CallbackData->BmmFakeNvData.DriverOptionalData, sizeof (CallbackData->BmmFakeNvData.DriverOptionalData));
ZeroMem (CallbackData->BmmFakeNvData.DriverDescriptionData, sizeof (CallbackData->BmmFakeNvData.DriverDescriptionData));
}
}
RefreshUpdateData();
mStartLabel->Number = FormId;
HiiCreateSubTitleOpCode (
mStartOpCodeHandle,
StringToken,
0,
0,
0
);
HiiUpdateForm (
CallbackData->BmmHiiHandle,
&mBootMaintGuid,
FormId,
mStartOpCodeHandle,// Label FormId
mEndOpCodeHandle // LABEL_END
);
}
开发者ID:wensunshine,项目名称:VisualUefi,代码行数:60,代码来源:UpdatePage.c
示例4: AddIdToMacDeviceList
/**
Save question id and prompt id to the mac device list.
If the same mac address has saved yet, no need to add more.
@param MacAddrString Mac address string.
@retval EFI_SUCCESS Add the item is successful.
@return Other values if failed to Add the item.
**/
BOOLEAN
AddIdToMacDeviceList (
IN EFI_STRING MacAddrString
)
{
MENU_INFO_ITEM *TempDeviceList;
UINTN Index;
EFI_STRING StoredString;
EFI_STRING_ID PromptId;
EFI_HII_HANDLE HiiHandle;
HiiHandle = gDeviceManagerPrivate.HiiHandle;
TempDeviceList = NULL;
for (Index = 0; Index < mMacDeviceList.CurListLen; Index ++) {
StoredString = HiiGetString (HiiHandle, mMacDeviceList.NodeList[Index].PromptId, NULL);
if (StoredString == NULL) {
return FALSE;
}
//
// Already has save the same mac address to the list.
//
if (StrCmp (MacAddrString, StoredString) == 0) {
return FALSE;
}
}
PromptId = HiiSetString(HiiHandle, 0, MacAddrString, NULL);
//
// If not in the list, save it.
//
if (mMacDeviceList.MaxListLen > mMacDeviceList.CurListLen + 1) {
mMacDeviceList.NodeList[mMacDeviceList.CurListLen].PromptId = PromptId;
mMacDeviceList.NodeList[mMacDeviceList.CurListLen].QuestionId = (EFI_QUESTION_ID) (mMacDeviceList.CurListLen + NETWORK_DEVICE_LIST_KEY_OFFSET);
} else {
mMacDeviceList.MaxListLen += MAX_MAC_ADDRESS_NODE_LIST_LEN;
if (mMacDeviceList.CurListLen != 0) {
TempDeviceList = (MENU_INFO_ITEM *)AllocateCopyPool (sizeof (MENU_INFO_ITEM) * mMacDeviceList.MaxListLen, (VOID *)mMacDeviceList.NodeList);
} else {
TempDeviceList = (MENU_INFO_ITEM *)AllocatePool (sizeof (MENU_INFO_ITEM) * mMacDeviceList.MaxListLen);
}
if (TempDeviceList == NULL) {
return FALSE;
}
TempDeviceList[mMacDeviceList.CurListLen].PromptId = PromptId;
TempDeviceList[mMacDeviceList.CurListLen].QuestionId = (EFI_QUESTION_ID) (mMacDeviceList.CurListLen + NETWORK_DEVICE_LIST_KEY_OFFSET);
if (mMacDeviceList.CurListLen > 0) {
FreePool(mMacDeviceList.NodeList);
}
mMacDeviceList.NodeList = TempDeviceList;
}
mMacDeviceList.CurListLen ++;
return TRUE;
}
开发者ID:wensunshine,项目名称:VisualUefi,代码行数:68,代码来源:DeviceManager.c
示例5: AddDevicePath
/**
Create an action OpCode with QuestionID and DevicePath on a given OpCodeHandle.
@param[in] QuestionID The question ID.
@param[in] DevicePath Points to device path.
@param[in] OpCodeHandle Points to container for dynamic created opcodes.
**/
VOID
AddDevicePath (
IN UINTN QuestionID,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN VOID *OpCodeHandle
)
{
EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *Next;
EFI_STRING_ID NameID;
EFI_STRING DriverName;
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevicePathText;
//
// Locate device path to text protocol.
//
Status = gBS->LocateProtocol (
&gEfiDevicePathToTextProtocolGuid,
NULL,
(VOID **) &DevicePathText
);
if (EFI_ERROR (Status)) {
return ;
}
//
// Get driver file name node.
//
Next = DevicePath;
while (!IsDevicePathEnd (Next)) {
DevicePath = Next;
Next = NextDevicePathNode (Next);
}
//
// Display the device path in form.
//
DriverName = DevicePathText->ConvertDevicePathToText (DevicePath, FALSE, FALSE);
NameID = HiiSetString (mCallbackInfo->HiiHandle, 0, DriverName, NULL);
FreePool (DriverName);
if (NameID == 0) {
return ;
}
HiiCreateActionOpCode (
OpCodeHandle, // Container for dynamic created opcodes
(UINT16) QuestionID, // Question ID
NameID, // Prompt text
STRING_TOKEN (STR_NULL_STRING), // Help text
EFI_IFR_FLAG_CALLBACK, // Question flag
0 // Action String ID
);
}
开发者ID:etiago,项目名称:vbox,代码行数:61,代码来源:ModifyAccessPolicy.c
示例6: 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;
}
开发者ID:hsienchieh,项目名称:uefilab,代码行数:72,代码来源:Platform.c
示例7: InstallProcessorSmbios
VOID
InstallProcessorSmbios (
IN VOID *Smbios
)
{
SMBIOS_STRUCTURE_POINTER SmbiosTable;
CHAR8 *AString;
CHAR16 *UString;
STRING_REF Token;
//
// Processor info (TYPE 4)
//
SmbiosTable = GetSmbiosTableFromType ((SMBIOS_TABLE_ENTRY_POINT *)Smbios, 4, 0);
if (SmbiosTable.Raw == NULL) {
DEBUG ((EFI_D_ERROR, "SmbiosTable: Type 4 (Processor Info) not found!\n"));
return ;
}
//
// Log Smbios Record Type4
//
LogSmbiosData(gSmbios,(UINT8*)SmbiosTable.Type4);
//
// Set ProcessorVersion string
//
AString = GetSmbiosString (SmbiosTable, SmbiosTable.Type4->ProcessorVersion);
UString = AllocateZeroPool ((AsciiStrLen(AString) + 1) * sizeof(CHAR16));
ASSERT (UString != NULL);
AsciiStrToUnicodeStr (AString, UString);
Token = HiiSetString (gStringHandle, 0, UString, NULL);
if (Token == 0) {
gBS->FreePool (UString);
return ;
}
gBS->FreePool (UString);
return ;
}
开发者ID:Gshoe2006,项目名称:edk2,代码行数:40,代码来源:SmbiosGen.c
示例8: TGetTouchFirmwareVersion
EFI_STATUS
TGetTouchFirmwareVersion(
)
{
EFI_STATUS rc=EFI_SUCCESS;
UINTN TouchVer = 0;
UINTN Size = sizeof(UINTN);
CHAR16 Buffer[40];
rc = gRT->GetVariable(
L"TouchVer",
&gEfiVlv2VariableGuid,
NULL,
&Size,
&TouchVer
);
if(!EFI_ERROR(rc)){
UnicodeSPrint(Buffer, sizeof(Buffer), L"%02x.%02x", (TouchVer&0xFFFF)>>8,TouchVer&0xFF);
HiiSetString(mHiiHandle, STRING_TOKEN(STR_MISC_TOUCH_VERSION), Buffer, NULL);
}
开发者ID:FishYu1222,项目名称:edk2,代码行数:22,代码来源:MiscOemType0x94Function.c
示例9: GetStringTokenFromDepository
/**
Fetch a usable string node from the string depository and return the string token.
@param CallbackData The BMM context data.
@param StringDepository The string repository.
@retval EFI_STRING_ID String token.
**/
EFI_STRING_ID
GetStringTokenFromDepository (
IN BMM_CALLBACK_DATA *CallbackData,
IN STRING_DEPOSITORY *StringDepository
)
{
STRING_LIST_NODE *CurrentListNode;
STRING_LIST_NODE *NextListNode;
CurrentListNode = StringDepository->CurrentNode;
if ((NULL != CurrentListNode) && (NULL != CurrentListNode->Next)) {
//
// Fetch one reclaimed node from the list.
//
NextListNode = StringDepository->CurrentNode->Next;
} else {
//
// If there is no usable node in the list, update the list.
//
NextListNode = AllocateZeroPool (sizeof (STRING_LIST_NODE));
ASSERT (NextListNode != NULL);
NextListNode->StringToken = HiiSetString (CallbackData->BmmHiiHandle, 0, L" ", NULL);
ASSERT (NextListNode->StringToken != 0);
StringDepository->TotalNodeNumber++;
if (NULL == CurrentListNode) {
StringDepository->ListHead = NextListNode;
} else {
CurrentListNode->Next = NextListNode;
}
}
StringDepository->CurrentNode = NextListNode;
return StringDepository->CurrentNode->StringToken;
}
开发者ID:Cutty,项目名称:edk2,代码行数:47,代码来源:BootMaint.c
示例10: UpdateFrontPageBannerStrings
/**
Update the banner information for the Front Page based on Smbios information.
**/
VOID
UpdateFrontPageBannerStrings (
VOID
)
{
UINT8 StrIndex;
CHAR16 *NewString;
CHAR16 *FirmwareVersionString;
EFI_STATUS Status;
EFI_SMBIOS_HANDLE SmbiosHandle;
EFI_SMBIOS_PROTOCOL *Smbios;
SMBIOS_TABLE_TYPE0 *Type0Record;
SMBIOS_TABLE_TYPE1 *Type1Record;
SMBIOS_TABLE_TYPE4 *Type4Record;
SMBIOS_TABLE_TYPE19 *Type19Record;
EFI_SMBIOS_TABLE_HEADER *Record;
UINT64 InstalledMemory;
BOOLEAN FoundCpu;
InstalledMemory = 0;
FoundCpu = 0;
//
// Update default banner string.
//
NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE4_LEFT), NULL);
UiCustomizeFrontPageBanner (4, TRUE, &NewString);
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE4_LEFT), NewString, NULL);
FreePool (NewString);
NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE4_RIGHT), NULL);
UiCustomizeFrontPageBanner (4, FALSE, &NewString);
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE4_RIGHT), NewString, NULL);
FreePool (NewString);
NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE5_LEFT), NULL);
UiCustomizeFrontPageBanner (5, TRUE, &NewString);
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE5_LEFT), NewString, NULL);
FreePool (NewString);
NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE5_RIGHT), NULL);
UiCustomizeFrontPageBanner (5, FALSE, &NewString);
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE5_RIGHT), NewString, NULL);
FreePool (NewString);
//
// Update Front Page banner strings base on SmBios Table.
//
Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **) &Smbios);
if (EFI_ERROR (Status)) {
//
// Smbios protocol not found, get the default value.
//
NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL), NULL);
UiCustomizeFrontPageBanner (1, TRUE, &NewString);
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL), NewString, NULL);
FreePool (NewString);
NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL), NULL);
UiCustomizeFrontPageBanner (2, TRUE, &NewString);
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL), NewString, NULL);
FreePool (NewString);
NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED), NULL);
UiCustomizeFrontPageBanner (2, FALSE, &NewString);
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED), NewString, NULL);
FreePool (NewString);
NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION), NULL);
UiCustomizeFrontPageBanner (3, TRUE, &NewString);
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION), NewString, NULL);
FreePool (NewString);
NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE), NULL);
UiCustomizeFrontPageBanner (3, FALSE, &NewString);
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE), NewString, NULL);
FreePool (NewString);
return;
}
SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
Status = Smbios->GetNext (Smbios, &SmbiosHandle, NULL, &Record, NULL);
while (!EFI_ERROR(Status)) {
if (Record->Type == SMBIOS_TYPE_BIOS_INFORMATION) {
Type0Record = (SMBIOS_TABLE_TYPE0 *) Record;
StrIndex = Type0Record->BiosVersion;
GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type0Record + Type0Record->Hdr.Length), StrIndex, &NewString);
FirmwareVersionString = (CHAR16 *) PcdGetPtr (PcdFirmwareVersionString);
if (*FirmwareVersionString != 0x0000 ) {
FreePool (NewString);
NewString = (CHAR16 *) PcdGetPtr (PcdFirmwareVersionString);
UiCustomizeFrontPageBanner (3, TRUE, &NewString);
HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION), NewString, NULL);
//.........这里部分代码省略.........
开发者ID:pmj,项目名称:edk2,代码行数:101,代码来源:FrontPage.c
示例11: InstallMiscSmbios
VOID
InstallMiscSmbios (
IN VOID *Smbios
)
{
SMBIOS_STRUCTURE_POINTER SmbiosTable;
CHAR8 *AString;
CHAR16 *UString;
STRING_REF Token;
//
// BIOS information (TYPE 0)
//
SmbiosTable = GetSmbiosTableFromType ((SMBIOS_TABLE_ENTRY_POINT *)Smbios, 0, 0);
if (SmbiosTable.Raw == NULL) {
DEBUG ((EFI_D_ERROR, "SmbiosTable: Type 0 (BIOS Information) not found!\n"));
return ;
}
//
// Record Type 2
//
AString = GetSmbiosString (SmbiosTable, SmbiosTable.Type0->BiosVersion);
UString = AllocateZeroPool ((AsciiStrLen(AString) + 1) * sizeof(CHAR16) + sizeof(FIRMWARE_BIOS_VERSIONE));
ASSERT (UString != NULL);
CopyMem (UString, FIRMWARE_BIOS_VERSIONE, sizeof(FIRMWARE_BIOS_VERSIONE));
AsciiStrToUnicodeStr (AString, UString + sizeof(FIRMWARE_BIOS_VERSIONE) / sizeof(CHAR16) - 1);
Token = HiiSetString (gStringHandle, 0, UString, NULL);
if (Token == 0) {
gBS->FreePool (UString);
return ;
}
gBS->FreePool (UString);
//
// Log Smios Type 0
//
LogSmbiosData(gSmbios, (UINT8*)SmbiosTable.Type0);
//
// System information (TYPE 1)
//
SmbiosTable = GetSmbiosTableFromType ((SMBIOS_TABLE_ENTRY_POINT *)Smbios, 1, 0);
if (SmbiosTable.Raw == NULL) {
DEBUG ((EFI_D_ERROR, "SmbiosTable: Type 1 (System Information) not found!\n"));
return ;
}
//
// Record Type 3
//
AString = GetSmbiosString (SmbiosTable, SmbiosTable.Type1->ProductName);
UString = AllocateZeroPool ((AsciiStrLen(AString) + 1) * sizeof(CHAR16) + sizeof(FIRMWARE_PRODUCT_NAME));
ASSERT (UString != NULL);
CopyMem (UString, FIRMWARE_PRODUCT_NAME, sizeof(FIRMWARE_PRODUCT_NAME));
AsciiStrToUnicodeStr (AString, UString + sizeof(FIRMWARE_PRODUCT_NAME) / sizeof(CHAR16) - 1);
Token = HiiSetString (gStringHandle, 0, UString, NULL);
if (Token == 0) {
gBS->FreePool (UString);
return ;
}
gBS->FreePool (UString);
//
// Log Smbios Type 1
//
LogSmbiosData(gSmbios, (UINT8*)SmbiosTable.Type1);
return ;
}
开发者ID:Gshoe2006,项目名称:edk2,代码行数:72,代码来源:SmbiosGen.c
示例12: UpdateFrontPageStrings
/**
Update the banner information for the Front Page based on DataHub information.
**/
VOID
UpdateFrontPageStrings (
VOID
)
{
UINT8 StrIndex;
CHAR16 *NewString;
BOOLEAN Find[5];
EFI_STATUS Status;
EFI_STRING_ID TokenToUpdate;
EFI_SMBIOS_HANDLE SmbiosHandle;
EFI_SMBIOS_PROTOCOL *Smbios;
SMBIOS_TABLE_TYPE0 *Type0Record;
SMBIOS_TABLE_TYPE1 *Type1Record;
SMBIOS_TABLE_TYPE4 *Type4Record;
SMBIOS_TABLE_TYPE19 *Type19Record;
EFI_SMBIOS_TABLE_HEADER *Record;
ZeroMem (Find, sizeof (Find));
//
// Update Front Page strings
//
Status = gBS->LocateProtocol (
&gEfiSmbiosProtocolGuid,
NULL,
(VOID **) &Smbios
);
if (!EFI_ERROR (Status)) {
SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
do {
Status = Smbios->GetNext (Smbios, &SmbiosHandle, NULL, &Record, NULL);
if (EFI_ERROR(Status)) {
break;
}
if (Record->Type == EFI_SMBIOS_TYPE_BIOS_INFORMATION) {
Type0Record = (SMBIOS_TABLE_TYPE0 *) Record;
StrIndex = Type0Record->BiosVersion;
GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type0Record + Type0Record->Hdr.Length), StrIndex, &NewString);
TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION);
HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
FreePool (NewString);
Find[0] = TRUE;
}
if (Record->Type == EFI_SMBIOS_TYPE_SYSTEM_INFORMATION) {
Type1Record = (SMBIOS_TABLE_TYPE1 *) Record;
StrIndex = Type1Record->ProductName;
GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type1Record + Type1Record->Hdr.Length), StrIndex, &NewString);
TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL);
HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
FreePool (NewString);
Find[1] = TRUE;
}
if (Record->Type == EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION) {
Type4Record = (SMBIOS_TABLE_TYPE4 *) Record;
StrIndex = Type4Record->ProcessorVersion;
GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type4Record + Type4Record->Hdr.Length), StrIndex, &NewString);
TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL);
HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
FreePool (NewString);
Find[2] = TRUE;
}
if (Record->Type == EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION) {
Type4Record = (SMBIOS_TABLE_TYPE4 *) Record;
ConvertProcessorToString(Type4Record->CurrentSpeed, 6, &NewString);
TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED);
HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
FreePool (NewString);
Find[3] = TRUE;
}
if ( Record->Type == EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS ) {
Type19Record = (SMBIOS_TABLE_TYPE19 *) Record;
ConvertMemorySizeToString (
(UINT32)(RShiftU64((Type19Record->EndingAddress - Type19Record->StartingAddress + 1), 10)),
&NewString
);
TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE);
HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL);
FreePool (NewString);
Find[4] = TRUE;
}
} while ( !(Find[0] && Find[1] && Find[2] && Find[3] && Find[4]));
}
return ;
}
开发者ID:OznOg,项目名称:edk2,代码行数:94,代码来源:FrontPage.c
示例13: InstallVlanConfigForm
/**
This function publish the VLAN configuration Form for a network device. The
HII Config Access protocol will be installed on a child handle of the network
device.
@param[in, out] PrivateData Points to VLAN configuration private data.
@retval EFI_SUCCESS HII Form is installed for this network device.
@retval EFI_OUT_OF_RESOURCES Not enough resource for HII Form installation.
@retval Others Other errors as indicated.
**/
EFI_STATUS
InstallVlanConfigForm (
IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData
)
{
EFI_STATUS Status;
EFI_HII_HANDLE HiiHandle;
EFI_HANDLE DriverHandle;
CHAR16 Str[26 + sizeof (EFI_MAC_ADDRESS) * 2 + 1];
CHAR16 *MacString;
EFI_DEVICE_PATH_PROTOCOL *ChildDevicePath;
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
EFI_VLAN_CONFIG_PROTOCOL *VlanConfig;
//
// Create child handle and install HII Config Access Protocol
//
ChildDevicePath = AppendDevicePathNode (
PrivateData->ParentDevicePath,
(CONST EFI_DEVICE_PATH_PROTOCOL *) &mHiiVendorDevicePathNode
);
if (ChildDevicePath == NULL) {
return EFI_OUT_OF_RESOURCES;
}
PrivateData->ChildDevicePath = ChildDevicePath;
DriverHandle = NULL;
ConfigAccess = &PrivateData->ConfigAccess;
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverHandle,
&gEfiDevicePathProtocolGuid,
ChildDevicePath,
&gEfiHiiConfigAccessProtocolGuid,
ConfigAccess,
NULL
);
if (EFI_ERROR (Status)) {
return Status;
}
PrivateData->DriverHandle = DriverHandle;
//
// Establish the parent-child relationship between the new created
// child handle and the ControllerHandle.
//
Status = gBS->OpenProtocol (
PrivateData->ControllerHandle,
&gEfiVlanConfigProtocolGuid,
(VOID **)&VlanConfig,
PrivateData->ImageHandle,
PrivateData->DriverHandle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Publish the HII package list
//
HiiHandle = HiiAddPackages (
&gVlanConfigFormSetGuid,
DriverHandle,
VlanConfigDxeStrings,
VlanConfigBin,
NULL
);
if (HiiHandle == NULL) {
return EFI_OUT_OF_RESOURCES;
}
PrivateData->HiiHandle = HiiHandle;
//
// Update formset title help string.
//
MacString = NULL;
Status = NetLibGetMacString (PrivateData->ControllerHandle, PrivateData->ImageHandle, &MacString);
if (EFI_ERROR (Status)) {
return Status;
}
PrivateData->MacString = MacString;
StrCpy (Str, L"VLAN Configuration (MAC:");
StrnCat (Str, MacString, sizeof (EFI_MAC_ADDRESS) * 2);
StrCat (Str, L")");
HiiSetString (
HiiHandle,
STRING_TOKEN (STR_VLAN_FORM_SET_TITLE_HELP),
//.........这里部分代码省略.........
开发者ID:ChenFanFnst,项目名称:edk2,代码行数:101,代码来源:VlanConfigImpl.c
示例14: InitializeFrontPage
//.........这里部分代码省略.........
OptionCount ++;
}
//
// Allocate extra 1 as the end tag.
//
gFrontPagePrivate.LanguageToken = AllocateZeroPool ((OptionCount + 1) * sizeof (EFI_STRING_ID));
ASSERT (gFrontPagePrivate.LanguageToken != NULL);
Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &HiiString);
ASSERT_EFI_ERROR (Status);
LangCode = mLanguageString;
OptionCount = 0;
while (*LangCode != 0) {
GetNextLanguage (&LangCode, Lang);
StringSize = 0;
Status = HiiString->GetString (HiiString, Lang, HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, StringBuffer, &StringSize, NULL);
if (Status == EFI_BUFFER_TOO_SMALL) {
StringBuffer = AllocateZeroPool (StringSize);
ASSERT (StringBuffer != NULL);
Status = HiiString->GetString (HiiString, Lang, HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, StringBuffer, &StringSize, NULL);
ASSERT_EFI_ERROR (Status);
}
if (EFI_ERROR (Status)) {
StringBuffer = AllocatePool (AsciiStrSize (Lang) * sizeof (CHAR16));
ASSERT (StringBuffer != NULL);
AsciiStrToUnicodeStr (Lang, StringBuffer);
}
ASSERT (StringBuffer != NULL);
gFrontPagePrivate.LanguageToken[OptionCount] = HiiSetString (HiiHandle, 0, StringBuffer, NULL);
FreePool (StringBuffer);
OptionCount++;
}
}
ASSERT (gFrontPagePrivate.LanguageToken != NULL);
LangCode = mLanguageString;
OptionCount = 0;
if (Lang == NULL) {
Lang = AllocatePool (AsciiStrSize (mLanguageString));
ASSERT (Lang != NULL);
}
while (*LangCode != 0) {
GetNextLanguage (&LangCode, Lang);
if (CurrentLang != NULL && AsciiStrCmp (Lang, CurrentLang) == 0) {
HiiCreateOneOfOptionOpCode (
OptionsOpCodeHandle,
gFrontPagePrivate.LanguageToken[OptionCount],
EFI_IFR_OPTION_DEFAULT,
EFI_IFR_NUMERIC_SIZE_1,
(UINT8) OptionCount
);
} else {
HiiCreateOneOfOptionOpCode (
OptionsOpCodeHandle,
gFrontPagePrivate.LanguageToken[OptionCount],
0,
EFI_IFR_NUMERIC_SIZE_1,
(UINT8) OptionCount
);
开发者ID:OznOg,项目名称:edk2,代码行数:67,代码来源:FrontPage.c
示例15: LibFindFiles
//.........这里部分代码省略.........
FILE_CONTEXT *NewFileContext;
UINTN Pass;
EFI_STATUS Status;
UINTN OptionNumber;
OptionNumber = 0;
DirBufferSize = sizeof (EFI_FILE_INFO) + 1024;
DirInfo = AllocateZeroPool (DirBufferSize);
if (DirInfo == NULL) {
return EFI_OUT_OF_RESOURCES;
}
//
// Get all files in current directory
// Pass 1 to get Directories
// Pass 2 to get files that are EFI images
//
Status = EFI_SUCCESS;
for (Pass = 1; Pass <= 2; Pass++) {
FileHandle->SetPosition (FileHandle, 0);
for (;;) {
BufferSize = DirBufferSize;
Status = FileHandle->Read (FileHandle, &BufferSize, DirInfo);
if (EFI_ERROR (Status) || BufferSize == 0) {
Status = EFI_SUCCESS;
break;
}
if (((DirInfo->Attribute & EFI_FILE_DIRECTORY) != 0 && Pass == 2) ||
((DirInfo->Attribute & EFI_FILE_DIRECTORY) == 0 && Pass == 1)
) {
//
// Pass 1 is for Directories
// Pass 2 is for file names
//
continue;
}
if (!((DirInfo->Attribute & EFI_FILE_DIRECTORY) != 0 || LibIsSupportedFileType (DirInfo->FileName))) {
//
// Slip file unless it is a directory entry or a .EFI file
//
continue;
}
NewMenuEntry = LibCreateMenuEntry ();
if (NULL == NewMenuEntry) {
Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
NewFileContext = (FILE_CONTEXT *) NewMenuEntry->VariableContext;
NewFileContext->DeviceHandle = DeviceHandle;
NewFileContext->FileName = LibAppendFileName (FileName, DirInfo->FileName);
if (NewFileContext->FileName == NULL) {
LibDestroyMenuEntry (NewMenuEntry);
Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
NewFileContext->FileHandle = FileHandle;
NewFileContext->DevicePath = FileDevicePath (NewFileContext->DeviceHandle, NewFileContext->FileName);
NewMenuEntry->HelpString = NULL;
NewFileContext->IsDir = (BOOLEAN) ((DirInfo->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY);
if (NewFileContext->IsDir) {
BufferSize = StrLen (DirInfo->FileName) * 2 + 6;
NewMenuEntry->DisplayString = AllocateZeroPool (BufferSize);
UnicodeSPrint (
NewMenuEntry->DisplayString,
BufferSize,
L"<%s>",
DirInfo->FileName
);
} else {
NewMenuEntry->DisplayString = LibStrDuplicate (DirInfo->FileName);
}
NewMenuEntry->DisplayStringToken = HiiSetString (
gFileExplorerPrivate.FeHiiHandle,
0,
NewMenuEntry->DisplayString,
NULL
);
NewFileContext->IsRoot = FALSE;
OptionNumber++;
InsertTailList (&gFileExplorerPrivate.FsOptionMenu->Head, &NewMenuEntry->Link);
}
}
gFileExplorerPrivate.FsOptionMenu->MenuNumber = OptionNumber;
Done:
FreePool (DirInfo);
return Status;
}
开发者ID:kraxel,项目名称:edk2,代码行数:101,代码来源:FileExplorer.c
示例16: UpdateBootManager
//.........这里部分代码省略.........
//
// 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 (Index = 0; Index < BootOptionCount; Index++) {
//
// At this stage we are creating a menu entry, thus the Keys are reproduceable
//
mKeyInput++;
//
// Don't display the hidden/inactive boot option
//
if (((BootOption[Index].Attributes & LOAD_OPTION_HIDDEN) != 0) || ((BootOption[Index].Attributes & LOAD_OPTION_ACTIVE) == 0)) {
continue;
}
//
// Group the legacy boot option in the sub title created dynamically
//
IsLegacyOption = (BOOLEAN) (
(DevicePathType (BootOption[Index].FilePath) == BBS_DEVICE_PATH) &&
(DevicePathSubType (BootOption[Index].FilePath) == BBS_BBS_DP)
);
if (!IsLegacyOption && NeedEndOp) {
NeedEndOp = FALSE;
HiiCreateEndOpCode (StartOpCodeHandle);
}
if (IsLegacyOption && DeviceType != ((BBS_BBS_DEVICE_PATH *) BootOption[Index].FilePath)->DeviceType) {
if (NeedEndOp) {
HiiCreateEndOpCode (StartOpCodeHandle);
}
DeviceType = ((BBS_BBS_DEVICE_PATH *) BootOption[Index].FilePath)->DeviceType;
Token = HiiSetString (
HiiHandle,
0,
mDeviceTypeStr[
MIN (DeviceType & 0xF, sizeof (mDeviceTypeStr) / sizeof (mDeviceTypeStr[0]) - 1)
],
NULL
);
HiiCreateSubTitleOpCode (StartOpCodeHandle, Token, 0, 0, 1);
NeedEndOp = TRUE;
}
ASSERT (BootOption[Index].Description != NULL);
Token = HiiSetString (HiiHandle, 0, BootOption[Index].Description, NULL);
TempStr = BmDevicePathToStr (BootOption[Index].FilePath);
TempSize = StrSize (TempStr);
HelpString = AllocateZeroPool (TempSize + StrSize (L"Device Path : "));
MaxLen = (TempSize + StrSize (L"Device Path : "))/sizeof(CHAR16);
ASSERT (HelpString != NULL);
StrCatS (HelpString, MaxLen, L"Device Path : ");
StrCatS (HelpString, MaxLen, TempStr);
HelpToken = HiiSetString (HiiHandle, 0, HelpString, NULL);
HiiCreateActionOpCode (
StartOpCodeHandle,
mKeyInput,
Token,
HelpToken,
EFI_IFR_FLAG_CALLBACK,
0
);
}
if (NeedEndOp) {
HiiCreateEndOpCode (StartOpCodeHandle);
}
HiiUpdateForm (
HiiHandle,
&mBootManagerGuid,
BOOT_MANAGER_FORM_ID,
StartOpCodeHandle,
EndOpCodeHandle
);
HiiFreeOpCodeHandle (StartOpCodeHandle);
HiiFreeOpCodeHandle (EndOpCodeHandle);
EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount);
}
开发者ID:wensunshine,项目名称:VisualUefi,代码行数:101,代码来源:BootManager.c
示例17: CreateDeviceManagerForm
/**
Dynamic create Hii information for Device Manager.
@param NextShowFormId The FormId which need to be show.
**/
VOID
CreateDeviceManagerForm(
IN EFI_FORM_ID NextShowFormId
)
{
UINTN Index;
EFI_STRING String;
EFI_STRING_ID Token;
EFI_STRING_ID TokenHelp;
EFI_HII_HANDLE *HiiHandles;
EFI_HII_HANDLE HiiHandle;
EFI_GUID FormSetGuid;
VOID *StartOpCodeHandle;
VOID *EndOpCodeHandle;
EFI_IFR_GUID_LABEL *StartLabel;
EFI_IFR_GUID_LABEL *EndLabel;
BOOLEAN AddNetworkMenu;
UINTN AddItemCount;
UINTN NewStringLen;
EFI_STRING NewStringTitle;
CHAR16 *DevicePathStr;
EFI_STRING_ID DevicePathId;
EFI_IFR_FORM_SET *Buffer;
UINTN BufferSize;
UINT8 ClassGuidNum;
EFI_GUID *ClassGuid;
UINTN TempSize;
UINT8 *Ptr;
EFI_STATUS Status;
TempSize =0;
BufferSize = 0;
Buffer = NULL;
HiiHandle = gDeviceManagerPrivate.HiiHandle;
AddNetworkMenu = FALSE;
AddItemCount = 0;
//
// If need show the Network device list form, clear the old save list first.
//
if ((NextShowFormId == NETWORK_DEVICE_LIST_FORM_ID) && (mMacDeviceList.CurListLen > 0)) {
mMacDeviceList.CurListLen = 0;
}
//
// Update the network device form titile.
//
if (NextShowFormId == NETWORK_DEVICE_FORM_ID) {
String = HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NULL);
NewStringLen = StrLen(mSelectedMacAddrString) * 2;
NewStringLen += (StrLen(String) + 2) * 2;
NewStringTitle = AllocatePool (NewStringLen);
UnicodeSPrint (NewStringTitle, NewStringLen, L"%s %s", String, mSelectedMacAddrString);
HiiSetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NewStringTitle, NULL);
FreePool (String);
FreePool (NewStringTitle);
}
//
// 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;
//
// According to the next show Form id(mNextShowFormId) to decide which form need to update.
//
StartLabel->Number = (UINT16) (LABEL_FORM_ID_OFFSET + NextShowFormId);
//
// 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
//
for (Index = 0; HiiHandles[Index] != NULL; Index++) {
//.........这里部分代码省略.........
|
请发表评论