audk/ShellPkg/Library
Ruiyu Ni 68b07ebae5 ShellPkg/ShellLib: Fix dynamic command fails to start during boot
The previous change in ShellLib: "commit
3d29f8c5e3
* ShellPkg/ShellLib: Constructor doesn't depend on ShellParameters"
resolved the issue when loading dynamic command driver from Shell
environment.
But when dynamic command driver is built into FV and started during
boot, the driver still fails to start because Shell protocol doesn't
exist at that time.

The patch changes ShellLib to:
1. Do not look for Shell and ShellParameters protocol when they are
   non-NULL in ShellLibConstructorWorker();
   The two protocols are assumed to be set by DynamicCommand.Handler.
   When ShellInitialize() is called in DynamicCommand.Handler, this
   change can prevent the two protocols to be changed to NULL by
   the locating logic.
2. Do not reset the Shell and ShellParameters protocol to NULL in
   ShellLibDestructor() when CloseProtocol() fails;
   Dynamic command driver needs to set the PcdShellLibAutoInitialize
   to FALSE in order to skip the constructor.
   Current logic calls ShellLibDestructor() when the PCD is FALSE when
   ShellInitialize() is called. The change prevent the two protocols
   to be changed to NULL.

The two changes don't impact existing usage case so they are backward
compatible.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
2017-11-29 10:31:54 +08:00
..
UefiHandleParsingLib ShellPkg/dh: Fix wrong output when dumping PciRootBridgeIo 2017-11-08 13:06:16 +08:00
UefiShellBcfgCommandLib ShellPkg: Fix misuses of AllocateCopyPool 2017-11-08 17:13:04 +08:00
UefiShellCEntryLib ShellPkg: Fix typos in comments and variables 2016-11-15 11:05:34 +08:00
UefiShellCommandLib ShellPkg: Fix bug that fails to change CWD after "map -r". 2017-08-30 11:42:49 +08:00
UefiShellDebug1CommandsLib ShellPkg/HexEdit: Fix EBC build failure 2017-11-07 10:17:28 +08:00
UefiShellDriver1CommandsLib ShellPkg/disconnect: '-r' is not optional when disconnecting all 2017-09-29 15:19:10 +08:00
UefiShellInstall1CommandsLib Revert "ShellPkg : Add UEFI_APPLICATION module type to UefiShellInstall1CommandsLib.inf" 2016-01-06 16:23:20 +00:00
UefiShellLevel1CommandsLib ShellPkg: Update sources to include MdePkg protocol definitions 2016-10-19 10:26:16 +08:00
UefiShellLevel2CommandsLib ShellPkg/mkdir: support creating nested directories 2017-08-21 10:42:39 +08:00
UefiShellLevel3CommandsLib ShellPkg/alias: Fix flag parsing logic 2017-10-20 12:54:36 +08:00
UefiShellLib ShellPkg/ShellLib: Fix dynamic command fails to start during boot 2017-11-29 10:31:54 +08:00
UefiShellNetwork1CommandsLib ShellPkg: Add error message if failed to place receive token in ping command. 2017-11-16 14:07:31 +08:00
UefiShellNetwork2CommandsLib ShellPkg: Add error message if failed to place receive token in ping command. 2017-11-16 14:07:31 +08:00