From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B655621A1099D for ; Sun, 26 Nov 2017 21:51:13 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2017 21:55:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,463,1505804400"; d="scan'208";a="178109684" Received: from ray-dev.ccr.corp.intel.com ([10.239.9.15]) by orsmga005.jf.intel.com with ESMTP; 26 Nov 2017 21:55:34 -0800 From: Ruiyu Ni To: edk2-devel@lists.01.org Cc: Jaben Carsey , Michael D Kinney Date: Mon, 27 Nov 2017 13:55:30 +0800 Message-Id: <20171127055532.320556-2-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.15.0.gvfs.1.preview.4 In-Reply-To: <20171127055532.320556-1-ruiyu.ni@intel.com> References: <20171127055532.320556-1-ruiyu.ni@intel.com> Subject: [PATCH v2 1/3] ShellPkg/ShellLib: Constructor doesn't depend on ShellParameters X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Nov 2017 05:51:13 -0000 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 Cc: Jaben Carsey Cc: Michael D Kinney --- ShellPkg/Library/UefiShellLib/UefiShellLib.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c index 677791c67f..00f58ca0c1 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -215,7 +215,7 @@ ShellLibConstructorWorker ( gEfiShellParametersProtocol = NULL; } - if (gEfiShellParametersProtocol == NULL || gEfiShellProtocol == NULL) { + if (gEfiShellProtocol == NULL) { // // Moved to seperate function due to complexity // @@ -238,10 +238,14 @@ ShellLibConstructorWorker ( } // - // only success getting 2 of either the old or new, but no 1/2 and 1/2 + // Getting either EDK Shell's ShellEnvironment2 and ShellInterface protocol + // or UEFI Shell's Shell protocol. + // When ShellLib is linked to a driver producing DynamicCommand protocol, + // ShellParameters protocol is set by DynamicCommand.Handler(). // - if ((mEfiShellEnvironment2 != NULL && mEfiShellInterface != NULL) || - (gEfiShellProtocol != NULL && gEfiShellParametersProtocol != NULL) ) { + if ((mEfiShellEnvironment2 != NULL && mEfiShellInterface != NULL) || + (gEfiShellProtocol != NULL) + ) { if (gEfiShellProtocol != NULL) { FileFunctionMap.GetFileInfo = gEfiShellProtocol->GetFileInfo; FileFunctionMap.SetFileInfo = gEfiShellProtocol->SetFileInfo; -- 2.15.0.gvfs.1.preview.4