]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c
ShellPkg/HandleParsingLib: Return NULL name for unknown GUID
[mirror_edk2.git] / ShellPkg / Library / UefiShellDriver1CommandsLib / Dh.c
index e07304cd7fe86b19c9d0d45702f4cd1820209711..0ac49e1e7877323aaa3f53a561d2d36df50fb60c 100644 (file)
@@ -2,7 +2,7 @@
   Main file for Dh shell Driver1 function.\r
 \r
   (C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.<BR>\r
-  Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -153,6 +153,7 @@ GetProtocolInfoString(
   CHAR16                    *RetVal;\r
   UINTN                     Size;\r
   CHAR16                    *Temp;\r
+  CHAR16                    GuidStr[40];\r
 \r
   ProtocolGuidArray = NULL;\r
   RetVal            = NULL;\r
@@ -166,16 +167,19 @@ GetProtocolInfoString(
   if (!EFI_ERROR (Status)) {\r
     for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {\r
       Temp = GetStringNameFromGuid(ProtocolGuidArray[ProtocolIndex], Language);\r
-      if (Temp != NULL) {\r
-        ASSERT((RetVal == NULL && Size == 0) || (RetVal != NULL));\r
-        if (Size != 0) {\r
-          StrnCatGrow(&RetVal, &Size, Separator, 0);\r
-        }\r
-        StrnCatGrow(&RetVal, &Size, L"%H", 0);\r
+      ASSERT((RetVal == NULL && Size == 0) || (RetVal != NULL));\r
+      if (Size != 0) {\r
+        StrnCatGrow(&RetVal, &Size, Separator, 0);\r
+      }\r
+      StrnCatGrow(&RetVal, &Size, L"%H", 0);\r
+      if (Temp == NULL) {\r
+        UnicodeSPrint (GuidStr, sizeof (GuidStr), L"%g", ProtocolGuidArray[ProtocolIndex]);\r
+        StrnCatGrow (&RetVal, &Size, GuidStr, 0);\r
+      } else {\r
         StrnCatGrow(&RetVal, &Size, Temp, 0);\r
-        StrnCatGrow(&RetVal, &Size, L"%N", 0);\r
         FreePool(Temp);\r
       }\r
+      StrnCatGrow(&RetVal, &Size, L"%N", 0);\r
       if (ExtraInfo) {\r
         Temp = GetProtocolInformationDump(TheHandle, ProtocolGuidArray[ProtocolIndex], Verbose);\r
         if (Temp != NULL) {\r