Thanks Andrew,
Maybe my question is not complete. My UEFI Driver is loaded via another
UEFI Application(Main.efi) with LoadImage function. So based on your
advice, I modified my Main.efi to pass its ImageHandle to my UEFI Driver,
because I think the ImageHandle should be application-based, and then a
ShellExecute used the ImageHandle in My UEFI Driver. It works.
The flow would be:
Main.efi --LoadImage--> UEFI Driver --ShellExecute(with Main.efi's
ImageHandle)--> StdLibApp
Thanks
Jeffrey
2013/5/13 Andrew Fish <[email protected]>
>
> On May 13, 2013, at 2:02 AM, Jeffrey Chou <[email protected]> wrote:
>
> Hi Daryl,
>
> Thanks for your advice. Currently I just have the workaround that my UEFI
> driver invoking a application by LoadImage or ShellExecute, of cause the
> application should be built with StdLib.
> But I encountered some problems when using LoadImage and ShellExecute:
>
> Case 1:
> For ShellExecute, I have an absolute file path of application for
> parameter in ShellExecute. I always get EFI_SUCCESS from Status, but it
> seems that the StdLibApp.efi is never executed.
> *My UEFI Driver--ShellExecute-->StdLibApp*
> e.g.
> *ShellExecute (ImageHandle, L"folder1\folder2\StdLibApp.efi", FALSE,
> NULL, &Status);*
>
>
>
> Why would you expect a call ShellExecute from a driver to work?
> ShellExecute is a wrapper that calls a protocol produced by the shell. So
> by definition if the shell is not present it will not work. Your driver
> can't assume that the shell is present.
>
>
> https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.c
>
> Case 2:
> For LoadImage, also have the absolute file path for LoadImage function.
> *My UEFI Driver--LoadImage/StartImage-->StdLibApp*
> e.g.
> *gBS->LoadImage(FALSE, ImageHandle, FilePath, NULL, 0, &Handle);*
> *gBS->StartImage(Handle, NULL, NULL );*
> But I got an error EFI_STATUS from StartImage.
>
>
> If the return value is not EFI_INVALID_PARAMETER or EFI_SECURITY_VIOLATION
> then EFI_STATUS is coming from the image.
>
> I tried to change the StdLibApp to a PURE EFI Application, it works.
> Case 3:
> Base on the result from case 2, an idea as below.
> *My UEFI
> Driver--LoadImage/StartImage-->PureEFIApp--ShellExecute-->StdLibApp*
>
> Unfortunately, also failed in case 3. I got the situation when calling
> ShellExeute which is same as case 1.
>
> Maybe my method and idea are a bit tortuous, but above are solutions I can
> think of so far.
> Now I am back to case 2 and studying any solution can load a StdLibApp in
> an UEFI Driver.
>
>
>
> Maybe you didn't understand the implication of Daryl's answer. A Shell
> Application, requires the actual Shell to be present. A driver can't depend
> on the shell. So non of this stuff you are trying is going to work.
>
> You need to port your driver to not use C lib APIs that are not available
> and use edk2 library functions that are available, or you need create a
> version of the C lib that implements the functions you need that does not
> depend on the shell.
>
> Thanks,
>
> Andrew Fish
>
> Thanks
>
> Jeffrey
> 2013/5/11 Mcdaniel, Daryl <[email protected]>
>
>> Jeffrey,****
>>
>> ** **
>>
>> The current version of StdLib is designed to only work as a Shell
>> Application. Many of the services that StdLib relies upon are not
>> available until the BDS phase, or later. As such, it is strongly
>> recommended that StdLib not be used in drivers. It is my desire to provide
>> a “standalone” version of StdLib in the future, but it is not currently
>> scheduled.****
>>
>> ** **
>>
>> Daryl McDaniel
>>
>> *“In the pun, two strings of thought are tangled into one acoustic knot.”
>> -- Arthur Koestler*
>>
>> ****
>>
>> ** **
>>
>> *From:* Jeffrey Chou [mailto:[email protected]]
>> *Sent:* Tuesday, May 07, 2013 3:20 AM
>> *To:* edk2-devel
>> *Subject:* [edk2] Using StdLib in UEFI_DRIVER Type****
>>
>> ** **
>>
>> Hi all,****
>>
>> ****
>>
>> I am trying to use StbLib in an uefi driver module, and it seems the
>> StbLib is only supported on UEFI_APPLICATION. So I have an idea that my
>> uefi driver invoking an uefi application built with StdLib thru
>> ShellExecute or LoadImage. But I am facing a problem that I don't know how
>> to pass auguments to the application (in loadimage) and get the return
>> value from the application. Any suggestions?****
>>
>> ****
>>
>> Thanks****
>>
>> Jeffrey****
>>
>>
>> ------------------------------------------------------------------------------
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and
>> their applications. This 200-page book is written by three acclaimed
>> leaders in the field. The early access version is available now.
>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>> _______________________________________________
>> edk2-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>>
>>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today!
> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
>
------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel