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.24; helo=mga09.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 7FEA821A1098E for ; Sun, 26 Nov 2017 16:53:52 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2017 16:58:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,461,1505804400"; d="scan'208";a="12243960" Received: from ray-dev.ccr.corp.intel.com ([10.239.9.15]) by orsmga002.jf.intel.com with ESMTP; 26 Nov 2017 16:58:13 -0800 From: Ruiyu Ni To: edk2-devel@lists.01.org Cc: Jaben Carsey , Michael D Kinney Date: Mon, 27 Nov 2017 08:58:08 +0800 Message-Id: <20171127005810.274328-2-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.15.0.gvfs.1.preview.4 In-Reply-To: <20171127005810.274328-1-ruiyu.ni@intel.com> References: <20171127005810.274328-1-ruiyu.ni@intel.com> Subject: [PATCH 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 00:53:52 -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