From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 BEFE120D77DC5 for ; Wed, 5 Apr 2017 09:08:46 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP; 05 Apr 2017 09:08:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,279,1486454400"; d="scan'208";a="69775429" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga002.jf.intel.com with ESMTP; 05 Apr 2017 09:08:45 -0700 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 5 Apr 2017 09:08:45 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.246]) by fmsmsx123.amr.corp.intel.com ([169.254.7.244]) with mapi id 14.03.0319.002; Wed, 5 Apr 2017 09:08:45 -0700 From: "Carsey, Jaben" To: "Jim.Dailey@dell.com" , "Ni, Ruiyu" CC: "edk2-devel@lists.01.org" Thread-Topic: UEFI Shell Lib Constructor and Shell Parameters Protocol Thread-Index: AdKuFe4dMrnMRkXwRa+ni64zpaOLZAACDXMAAABUXxAAAdQC4A== Date: Wed, 5 Apr 2017 16:08:44 +0000 Message-ID: References: <2acd9ee552f944598f9716c2f81780cc@ausx13mps335.AMER.DELL.COM> In-Reply-To: <2acd9ee552f944598f9716c2f81780cc@ausx13mps335.AMER.DELL.COM> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNjc4YWFhODctNDkxMi00N2ZhLWI3M2UtMzIzMTY4N2Q0NGExIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6InY5Wisya2RGVHVKWWdCdHlBdml3UFdPclRkenc2WWJhM3U4V1hWK2R6clU9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.108] MIME-Version: 1.0 Subject: Re: UEFI Shell Lib Constructor and Shell Parameters Protocol 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: Wed, 05 Apr 2017 16:08:46 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Glad to help. =20 I do not think that UEFI drivers really have the concept of command line pa= rameters... they use other methods for configuration... -Jaben > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Jim.Dailey@dell.com > Sent: Wednesday, April 05, 2017 8:21 AM > To: Carsey, Jaben ; Ni, Ruiyu > Cc: edk2-devel@lists.01.org > Subject: Re: [edk2] UEFI Shell Lib Constructor and Shell Parameters Proto= col > Importance: High >=20 > Thanks, Jaben. That makes sense. >=20 > Now I see the real issue is with the "app" I ran across. It is a driver, > and it was trying to access command line args. The driver crashed when > it tried to access the command line, but it had been loaded in memory via > the "load" command. >=20 > So, it seems "load" has no mechanism to pass command line arguments to a > driver, and as a result, it apparently doesn't load the shell parameters > protocol on the driver's handle, which caused the crash. >=20 > Regards, > Jim >=20 > -----Original Message----- > From: Carsey, Jaben [mailto:jaben.carsey@intel.com] > Sent: Wednesday, April 5, 2017 10:08 AM > To: Dailey, Jim ; Ni, Ruiyu > Cc: edk2-devel@lists.01.org > Subject: RE: UEFI Shell Lib Constructor and Shell Parameters Protocol >=20 > Jim, >=20 > That protocol must be installed on your applications own image handle for= it > to be valid. Locating the protocol on some other image would result with > finding the other image's command line parameters and the like... >=20 > -Jaben >=20 >=20 > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > > Jim.Dailey@dell.com > > Sent: Wednesday, April 05, 2017 7:07 AM > > To: Carsey, Jaben ; Ni, Ruiyu > > > Cc: edk2-devel@lists.01.org > > Subject: [edk2] UEFI Shell Lib Constructor and Shell Parameters Protoco= l > > Importance: High > > > > > > A question or two for all shell experts: > > > > In the UEFI Shell Lib constructor code, if the Shell protocol cannot > > be opened, then an attempt is made to locate it before "giving up". > > > > However, if the Shell parameters protocol cannot be opened, no attempt > > is made to locate it---the code simply leaves the parameters protocol > > pointer set to NULL. Can anyone explain why this is? > > > > I came across an app that crashes because of this behavior, but if I > > add code to try and locate the parameters protocol, then the app works > > as designed WRT accessing command line parameters. Is there some > > lurking issue if an attempt to locate the parameters protocol is made > > and is successful? > > > > Thanks, > > Jim > > > > ------- > > Here is the relevant code: > > > > EFI_STATUS > > ShellLibConstructorWorker ( > > IN EFI_HANDLE ImageHandle, > > IN EFI_SYSTEM_TABLE *SystemTable > > ) > > { > > EFI_STATUS Status; > > > > // > > // UEFI 2.0 shell interfaces (used preferentially) > > // > > Status =3D gBS->OpenProtocol( > > ImageHandle, > > &gEfiShellProtocolGuid, > > (VOID **)&gEfiShellProtocol, > > ImageHandle, > > NULL, > > EFI_OPEN_PROTOCOL_GET_PROTOCOL > > ); > > if (EFI_ERROR(Status)) { > > // > > // Search for the shell protocol > > // > > Status =3D gBS->LocateProtocol( > > &gEfiShellProtocolGuid, > > NULL, > > (VOID **)&gEfiShellProtocol > > ); > > if (EFI_ERROR(Status)) { > > gEfiShellProtocol =3D NULL; > > } > > } > > Status =3D gBS->OpenProtocol( > > ImageHandle, > > &gEfiShellParametersProtocolGuid, > > (VOID **)&gEfiShellParametersProtocol, > > ImageHandle, > > NULL, > > EFI_OPEN_PROTOCOL_GET_PROTOCOL > > ); > > if (EFI_ERROR(Status)) { > > #if 1 // _Dell_ : Search for the parameters protocol too! > > // > > // Search for the shell parameters protocol > > // > > Status =3D gBS->LocateProtocol( > > &gEfiShellParametersProtocolGuid, > > NULL, > > (VOID **)&gEfiShellParametersProtocol > > ); > > if (EFI_ERROR(Status)) { > > gEfiShellParametersProtocol =3D NULL; > > } > > #else > > gEfiShellParametersProtocol =3D NULL; > > #endif > > } > > ... > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel