From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 5604E82300 for ; Wed, 21 Dec 2016 10:36:15 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 21 Dec 2016 10:36:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,384,1477983600"; d="scan'208";a="914893536" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga003.jf.intel.com with ESMTP; 21 Dec 2016 10:36:14 -0800 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 21 Dec 2016 10:36:14 -0800 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.47]) by FMSMSX157.amr.corp.intel.com ([169.254.14.213]) with mapi id 14.03.0248.002; Wed, 21 Dec 2016 10:36:13 -0800 From: "Carsey, Jaben" To: GN Keshava , "edk2-devel@lists.01.org" CC: "Carsey, Jaben" Thread-Topic: [edk2] LocateHandle for gEfiShellProtocolGuid is failing in my application Thread-Index: AQHSW1xqp2i/R8U88kW9Um+C39/gDKESuezQ Date: Wed, 21 Dec 2016 18:36:13 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNmExZDA2YzAtZTVhZi00NzhjLWJjZmUtODAwODdjMGRlZjg2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkJvZ1wvWWtMcWZPNlFvclZjNHNod3FkR1c5Snh5UU1EQU1ndTUrVXFOdW5NPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.107] MIME-Version: 1.0 Subject: Re: LocateHandle for gEfiShellProtocolGuid is failing in my application X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 18:36:15 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Keshava, few questions:=20 Is there a reason that you are not using ShellLib to facilitate your app fu= nctionality? That library makes lots of things a lot easier. Why do you use LocateHandle and not LocateProtocol? Are you sure about that return code? Usually most-sig-bit is set for error= returns. Does the following snippet of code find a valid instance? Status =3D gBS->LocateProtocol( &gEfiShellProtocolGuid, NULL, (VOID **)&gEfiShellProtocol ); if (EFI_ERROR(Status)) { gEfiShellProtocol =3D NULL; } Are you running the UEFI Shell and then your application? -Jaben > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > GN Keshava > Sent: Tuesday, December 20, 2016 11:32 PM > To: edk2-devel@lists.01.org > Subject: [edk2] LocateHandle for gEfiShellProtocolGuid is failing in my > application > Importance: High >=20 > Hi, >=20 > I'm developing a shell application. A call to LocateHandle for > gEfiShellProtocolGuid is failing with Status 0x0E. >=20 > Below is my code. Please let me know what I'm doing wrong. >=20 > Status =3D gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > &BufferSize, Buffer); // Get BufferSize > if (EFI_ERROR(Status)) > Print(L"LocateHandle Status 0x%x\n",Status); >=20 > Status =3D gBS->AllocatePool(EfiBootServicesData, BufferSize, > (void**)&Buffer); > if (EFI_ERROR(Status)) > Print(L"AllocatePool Status 0x%x\n",Status); >=20 > Status =3D gBS->LocateHandle(ByProtocol, &gEfiShellProtocolGuid, NULL, > &BufferSize, Buffer); > if (EFI_ERROR(Status)) > Print(L"LocateHandle Status 0x%x\n",Status); >=20 > All calls failing with Status being 0x0E. Please help me to solve this. I= s > there any special requirement for using this protocol? >=20 > Thanks. > Regards, > Keshava > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel