EFI_IFR_GUID_LABEL *StartLabel;\r
EFI_IFR_GUID_LABEL *EndLabel;\r
CHAR16 *BootStringNumber;\r
+ UINTN DevicePathType;\r
\r
gOption = NULL;\r
InitializeListHead (&BdsBootOptionList);\r
//\r
// Replace description string with UNI file string.\r
//\r
- BootStringNumber = AllocateZeroPool (StrSize (Option->Description));\r
- ASSERT (BootStringNumber != NULL);\r
+ BootStringNumber = NULL;\r
\r
- if (StrStr (Option->Description, DESCRIPTION_FLOPPY) != NULL) {\r
- BootStringNumber = Option->Description + StrLen (DESCRIPTION_FLOPPY) + 1;\r
+ DevicePathType = BdsGetBootTypeFromDevicePath (Option->DevicePath);\r
+ \r
+ //\r
+ // store number string of boot option temporary.\r
+ //\r
+ \r
+ switch (DevicePathType) {\r
+ case BDS_EFI_ACPI_FLOPPY_BOOT:\r
+ BootStringNumber = Option->Description;\r
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_FLOPPY));\r
- } else if (StrStr (Option->Description, DESCRIPTION_DVD) != NULL) {\r
- BootStringNumber = Option->Description + StrLen (DESCRIPTION_DVD) + 1;\r
+ break;\r
+ case BDS_EFI_MEDIA_CDROM_BOOT:\r
+ BootStringNumber = Option->Description;\r
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_DVD));\r
- \r
- } else if (StrStr (Option->Description, DESCRIPTION_USB) != NULL) {\r
- BootStringNumber = Option->Description + StrLen (DESCRIPTION_USB) + 1;\r
+ break;\r
+ case BDS_EFI_MESSAGE_USB_DEVICE_BOOT:\r
+ BootStringNumber = Option->Description;\r
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_USB));\r
- \r
- } else if (StrStr (Option->Description, DESCRIPTION_SCSI) != NULL) {\r
- BootStringNumber = Option->Description + StrLen (DESCRIPTION_SCSI) + 1;\r
+ break;\r
+ case BDS_EFI_MESSAGE_SCSI_BOOT:\r
+ BootStringNumber = Option->Description;\r
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_SCSI));\r
- \r
- } else if (StrStr (Option->Description, DESCRIPTION_MISC) != NULL) {\r
- BootStringNumber = Option->Description + StrLen (DESCRIPTION_MISC) + 1;\r
+ break;\r
+ case BDS_EFI_MESSAGE_MISC_BOOT:\r
+ BootStringNumber = Option->Description;\r
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_MISC));\r
- \r
- } else if (StrStr (Option->Description, DESCRIPTION_NETWORK) != NULL) {\r
- BootStringNumber = Option->Description + StrLen (DESCRIPTION_NETWORK) + 1;\r
+ break;\r
+ case BDS_EFI_MESSAGE_MAC_BOOT:\r
+ BootStringNumber = Option->Description;\r
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_NETWORK));\r
- \r
- } else if (StrStr (Option->Description, DESCRIPTION_NON_BLOCK) != NULL) {\r
- BootStringNumber = Option->Description + StrLen (DESCRIPTION_NON_BLOCK) + 1;\r
- Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_NON_BLOCK));\r
+ break;\r
}\r
\r
ASSERT (Option->Description != NULL);\r
- if (StrnCmp (BootStringNumber, L"0", 1) != 0) {\r
- StrCat (Option->Description, L" ");\r
- StrCat (Option->Description, BootStringNumber);\r
+ if (BootStringNumber != NULL) {\r
+ if (StrnCmp (BootStringNumber, L"0", 1) != 0) {\r
+ StrCat (Option->Description, L" ");\r
+ StrCat (Option->Description, BootStringNumber);\r
+ }\r
+ \r
+ FreePool (BootStringNumber);\r
}\r
- \r
+ \r
Token = HiiSetString (HiiHandle, 0, Option->Description, NULL);\r
\r
TempStr = DevicePathToStr (Option->DevicePath);\r