diff options
author | Tapan Shah <tapandshah@hpe.com> | 2016-10-05 13:58:05 -0700 |
---|---|---|
committer | Jaben Carsey <jaben.carsey@intel.com> | 2016-10-05 15:19:40 -0700 |
commit | 2cf9ecd2262e4098171fa27c97b56d483f5cf3b4 (patch) | |
tree | f9074132a50a8bbb3702d4c8df62177f10c14ad2 /ShellPkg/Library/UefiShellLib | |
parent | c0b7e2b2bfc2748112607bfe83fc99cf48c97b48 (diff) | |
download | edk2-2cf9ecd2262e4098171fa27c97b56d483f5cf3b4.zip edk2-2cf9ecd2262e4098171fa27c97b56d483f5cf3b4.tar.gz edk2-2cf9ecd2262e4098171fa27c97b56d483f5cf3b4.tar.bz2 |
ShellPkg: Move UnicodeCollation2 Protcol locate out of UefiShellLib constructor
Move gEfiUnicodeCollation2ProtocolGuid protocol outside of UefiShellLib constructor
function.
Locate gEfiUnicodeCollation2ProtocolGuid protocol in ShellOpenFileByName() which
consumes this protocol API.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Tapan Shah <tapandshah@hpe.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Diffstat (limited to 'ShellPkg/Library/UefiShellLib')
-rw-r--r-- | ShellPkg/Library/UefiShellLib/UefiShellLib.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c index e47d535..53f54e1 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -292,18 +292,12 @@ ShellLibConstructor ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
-
mEfiShellEnvironment2 = NULL;
gEfiShellProtocol = NULL;
gEfiShellParametersProtocol = NULL;
mEfiShellInterface = NULL;
mEfiShellEnvironment2Handle = NULL;
-
- if (mUnicodeCollationProtocol == NULL) {
- Status = gBS->LocateProtocol (&gEfiUnicodeCollation2ProtocolGuid, NULL, (VOID**)&mUnicodeCollationProtocol);
- ASSERT_EFI_ERROR (Status);
- }
+ mUnicodeCollationProtocol = NULL;
//
// verify that auto initialize is not set false
@@ -730,6 +724,14 @@ ShellOpenFileByName( FileHandle,
OpenMode);
+ if (mUnicodeCollationProtocol == NULL) {
+ Status = gBS->LocateProtocol (&gEfiUnicodeCollation2ProtocolGuid, NULL, (VOID**)&mUnicodeCollationProtocol);
+ if (EFI_ERROR (Status)) {
+ gEfiShellProtocol->CloseFile (*FileHandle);
+ return Status;
+ }
+ }
+
if ((mUnicodeCollationProtocol->StriColl (mUnicodeCollationProtocol, (CHAR16*)FileName, L"NUL") != 0) &&
(mUnicodeCollationProtocol->StriColl (mUnicodeCollationProtocol, (CHAR16*)FileName, L"NULL") != 0) &&
!EFI_ERROR(Status) && ((OpenMode & EFI_FILE_MODE_CREATE) != 0)){
|