]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg/ShellLib: Constructor doesn't depend on ShellParameters
authorRuiyu Ni <ruiyu.ni@intel.com>
Fri, 24 Nov 2017 08:01:41 +0000 (16:01 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Tue, 28 Nov 2017 05:22:34 +0000 (13:22 +0800)
When ShellLib is linked to a driver producing DynamicCommand
protocol, ShellParameters protocol is set by
DynamicCommand.Handler().
The driver image handle doesn't have ShellParameters protocol
installed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
ShellPkg/Library/UefiShellLib/UefiShellLib.c

index 677791c67f1102705bcb586fd0ec8605934a0763..00f58ca0c1f48549664efad068dde71b66cda327 100644 (file)
@@ -215,7 +215,7 @@ ShellLibConstructorWorker (
     gEfiShellParametersProtocol = NULL;\r
   }\r
 \r
-  if (gEfiShellParametersProtocol == NULL || gEfiShellProtocol == NULL) {\r
+  if (gEfiShellProtocol == NULL) {\r
     //\r
     // Moved to seperate function due to complexity\r
     //\r
@@ -238,10 +238,14 @@ ShellLibConstructorWorker (
   }\r
 \r
   //\r
-  // only success getting 2 of either the old or new, but no 1/2 and 1/2\r
+  // Getting either EDK Shell's ShellEnvironment2 and ShellInterface protocol\r
+  //  or UEFI Shell's Shell protocol.\r
+  // When ShellLib is linked to a driver producing DynamicCommand protocol,\r
+  //  ShellParameters protocol is set by DynamicCommand.Handler().\r
   //\r
-  if ((mEfiShellEnvironment2 != NULL && mEfiShellInterface          != NULL) ||\r
-      (gEfiShellProtocol     != NULL && gEfiShellParametersProtocol != NULL)   ) {\r
+  if ((mEfiShellEnvironment2 != NULL && mEfiShellInterface != NULL) ||\r
+      (gEfiShellProtocol     != NULL)\r
+      ) {\r
     if (gEfiShellProtocol != NULL) {\r
       FileFunctionMap.GetFileInfo     = gEfiShellProtocol->GetFileInfo;\r
       FileFunctionMap.SetFileInfo     = gEfiShellProtocol->SetFileInfo;\r