From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.dell-outbound.iphmx.com (esa1.dell-outbound.iphmx.com [68.232.153.90]) (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 60FCC21A04811 for ; Wed, 5 Apr 2017 07:07:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dell.com; i=@dell.com; q=dns/txt; s=smtpout; t=1491400716; x=1522936716; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=x5yWO6Jmf2U72kqLxNXzweQ671Mh8G4JH0HMKBI5+Tg=; b=W53fyn1K+dlrrgMAmzIADMmjKFhEAtRoddygBKquVuz5rZbv/tFzXZRF p7QzRoMOF2z27OSgpHaG11QXEHrIc94aj4hmKjo2QV1VFwNiwHwvoHV9B EXc/btkkB8VIicfO5nzkJyhgWjwLaKck4YrKHWJIEBxRf0hEthNUBLQpO I=; Received: from esa1.dell-outbound2.iphmx.com ([68.232.153.201]) by esa1.dell-outbound.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2017 08:58:36 -0500 From: Received: from ausxippc106.us.dell.com ([143.166.85.156]) by esa1.dell-outbound2.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2017 20:06:47 +0600 X-LoopCount0: from 10.175.216.250 X-IronPort-AV: E=Sophos;i="5.36,278,1486447200"; d="scan'208";a="91489054" To: , CC: Thread-Topic: UEFI Shell Lib Constructor and Shell Parameters Protocol Thread-Index: AdKuFe4dMrnMRkXwRa+ni64zpaOLZA== Date: Wed, 5 Apr 2017 14:07:26 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titusconfig: No Restrictions 04051212 x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvIiwiaWQiOiI5ODk4NTk2Mi1iNzJhLTRiMjEtYmQ1YS01MWEzYTdjN2NhYzIiLCJwcm9wcyI6W3sibiI6IkNsYXNzaWZpY2F0aW9uIiwidmFscyI6W3sidmFsdWUiOiJObyBSZXN0cmljdGlvbnMifV19LHsibiI6IlN1YmxhYmVscyIsInZhbHMiOltdfSx7Im4iOiJFeHRlcm5hbENvcnJlc3BvbmRlbmNlIiwidmFscyI6W119XX0sIlN1YmplY3RMYWJlbHMiOltdLCJUTUNWZXJzaW9uIjoiMTYuMi4xMS4wIiwiVHJ1c3RlZExhYmVsSGFzaCI6Ik5BbTBjd1I5b3NpN0hPQ2F6ZXMwZWVpVjdFeGR2QzVaZUpzREwxV3VLNzQ9In0= x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.210.125.233] MIME-Version: 1.0 Subject: 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 14:07:28 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 } ...