- if (PdbFileName != NULL) {\r
- GetShortPdbFileName (PdbFileName, mGaugeString);\r
- } else {\r
- StrCpy (mGaugeString, StringPtr);\r
+ if (NameGuid != NULL) {\r
+ //\r
+ // Try to get the image's FFS UI section by image GUID\r
+ //\r
+ NameString = NULL;\r
+ StringSize = 0;\r
+ Status = GetSectionFromAnyFv (\r
+ NameGuid,\r
+ EFI_SECTION_USER_INTERFACE,\r
+ 0,\r
+ (VOID **) &NameString,\r
+ &StringSize\r
+ );\r
+\r
+ if (!EFI_ERROR (Status)) {\r
+ //\r
+ // Method 3. Get the name string from FFS UI section\r
+ //\r
+ StrnCpyS (\r
+ mGaugeString,\r
+ DP_GAUGE_STRING_LENGTH + 1,\r
+ NameString,\r
+ DP_GAUGE_STRING_LENGTH\r
+ );\r
+ FreePool (NameString);\r
+ } else {\r
+ //\r
+ // Method 4: Get the name string from image GUID\r
+ //\r
+ UnicodeSPrint (mGaugeString, sizeof (mGaugeString), L"%g", NameGuid);\r
+ }\r
+ return;\r
+ } else {\r
+ //\r
+ // Method 5: Get the name string from image DevicePath\r
+ //\r
+ NameString = ConvertDevicePathToText (DevicePath, TRUE, FALSE);\r
+ if (NameString != NULL) {\r
+ StrnCpyS (\r
+ mGaugeString,\r
+ DP_GAUGE_STRING_LENGTH + 1,\r
+ NameString,\r
+ DP_GAUGE_STRING_LENGTH\r
+ );\r
+ FreePool (NameString);\r
+ return;\r
+ }\r
+ }\r