这篇教程C++ HiiSetString函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中HiiSetString函数的典型用法代码示例。如果您正苦于以下问题:C++ HiiSetString函数的具体用法?C++ HiiSetString怎么用?C++ HiiSetString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了HiiSetString函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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_STATUSCreateMenuStringToken ( 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,
示例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**/VOIDCreateLegacyMenuStringToken ( 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,
示例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.**/VOIDUpdateOptionPage( 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,
示例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,
示例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.**/VOIDAddDevicePath ( 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,
示例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.**/STATICEFI_STATUSEFIAPICreateResolutionOptions ( 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,
示例7: InstallProcessorSmbiosVOIDInstallProcessorSmbios ( 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,
示例8: TGetTouchFirmwareVersionEFI_STATUSTGetTouchFirmwareVersion( ){ 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,
示例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_IDGetStringTokenFromDepository ( 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,
示例10: UpdateFrontPageBannerStrings/** Update the banner information for the Front Page based on Smbios information.**/VOIDUpdateFrontPageBannerStrings ( 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,
示例11: InstallMiscSmbiosVOIDInstallMiscSmbios ( 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,
示例12: UpdateFrontPageStrings/** Update the banner information for the Front Page based on DataHub information.**/VOIDUpdateFrontPageStrings ( 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,
示例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_STATUSInstallVlanConfigForm ( 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,
示例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,
示例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,
示例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,
示例17: CreateDeviceManagerForm/** Dynamic create Hii information for Device Manager. @param NextShowFormId The FormId which need to be show.**/VOIDCreateDeviceManagerForm( 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++) {//.........这里部分代码省略.........
开发者ID:wensunshine,项目名称:VisualUefi,代码行数:101,
示例18: Ip4Config2FormInit//.........这里部分代码省略......... VendorDeviceNode.Header.SubType = HW_VENDOR_DP; CopyGuid (&VendorDeviceNode.Guid, &gEfiCallerIdGuid); SetDevicePathNodeLength (&VendorDeviceNode.Header, sizeof (VENDOR_DEVICE_PATH)); CallbackInfo->HiiVendorDevicePath = AppendDevicePathNode ( ParentDevicePath, (EFI_DEVICE_PATH_PROTOCOL *) &VendorDeviceNode ); if (CallbackInfo->HiiVendorDevicePath == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Error; } ConfigAccess = &CallbackInfo->HiiConfigAccessProtocol; ConfigAccess->ExtractConfig = Ip4FormExtractConfig; ConfigAccess->RouteConfig = Ip4FormRouteConfig; ConfigAccess->Callback = Ip4FormCallback; // // Install Device Path Protocol and Config Access protocol on new handle // Status = gBS->InstallMultipleProtocolInterfaces ( &CallbackInfo->ChildHandle, &gEfiDevicePathProtocolGuid, CallbackInfo->HiiVendorDevicePath, &gEfiHiiConfigAccessProtocolGuid, ConfigAccess, NULL ); if (!EFI_ERROR (Status)) { // // Open the Parent Handle for the child // Status = gBS->OpenProtocol ( IpSb->Controller, &gEfiManagedNetworkServiceBindingProtocolGuid, (VOID **) &MnpSb, IpSb->Image, CallbackInfo->ChildHandle, EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER ); } if (EFI_ERROR (Status)) { goto Error; } // // Publish our HII data // CallbackInfo->RegisteredHandle = HiiAddPackages ( &gIp4Config2NvDataGuid, CallbackInfo->ChildHandle, Ip4DxeStrings, Ip4Config2Bin, NULL ); if (CallbackInfo->RegisteredHandle == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Error; } // // Append MAC string in the menu help string and tile help string // Status = NetLibGetMacString (IpSb->Controller, IpSb->Image, &MacString); if (!EFI_ERROR (Status)) { OldMenuString = HiiGetString ( CallbackInfo->RegisteredHandle, STRING_TOKEN (STR_IP4_CONFIG2_FORM_HELP), NULL ); UnicodeSPrint (MenuString, 128, L"%s (MAC:%s)", OldMenuString, MacString); HiiSetString ( CallbackInfo->RegisteredHandle, STRING_TOKEN (STR_IP4_CONFIG2_FORM_HELP), MenuString, NULL ); UnicodeSPrint (PortString, 128, L"MAC:%s", MacString); HiiSetString ( CallbackInfo->RegisteredHandle, STRING_TOKEN (STR_IP4_DEVICE_FORM_HELP), PortString, NULL ); FreePool (MacString); FreePool (OldMenuString); return EFI_SUCCESS; }Error: Ip4Config2FormUnload (Instance); return Status;}
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:101,
示例19: invoked/** Publish the smbios type 1. @param Event Event whose notification function is being invoked (gEfiDxeSmmReadyToLockProtocolGuid). @param Context Pointer to the notification functions context, which is implementation dependent. @retval None**/EFI_STATUSEFIAPIAddSmbiosManuCallback ( IN EFI_EVENT Event, IN VOID *Context ){ CHAR8 *OptionalStrStart; UINTN ManuStrLen; UINTN VerStrLen; UINTN PdNameStrLen; UINTN SerialNumStrLen; UINTN SkuNumberStrLen; UINTN FamilyNameStrLen; EFI_STATUS Status; EFI_STRING Manufacturer; EFI_STRING ProductName; EFI_STRING Version; EFI_STRING SerialNumber; EFI_STRING SkuNumber; EFI_STRING FamilyName; STRING_REF TokenToGet; EFI_SMBIOS_HANDLE SmbiosHandle; SMBIOS_TABLE_TYPE1 *SmbiosRecord; EFI_MISC_SYSTEM_MANUFACTURER *ForType1InputData; EFI_SMBIOS_PROTOCOL *Smbios; CHAR16 Buffer[40]; CHAR16 *MacStr; EFI_HANDLE *Handles; UINTN BufferSize; CHAR16 PlatformNameBuffer[40]; ForType1InputData = (EFI_MISC_SYSTEM_MANUFACTURER *)Context; // // First check for invalid parameters. // if (Context == NULL || mPlatformInfo == NULL) { return EFI_INVALID_PARAMETER; } Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID *) &Smbios); ASSERT_EFI_ERROR (Status); if (BOARD_ID_MINNOW2_COMPATIBLE == mPlatformInfo->BoardId) { // Detect the board is compatible board platform UnicodeSPrint (PlatformNameBuffer, sizeof (PlatformNameBuffer),L"%s",L"Minnowboard Compatible "); } else { UnicodeSPrint (PlatformNameBuffer, sizeof (PlatformNameBuffer),L"%s",L"Minnowboard Max "); } // // Silicon Steppings // switch (PchStepping()) { case PchA0: UnicodeSPrint (Buffer, sizeof (Buffer),L"%s%s", PlatformNameBuffer, L"A0 PLATFORM"); HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_PRODUCT_NAME), Buffer, NULL); UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"A0"); HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_VERSION), Buffer, NULL); DEBUG ((EFI_D_ERROR, "A0 Stepping Detected/n")); break; case PchA1: UnicodeSPrint (Buffer, sizeof (Buffer),L"%s%s", PlatformNameBuffer, L"A1 PLATFORM"); HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_PRODUCT_NAME), Buffer, NULL); UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"A1"); HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_VERSION), Buffer, NULL); DEBUG ((EFI_D_ERROR, "A1 Stepping Detected/n")); break; case PchB0: UnicodeSPrint (Buffer, sizeof (Buffer),L"%s%s", PlatformNameBuffer, L"B0 PLATFORM"); HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_PRODUCT_NAME), Buffer, NULL); UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"B0"); HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_VERSION), Buffer, NULL); DEBUG ((EFI_D_ERROR, "B0 Stepping Detected/n")); break; case PchB1: UnicodeSPrint (Buffer, sizeof (Buffer),L"%s%s", PlatformNameBuffer, L"B1 PLATFORM"); HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_PRODUCT_NAME), Buffer, NULL); UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"B1"); HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_VERSION), Buffer, NULL); DEBUG ((EFI_D_ERROR, "B1 Stepping Detected/n")); break; case PchB2: UnicodeSPrint (Buffer, sizeof (Buffer),L"%s%s", PlatformNameBuffer, L"B2 PLATFORM"); HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_SYSTEM_PRODUCT_NAME), Buffer, NULL); UnicodeSPrint (Buffer, sizeof (Buffer),L"%s",L"B2");//.........这里部分代码省略.........
开发者ID:chinni1989,项目名称:edk2,代码行数:101,
示例20: CallBootManager//.........这里部分代码省略......... 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 // IsLegacyOption = (BOOLEAN) ( (DevicePathType (Option->DevicePath) == BBS_DEVICE_PATH) && (DevicePathSubType (Option->DevicePath) == BBS_BBS_DP) ); if (!IsLegacyOption && NeedEndOp) { NeedEndOp = FALSE; HiiCreateEndOpCode (StartOpCodeHandle); } if (IsLegacyOption && DeviceType != ((BBS_BBS_DEVICE_PATH *) Option->DevicePath)->DeviceType) { if (NeedEndOp) { HiiCreateEndOpCode (StartOpCodeHandle); } DeviceType = ((BBS_BBS_DEVICE_PATH *) Option->DevicePath)->DeviceType; Token = HiiSetString ( HiiHandle, 0, mDeviceTypeStr[ MIN (DeviceType & 0xF, ARRAY_SIZE (mDeviceTypeStr) - 1) ], NULL ); HiiCreateSubTitleOpCode (StartOpCodeHandle, Token, 0, 0, 1); NeedEndOp = TRUE; } ASSERT (Option->Description != NULL); Token = HiiSetString (HiiHandle, 0, Option->Description, NULL); TempStr = DevicePathToStr (Option->DevicePath); HelpSize = StrSize (TempStr) + StrSize (L"Device Path : "); HelpString = AllocateZeroPool (HelpSize); ASSERT (HelpString != NULL); StrCatS (HelpString, HelpSize / sizeof (CHAR16), L"Device Path : "); StrCatS (HelpString, HelpSize / sizeof (CHAR16), TempStr); HelpToken = HiiSetString (HiiHandle, 0, HelpString, NULL); HiiCreateActionOpCode ( StartOpCodeHandle, mKeyInput, Token, HelpToken, EFI_IFR_FLAG_CALLBACK, 0 );
开发者ID:EvanLloyd,项目名称:tianocore,代码行数:67,
示例21: GetUserName/** Get the username from the specified user. @param[in] User Handle of a user profile. @retval EFI_STRING_ID The String Id of the user's username.**/EFI_STRING_IDGetUserName ( IN EFI_USER_PROFILE_HANDLE User ){ EFI_STATUS Status; EFI_USER_INFO_HANDLE UserInfo; EFI_USER_INFO *Info; UINTN InfoSize; UINTN MemSize; UINTN NameLen; CHAR16 UserName[USER_NAME_LENGTH]; EFI_STRING_ID UserId; // // Allocate user information memory. // MemSize = sizeof (EFI_USER_INFO) + 63; Info = AllocateZeroPool (MemSize); ASSERT (Info != NULL); // // Get user name information. // UserInfo = NULL; while (TRUE) { InfoSize = MemSize; // // Get next user information. // Status = mUserManager->GetNextInfo ( mUserManager, User, &UserInfo ); if (EFI_ERROR (Status)) { break; } Status = mUserManager->GetInfo ( mUserManager, User, UserInfo, Info, &InfoSize ); if (Status == EFI_BUFFER_TOO_SMALL) { MemSize = InfoSize; FreePool (Info); Info = AllocateZeroPool (MemSize); ASSERT (Info != NULL); Status = mUserManager->GetInfo ( mUserManager, User, UserInfo, Info, &InfoSize ); } // // Check user information. // if (Status == EFI_SUCCESS) { if (Info->InfoType == EFI_USER_INFO_NAME_RECORD) { NameLen = Info->InfoSize - sizeof (EFI_USER_INFO); if (NameLen > USER_NAME_LENGTH * sizeof (CHAR16)) { NameLen = USER_NAME_LENGTH * sizeof (CHAR16); } ASSERT (NameLen >= sizeof (CHAR16)); CopyMem (UserName, (UINT8 *) (Info + 1), NameLen); UserName[NameLen / sizeof (CHAR16) - 1] = 0; UserId = HiiSetString ( mCallbackInfo->HiiHandle, 0, UserName, NULL ); if (UserId != 0) { FreePool (Info); return UserId; } } } } FreePool (Info); return 0;}
开发者ID:jeppeter,项目名称:vbox,代码行数:97,
示例22: UpdateLegacyDeviceOrderPage/** Create a dynamic page so that Legacy Device boot order can be set for specified device type. @param UpdatePageId The form ID. It also spefies the legacy device type.**/VOIDUpdateLegacyDeviceOrderPage ( IN UINT16 UpdatePageId ){ LEGACY_MENU_OPTION *OptionMenu; LEGACY_MENU_ENTRY *NewMenuEntry; EFI_STRING_ID StrRef; EFI_STRING_ID StrRefHelp; BBS_TYPE BbsType; UINT16 *Default; UINT16 Index; UINT16 Key; CHAR16 String[100]; CHAR16 *TypeStr; CHAR16 *TypeStrHelp; CHAR16 *FormTitle; VOID *OptionsOpCodeHandle; VOID *DefaultOpCodeHandle; Key = 0; StrRef = 0; StrRefHelp = 0; OptionMenu = NULL; TypeStr = NULL; TypeStrHelp = NULL; Default = NULL; BbsType = BBS_FLOPPY; RefreshLegacyUpdateData(); // // Create oneof option list // switch (UpdatePageId) { case FORM_FLOPPY_BOOT_ID: OptionMenu = (LEGACY_MENU_OPTION *) &LegacyFDMenu; Key = (UINT16) LEGACY_FD_QUESTION_ID; TypeStr = STR_FLOPPY; TypeStrHelp = STR_FLOPPY_HELP; FormTitle = STR_FLOPPY_TITLE; BbsType = BBS_FLOPPY; Default = mLegacyBootOptionPrivate->MaintainMapData->CurrentNvData.LegacyFD; break; case FORM_HARDDISK_BOOT_ID: OptionMenu = (LEGACY_MENU_OPTION *) &LegacyHDMenu; Key = (UINT16) LEGACY_HD_QUESTION_ID; TypeStr = STR_HARDDISK; TypeStrHelp = STR_HARDDISK_HELP; FormTitle = STR_HARDDISK_TITLE; BbsType = BBS_HARDDISK; Default = mLegacyBootOptionPrivate->MaintainMapData->CurrentNvData.LegacyHD; break; case FORM_CDROM_BOOT_ID: OptionMenu = (LEGACY_MENU_OPTION *) &LegacyCDMenu; Key = (UINT16) LEGACY_CD_QUESTION_ID; TypeStr = STR_CDROM; TypeStrHelp = STR_CDROM_HELP; FormTitle = STR_CDROM_TITLE; 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);//.........这里部分代码省略.........
开发者ID:FrozenXZeus,项目名称:edk2,代码行数:101,
示例23: LibFindFileSystem/** This function build the FsOptionMenu list which records all available file system in the system. They includes all instances of EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, all instances of EFI_LOAD_FILE_SYSTEM. @retval EFI_SUCCESS Success find the file system @retval EFI_OUT_OF_RESOURCES Can not create menu entry**/EFI_STATUSLibFindFileSystem ( VOID ){ UINTN NoSimpleFsHandles; EFI_HANDLE *SimpleFsHandle; UINT16 *VolumeLabel; UINTN Index; EFI_STATUS Status; MENU_ENTRY *MenuEntry; FILE_CONTEXT *FileContext; UINTN OptionNumber; EFI_FILE_SYSTEM_VOLUME_LABEL *Info; NoSimpleFsHandles = 0; OptionNumber = 0; // // Locate Handles that support Simple File System protocol // Status = gBS->LocateHandleBuffer ( ByProtocol, &gEfiSimpleFileSystemProtocolGuid, NULL, &NoSimpleFsHandles, &SimpleFsHandle ); if (!EFI_ERROR (Status)) { // // Find all the instances of the File System prototocol // for (Index = 0; Index < NoSimpleFsHandles; Index++) { // // Allocate pool for this load option // MenuEntry = LibCreateMenuEntry (); if (NULL == MenuEntry) { FreePool (SimpleFsHandle); return EFI_OUT_OF_RESOURCES; } FileContext = (FILE_CONTEXT *) MenuEntry->VariableContext; FileContext->DeviceHandle = SimpleFsHandle[Index]; FileContext->FileHandle = LibOpenRoot (FileContext->DeviceHandle); if (FileContext->FileHandle == NULL) { LibDestroyMenuEntry (MenuEntry); continue; } MenuEntry->HelpString = LibDevicePathToStr (DevicePathFromHandle (FileContext->DeviceHandle)); FileContext->FileName = LibStrDuplicate (L"//"); FileContext->DevicePath = FileDevicePath (FileContext->DeviceHandle, FileContext->FileName); FileContext->IsDir = TRUE; FileContext->IsRoot = TRUE; // // Get current file system's Volume Label // Info = (EFI_FILE_SYSTEM_VOLUME_LABEL *) LibFileInfo (FileContext->FileHandle, &gEfiFileSystemVolumeLabelInfoIdGuid); if (Info == NULL) { VolumeLabel = L"NO FILE SYSTEM INFO"; } else { if (Info->VolumeLabel == NULL) { VolumeLabel = L"NULL VOLUME LABEL"; } else { VolumeLabel = Info->VolumeLabel; if (*VolumeLabel == 0x0000) { VolumeLabel = L"NO VOLUME LABEL"; } } } MenuEntry->DisplayString = AllocateZeroPool (MAX_CHAR); ASSERT (MenuEntry->DisplayString != NULL); UnicodeSPrint ( MenuEntry->DisplayString, MAX_CHAR, L"%s, [%s]", VolumeLabel, MenuEntry->HelpString ); MenuEntry->DisplayStringToken = HiiSetString ( gFileExplorerPrivate.FeHiiHandle, 0, MenuEntry->DisplayString, NULL ); if (Info != NULL) FreePool (Info);//.........这里部分代码省略.........
开发者ID:kraxel,项目名称:edk2,代码行数:101,
示例24: Var_UpdateDriverOption//.........这里部分代码省略......... } NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext; NewLoadContext->Deleted = FALSE; NewLoadContext->LoadOptionSize = BufferSize; Ptr = (UINT8 *) Buffer; NewLoadContext->LoadOption = Ptr; *((UINT32 *) Ptr) = LOAD_OPTION_ACTIVE | (ForceReconnect << 1); NewLoadContext->Attributes = *((UINT32 *) Ptr); NewLoadContext->IsActive = TRUE; NewLoadContext->ForceReconnect = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT); Ptr += sizeof (UINT32); *((UINT16 *) Ptr) = (UINT16) GetDevicePathSize (CallbackData->LoadContext->FilePathList); NewLoadContext->FilePathListLength = *((UINT16 *) Ptr); Ptr += sizeof (UINT16); CopyMem ( Ptr, DescriptionData, StrSize (DescriptionData) ); NewLoadContext->Description = AllocateZeroPool (StrSize (DescriptionData)); ASSERT (NewLoadContext->Description != NULL); NewMenuEntry->DisplayString = NewLoadContext->Description; CopyMem ( NewLoadContext->Description, (VOID *) Ptr, StrSize (DescriptionData) ); Ptr += StrSize (DescriptionData); CopyMem ( Ptr, CallbackData->LoadContext->FilePathList, GetDevicePathSize (CallbackData->LoadContext->FilePathList) ); NewLoadContext->FilePathList = AllocateZeroPool (GetDevicePathSize (CallbackData->LoadContext->FilePathList)); ASSERT (NewLoadContext->FilePathList != NULL); CopyMem ( NewLoadContext->FilePathList, (VOID *) Ptr, GetDevicePathSize (CallbackData->LoadContext->FilePathList) ); NewMenuEntry->HelpString = UiDevicePathToStr (NewLoadContext->FilePathList); NewMenuEntry->OptionNumber = Index; NewMenuEntry->DisplayStringToken = HiiSetString (HiiHandle, 0, NewMenuEntry->DisplayString, NULL); NewMenuEntry->HelpStringToken = HiiSetString (HiiHandle, 0, NewMenuEntry->HelpString, NULL); if (OptionalDataExist) { Ptr += (UINT8) GetDevicePathSize (CallbackData->LoadContext->FilePathList); CopyMem ( Ptr, OptionalData, StrSize (OptionalData) ); } Status = gRT->SetVariable ( DriverString, &gEfiGlobalVariableGuid, VAR_FLAG, BufferSize, Buffer ); ASSERT_EFI_ERROR (Status); GetEfiGlobalVariable2 (L"DriverOrder", (VOID **) &DriverOrderList, &DriverOrderListSize); NewDriverOrderList = AllocateZeroPool (DriverOrderListSize + sizeof (UINT16)); ASSERT (NewDriverOrderList != NULL); if (DriverOrderList != NULL){ CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize); } NewDriverOrderList[DriverOrderListSize / sizeof (UINT16)] = Index; if (DriverOrderList != NULL) { EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid); } Status = gRT->SetVariable ( L"DriverOrder", &gEfiGlobalVariableGuid, VAR_FLAG, DriverOrderListSize + sizeof (UINT16), NewDriverOrderList ); ASSERT_EFI_ERROR (Status); if (DriverOrderList != NULL) { FreePool (DriverOrderList); } DriverOrderList = NULL; FreePool (NewDriverOrderList); InsertTailList (&DriverOptionMenu.Head, &NewMenuEntry->Link); DriverOptionMenu.MenuNumber++; return EFI_SUCCESS;}
开发者ID:RafaelRMachado,项目名称:edk2,代码行数:101,
示例25: VlanUpdateForm/** This function update VLAN list in the VLAN configuration Form. @param[in, out] PrivateData Points to VLAN configuration private data.**/VOIDVlanUpdateForm ( IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData ){ EFI_VLAN_CONFIG_PROTOCOL *VlanConfig; UINT16 NumberOfVlan; UINTN Index; EFI_VLAN_FIND_DATA *VlanData; VOID *StartOpCodeHandle; EFI_IFR_GUID_LABEL *StartLabel; VOID *EndOpCodeHandle; EFI_IFR_GUID_LABEL *EndLabel; CHAR16 *String; CHAR16 VlanStr[30]; CHAR16 VlanIdStr[6]; UINTN DigitalCount; EFI_STRING_ID StringId; // // Find current VLAN configuration // VlanData = NULL; NumberOfVlan = 0; VlanConfig = PrivateData->VlanConfig; VlanConfig->Find (VlanConfig, NULL, &NumberOfVlan, &VlanData); // // Update VLAN configuration in PrivateData // if (NumberOfVlan > MAX_VLAN_NUMBER) { NumberOfVlan = MAX_VLAN_NUMBER; } PrivateData->NumberOfVlan = NumberOfVlan; // // Init OpCode Handle // 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_VLAN_LIST; // // 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; ZeroMem (PrivateData->VlanId, MAX_VLAN_NUMBER); for (Index = 0; Index < NumberOfVlan; Index++) { String = VlanStr; StrCpy (String, L" VLAN ID:"); String += 10; // // Pad VlanId string up to 4 characters with space // DigitalCount = UnicodeValueToString (VlanIdStr, 0, VlanData[Index].VlanId, 5); SetMem16 (String, (4 - DigitalCount) * sizeof (CHAR16), L' '); StrCpy (String + 4 - DigitalCount, VlanIdStr); String += 4; StrCpy (String, L", Priority:"); String += 11; String += UnicodeValueToString (String, 0, VlanData[Index].Priority, 4); *String = 0; StringId = HiiSetString (PrivateData->HiiHandle, 0, VlanStr, NULL); ASSERT (StringId != 0); HiiCreateCheckBoxOpCode ( StartOpCodeHandle, (EFI_QUESTION_ID) (VLAN_LIST_VAR_OFFSET + Index), VLAN_CONFIGURATION_VARSTORE_ID,//.........这里部分代码省略.........
开发者ID:ChenFanFnst,项目名称:edk2,代码行数:101,
示例26: Var_UpdateBootOption//.........这里部分代码省略......... NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT); if (NULL == NewMenuEntry) { return EFI_OUT_OF_RESOURCES; } NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext; NewLoadContext->Deleted = FALSE; NewLoadContext->LoadOptionSize = BufferSize; Ptr = (UINT8 *) Buffer; NewLoadContext->LoadOption = Ptr; *((UINT32 *) Ptr) = LOAD_OPTION_ACTIVE; NewLoadContext->Attributes = *((UINT32 *) Ptr); NewLoadContext->IsActive = TRUE; NewLoadContext->ForceReconnect = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT); Ptr += sizeof (UINT32); *((UINT16 *) Ptr) = (UINT16) GetDevicePathSize (CallbackData->LoadContext->FilePathList); NewLoadContext->FilePathListLength = *((UINT16 *) Ptr); Ptr += sizeof (UINT16); CopyMem ( Ptr, NvRamMap->BootDescriptionData, StrSize (NvRamMap->BootDescriptionData) ); NewLoadContext->Description = AllocateZeroPool (StrSize (NvRamMap->BootDescriptionData)); ASSERT (NewLoadContext->Description != NULL); NewMenuEntry->DisplayString = NewLoadContext->Description; CopyMem ( NewLoadContext->Description, (VOID *) Ptr, StrSize (NvRamMap->BootDescriptionData) ); Ptr += StrSize (NvRamMap->BootDescriptionData); CopyMem ( Ptr, CallbackData->LoadContext->FilePathList, GetDevicePathSize (CallbackData->LoadContext->FilePathList) ); NewLoadContext->FilePathList = AllocateZeroPool (GetDevicePathSize (CallbackData->LoadContext->FilePathList)); ASSERT (NewLoadContext->FilePathList != NULL); CopyMem ( NewLoadContext->FilePathList, (VOID *) Ptr, GetDevicePathSize (CallbackData->LoadContext->FilePathList) ); NewMenuEntry->HelpString = UiDevicePathToStr (NewLoadContext->FilePathList); NewMenuEntry->OptionNumber = Index; NewMenuEntry->DisplayStringToken = HiiSetString (CallbackData->BmmHiiHandle, 0, NewMenuEntry->DisplayString, NULL); NewMenuEntry->HelpStringToken = HiiSetString (CallbackData->BmmHiiHandle, 0, NewMenuEntry->HelpString, NULL); if (OptionalDataExist) { Ptr += (UINT8) GetDevicePathSize (CallbackData->LoadContext->FilePathList); CopyMem (Ptr, NvRamMap->BootOptionalData, StrSize (NvRamMap->BootOptionalData)); } Status = gRT->SetVariable ( BootString, &gEfiGlobalVariableGuid, VAR_FLAG, BufferSize, Buffer ); ASSERT_EFI_ERROR (Status); GetEfiGlobalVariable2 (L"BootOrder", (VOID **) &BootOrderList, &BootOrderListSize); NewBootOrderList = AllocateZeroPool (BootOrderListSize + sizeof (UINT16)); ASSERT (NewBootOrderList != NULL); if (BootOrderList != NULL){ CopyMem (NewBootOrderList, BootOrderList, BootOrderListSize); } NewBootOrderList[BootOrderListSize / sizeof (UINT16)] = Index; if (BootOrderList != NULL) { FreePool (BootOrderList); } Status = gRT->SetVariable ( L"BootOrder", &gEfiGlobalVariableGuid, VAR_FLAG, BootOrderListSize + sizeof (UINT16), NewBootOrderList ); ASSERT_EFI_ERROR (Status); FreePool (NewBootOrderList); NewBootOrderList = NULL; InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link); BootOptionMenu.MenuNumber++; return EFI_SUCCESS;}
开发者ID:RafaelRMachado,项目名称:edk2,代码行数:101,
示例27: Option//.........这里部分代码省略......... *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); CopyMem(StringPtr, Question->BufferValue, Maximum * sizeof (CHAR16)); Status = ReadString (MenuOption, gPromptForData, StringPtr); if (!EFI_ERROR (Status)) { HiiSetString(Selection->FormSet->HiiHandle, Question->HiiValue.Value.string, StringPtr, NULL); Status = ValidateQuestion(Selection->FormSet, Selection->Form, Question, EFI_HII_EXPRESSION_INCONSISTENT_IF); if (EFI_ERROR (Status)) { HiiSetString(Selection->FormSet->HiiHandle, Question->HiiValue.Value.string, (CHAR16*)Question->BufferValue, NULL); } else { CopyMem (Question->BufferValue, StringPtr, Maximum * sizeof (CHAR16)); SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE); UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE); } } 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);
开发者ID:masamitsu-murase,项目名称:edk2_for_mruby,代码行数:66,
示例28: 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.**/VOIDDriverHealthManagerUpdateForm ( 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://.........这里部分代码省略.........
开发者ID:M1cha,项目名称:edk2,代码行数:101,
注:本文中的HiiSetString函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ Hit函数代码示例 C++ HiiAllocateOpCodeHandle函数代码示例 |