Try like this (no drive information) - that's how I've used it before.

  Status = ShellExecute (
             ImageHandle,
             L"Load.efi",
             FALSE,
             NULL,
             NULL
             );


-Jaben


From: Thomas Rognon [mailto:tcrog...@gmail.com]
Sent: Wednesday, February 13, 2013 12:06 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] ShellExecute

I'm new to this and using CommandInit because I've seen it used after 
ShellInitialize in other files.  I removed it and now it doesn't hang, but 
ShellExecute returns Invalid Parameter.

My goal is to execute a uefi application from inside another uefi application.  
Here is my code:

////////////////////////////////////////////////
// Test.c
////////////////////////////////////////////////

#include <Library/UefiLib.h>
#include <Library/UefiApplicationEntryPoint.h>
#include <Library/ShellLib.h>

EFI_STATUS
EFIAPI
UefiMain (
  IN     EFI_HANDLE        ImageHandle,
  IN     EFI_SYSTEM_TABLE  *SystemTable
  )
{
  EFI_STATUS  Status;

  Print (L"ImageHandle: %x\n", ImageHandle);

  Status = ShellInitialize ();
  Print (L"ShellInitialize: %r\n", Status);

  Status = ShellExecute (
             ImageHandle,
             L" Load.efi",
             FALSE,
             NULL,
             NULL
             );
  Print (L"ShellExecute: %r\n", Status);
  return EFI_SUCCESS;
}

////////////////////////////////////////////////
// Load.c
////////////////////////////////////////////////

#include <Library/UefiLib.h>
#include <Library/UefiApplicationEntryPoint.h>

EFI_STATUS
EFIAPI
UefiMain (
  IN     EFI_HANDLE        ImageHandle,
  IN     EFI_SYSTEM_TABLE  *SystemTable
  )
{
  Print (L"Inside Load.efi.\n");
  return EFI_SUCCESS;
}


fs1 contains both Load.efi and Test.efi.  The output from Test.efi is:

ImageHandle: B86D1518
ShellInitialize: Success
ShellExecute: Invalid Parameter

On Wed, Feb 13, 2013 at 11:15 AM, Carsey, Jaben 
<jaben.car...@intel.com<mailto:jaben.car...@intel.com>> wrote:
Have you tried removing the CommandInit() call?  Why do you need that?

From: Thomas Rognon [mailto:tcrog...@gmail.com<mailto:tcrog...@gmail.com>]
Sent: Tuesday, February 12, 2013 8:43 PM
To: edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
Subject: Re: [edk2] ShellExecute

Additional info:
It crashes on ShellExecute with a memory violation and I'm using 64 bit UEFI 
2.1+, UDK2010, and VS2008.

On Tue, Feb 12, 2013 at 10:30 PM, Thomas Rognon 
<tcrog...@gmail.com<mailto:tcrog...@gmail.com>> wrote:
UEFI Ninjas,

I can execute an uefi application from the shell as follows:
Shell>map -r
Shell>fs0:
fs0:>launch.efi

But when I try this, it hangs and I have to restart the machine:
Shell>map -r
Shell>fs0:
fs0:>test.efi

where test.efi executes only the following code in UefiMain:
ShellInitialize ();
CommandInit ();
ShellExecute (ImageHandle, L"fs0:\\launch.efi", FALSE, NULL, NULL);
return EFI_SUCCESS;

where ImageHandle is the parameter passed into UefiMain.

If anyone can help, I would appreciate it very much!

Thomas Rognon


------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to