From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-in22.apple.com (mail-out22.apple.com [17.171.2.32]) (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 D39AD2194235C for ; Fri, 7 Apr 2017 07:43:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; d=apple.com; s=mailout2048s; c=relaxed/simple; q=dns/txt; i=@apple.com; t=1491576186; h=From:Sender:Reply-To:Subject:Date:Message-id:To:Cc:MIME-version:Content-type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-reply-to:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=oHjz5gsng2u9TY+FXxKwKFacHBudwY0SGLWPUH+9kBE=; b=GCXA6wHySWSYuduR25wf4DuRoKuxulbjJNHx9a9eu77la4iaVUlcbIJqH3R60vr7 gXUgcQbNtsZygOAlXuegeLh5gHnzqHxck9SLeQszfcJf8QLRZRO8qcyJvtgwFBQU l2bBjE61nnUEFgvyawtfZadVeojlA+InQfSi42FJZ2uwRN0L9gVrvazCm/Nmr/oB mYXmM2CBp0aKiaLyhv7jj/PX3LYR70asAAjmufZs7kGdm6RLD9Rqh0Bjj2edYvbO jX/rLzpCejwYVA+K4+ChCt66g8qJl0EflHApztzHyRtxZZPZxFpMmIrjaDw2qbdu vwEEgbtQFSXOkAObXZzXQw==; Received: from relay8.apple.com (relay8.apple.com [17.128.113.102]) by mail-in22.apple.com (Apple Secure Mail Relay) with SMTP id E7.A9.23264.175A7E85; Fri, 7 Apr 2017 07:42:57 -0700 (PDT) X-AuditID: 11ab0216-e218d9a000005ae0-9d-58e7a571b161 Received: from nwk-mmpp-sz13.apple.com (nwk-mmpp-sz13.apple.com [17.128.115.216]) by relay8.apple.com (Apple SCV relay) with SMTP id 5B.EC.07296.665A7E85; Fri, 7 Apr 2017 07:42:47 -0700 (PDT) MIME-version: 1.0 Received: from [17.153.63.11] (unknown [17.153.63.11]) by nwk-mmpp-sz13.apple.com (Oracle Communications Messaging Server 8.0.1.2.20170210 64bit (built Feb 10 2017)) with ESMTPSA id <0OO100AJMNJ8P560@nwk-mmpp-sz13.apple.com>; Fri, 07 Apr 2017 07:42:46 -0700 (PDT) Sender: afish@apple.com From: Andrew Fish Message-id: <4A8F6E14-A49C-4258-9F2B-ECB7E1A9155E@apple.com> Date: Fri, 07 Apr 2017 07:42:46 -0700 In-reply-to: Cc: "Carsey, Jaben" , "edk2-devel@lists.01.org" To: Amit kumar References: <58C65DD8-D073-4112-8ADE-FFA2F4DD8B45@apple.com> X-Mailer: Apple Mail (2.3273) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrALMWRmVeSWpSXmKPExsUi2FCYplu19HmEweHHmhb7Xu9ksthz6Ciz xcamP6wOzB6Pe86weSze85LJo3v2P5YA5igum5TUnMyy1CJ9uwSujI8nEwp6njJWrOj/ydTA +PoYYxcjJ4eEgInEuQVL2boYuTiEBPYzSvRsPsYEk9jQtZsFInGIUaJ17Vk2kASvgKDEj8n3 WEBsZoEwiT1tExghivqZJDauOMYMkhAWEJd4d2YTmM0moCyxYv4HdohmG4l9TzqZIGrsJVbs fwJ2BouAqsT1RU/BajgF4iWOPLzEBLEgWWLLxbVgtghQTX/7FLAaIYGLLBKXPipBXCorcWv2 JWaQIyQELrNJTJ0xkXECo9AsJMfOQnIshK0l8f1RK1CcA8iWlzh4XhYirCnx7N4ndghbW+LJ uwusCxjZVjEK5yZm5uhm5hkZ6SUWFOSk6iXn525iBEXJaiaxHYz3XhseYhTgYFTi4Q3ofR4h xJpYVlyZe4hRmoNFSZz36hKgkEB6YklqdmpqQWpRfFFpTmrxIUYmDk6pBsY41l1HdmzTPlP3 nlfC1zJxp8c5vXLVN0FZWbZxqlc87s/8H6DwVSB2Z9CUrVbz2IxaP13++aJAesOztSGHD556 FWRuvqBq39/f5X9VeZ5p2vzetEVt4YKzHfZSE+z/uE5f9lXiUlL/RY4V335v2xVzbOrpCVUq FglyltqyFzO7RGQ0TeXvuCcrsRRnJBpqMRcVJwIA/fOU1XMCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJIsWRmVeSWpSXmKPExsUi2FB8Qzd96fMIg93vBSz2vd7JZLHn0FFm i41Nf1gdmD0e95xh81i85yWTR/fsfywBzFFcNimpOZllqUX6dglcGR9PJhT0PGWsWNH/k6mB 8fUxxi5GTg4JAROJDV27WboYuTiEBA4xSrSuPcsGkuAVEJT4MfkeC4jNLBAmsadtAiNEUT+T xMYVx5hBEsIC4hLvzmwCs9kElCVWzP/ADtFsI7HvSScTRI29xIr9T8C2sQioSlxf9BSshlMg XuLIw0tMEAuSJbZcXAtmiwDV9LdPAasRErjIInHpoxLEpbISt2ZfYp7AyD8LyX2zkNwHYWtJ fH/UChTnALLlJQ6el4UIa0o8u/eJHcLWlnjy7gLrAka2VYwCRak5iZUWeokFBTmpesn5uZsY wSFdmLaDsWm51SFGAQ5GJR7eH13PI4RYE8uKK3OBgcTBrCTC+3MqUIg3JbGyKrUoP76oNCe1 +BDjREagJycyS4km5wMjLq8k3tDExMDE2NjM2NjcxJyWwkrivNcXA10kkJ5YkpqdmlqQWgRz FBMHp1QDY6nwuwChvg7dvbETQm4ZPf+psO2Y78b0vcE32o15tn4Srr/5ttTjAf+ml6GFOhvd Jwd+mHTr76WXHrsYDD9HWVzYVFzAk77/S+Mym+fvtZayW73MejyddXXA3bgFe2oLl955yfBE xO/Lv9O5MfJtn98c2HrN9dSqb+0vNbOvF4rMe8vxeYvy551KLMUZiYZazEXFiQDXV8Eb3AIA AA== X-Content-Filtered-By: Mailman/MimeDel 2.1.22 Subject: Re: How to get fs index from controller handle. 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: Fri, 07 Apr 2017 14:43:08 -0000 Content-Type: text/plain; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT > On Apr 7, 2017, at 3:40 AM, Amit kumar wrote: > > Sorry my bad, actually it works > instead of > FileDevicePath(devicepath,L"XYZ\Par\Chld\filename.efi "); > i have to use > FileDevicePath(devicepath,L"XYZ\\\Par\\\Chld\\filename.efi "); > I think it is 2 \\ not 3 and you have a space at the end of the string. Thanks, Andrew Fish > Thanks for your help and support. > Amit > From: edk2-devel > on behalf of Amit kumar > > Sent: Friday, April 7, 2017 3:46:37 PM > To: Carsey, Jaben; afish@apple.com > Cc: edk2-devel@lists.01.org > Subject: Re: [edk2] How to get fs index from controller handle. > > Andrew, Jaben > > Thanks for your suggestions. > > I have one more query , i have a handle that contains a devicepath and i have a file say filename.efi wich is inside directory structure. > > say > > XYZ\Par\Chld\filename.efi > > NewDevPath =FileDevicePath(devicepath,L"XYZ\Par\Chld\filename.efi "); > > > and then i do > > > gBS->LoadImage ( > FALSE, > ImageHandle, > NewDevPath, > NULL, > 0, > &NewHandle > ); > > which returns me Status = Not Found; > > But when i place the filename.efi in volume root > NewDevPath =FileDevicePath(devicepath,L"filename.efi "); > LoadImage succeeds. > > Can some one tell me how to deal with directories while generating the devicepath for a file inside a directory. > > Amit > > > > ________________________________ > From: Carsey, Jaben > > Sent: Friday, April 7, 2017 2:22:15 AM > To: afish@apple.com > Cc: Amit kumar; edk2-devel@lists.01.org > Subject: RE: [edk2] How to get fs index from controller handle. > > Andrew, > > I was assuming not wanting ShellExecute() might extend to the rest of the shell. > > If the shell is in use, that can definitely help. While those 2 APIs do exist in theory, there is a single one that does all I think: GetDevicePathFromFilePath. > > -Jaben > > > From: afish@apple.com [mailto:afish@apple.com ] > Sent: Thursday, April 06, 2017 1:49 PM > To: Carsey, Jaben > > Cc: Amit kumar >; edk2-devel@lists.01.org > Subject: Re: [edk2] How to get fs index from controller handle. > Importance: High > > > On Apr 6, 2017, at 1:30 PM, Carsey, Jaben >> wrote: > > That's the way to do it. the hard work is around finding the DevicePath for the application you want to run to pass to LoadImage. > > > Jaben, > > It was easy in the old days..... > > DevPath = gSE2->NameToPath (ShellPathName); > gSE2->GetFsName (DevPath, FALSE, & ShellPathName); > > Maybe we should default EFI_SHELL_ENVIRONMENT2 to on :)? Half joking. > > I used those 2 APIs in the past to glue in shell volume names to a really simplistic C lib. > > Also if you have the File System Handle and path you can use the DevicePathLib. > > /** > Allocates a device path for a file and appends it to an existing device path. > > If Device is a valid device handle that contains a device path protocol, then a device path for > the file specified by FileName is allocated and appended to the device path associated with the > handle Device. The allocated device path is returned. If Device is NULL or Device is a handle > that does not support the device path protocol, then a device path containing a single device > path node for the file specified by FileName is allocated and returned. > The memory for the new device path is allocated from EFI boot services memory. It is the responsibility > of the caller to free the memory allocated. > > If FileName is NULL, then ASSERT(). > If FileName is not aligned on a 16-bit boundary, then ASSERT(). > > @param Device A pointer to a device handle. This parameter is optional and > may be NULL. > @param FileName A pointer to a Null-terminated Unicode string. > > @return The allocated device path. > > **/ > EFI_DEVICE_PATH_PROTOCOL * > EFIAPI > FileDevicePath ( > IN EFI_HANDLE Device, OPTIONAL > IN CONST CHAR16 *FileName > ); > > > Thanks, > > Andrew Fish > > > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org ] On Behalf Of > Amit kumar > Sent: Thursday, April 06, 2017 9:45 AM > To: Andrew Fish >> > Cc: edk2-devel@lists.01.org > > Subject: Re: [edk2] How to get fs index from controller handle. > Importance: High > > Hi, > > > Can i use gbs->loadimage() and gbs->startimage() to load an efi application > and execute it. > > Suppose i have a app1.efi and from app1.efi i want to execute app2.efi. > > Or is there some other way to do it ? > > Not considering ShellExecute(); > > Amit > > ________________________________ > From: afish@apple.com > >> on behalf of Andrew Fish > >> > Sent: Thursday, April 6, 2017 4:39:22 PM > To: Amit kumar > Cc: edk2-devel@lists.01.org > > Subject: Re: [edk2] How to get fs index from controller handle. > > > On Apr 6, 2017, at 3:30 AM, Amit kumar > >>> wrote: > > Hi, > > I want to get the fs index from the controller handle. > e.g In map command i see my controller is mapped to fs10. > So i there any API i can use in my code to get the fs index( which is 10 as in > example) from the controller handle. > > > Amit, > > It is important to remember that fs0:, and the other device names are a Shell > concept and not an EFI concept. So they only exist in the context of the shell. > > I took a quick look and I did not see an easy way to do this with the current > Shell APIs. > > In the older Shell you could use this protocol EfiShellEnvironment2 Protocol > has a function that converts a EFI_DEVICE_PATH_PROTOCOL (would be on > your controller handle) to a CHAR16. Thus you can get the volume name the > Shell would display to the user. I don't the index exists as a concept. So > EFI_SHELL_ENVIRONMENT2.GetFsName() and > EFI_SHELL_ENVIRONMENT2.GetFsDevicepath() are the closest thing I can > think of. > https://github.com/tianocore/edk2/blob/master/ShellPkg/Include/Protocol/ > EfiShellEnvironment2.h#L812 > > The only problem with that is EfiShellEnvironment2 is not produced by the > Shell by default. > > ## This flag is used to control the protocols produced by the shell > # If TRUE the shell will produce EFI_SHELL_ENVIRONMENT2 and > EFI_SHELL_INTERFACE > > gEfiShellPkgTokenSpaceGuid.PcdShellSupportOldProtocols|FALSE|BOOLEAN > |0x00000002 > > I've use the EFI_SHELL_ENVIRONMENT2 in the past to enable a non Shell > application to print out volume names that match the map command of the > shell. Hopefully some one knows how to do this in the modern Shell? > > Thanks, > > Andrew Fish > > Regards > Amit > _______________________________________________ > 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 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel