[edk2] Load app from driver, is it possible?

Subject: [edk2] Load app from driver, is it possible?

From: Medina <joaomedina@gmail.com>

To: edk2-devel@lists.sourceforge.net

Date: 2012-06-28 00:05:25

Hi All!

I need another little help from you :)

Im trying to load an efiapplication from a service driver using LoadImage, I made some tests and always have the same result:EFI_NOT_FOUND.

Looking at phoenix wiki, that return is caused by:Both SourceBuffer and DevicePath are NULL but my DevicePath is not null.

Below I paste my small code:

{
const CHAR16 FILE_NAME[11] = L"fs0:\\a.efi";
EFI_SYSTEM_TABLE *gST;
EFI_BOOT_SERVICES *gBS;
EFI_HANDLE parent;
VOID *ImageBuffer;

EFI_STATUS status = 0;
EFI_DEVICE_PATH_PROTOCOL *FilePath;
gST = SystemTable;
gBS = gST->BootServices;
FilePath = FileDevicePath (NULL, FILE_NAME);
Print (L"\nFilePath->Type = 0x%x", FilePath->Type);
Print (L"\nFilePath->SubType = 0x%x", FilePath->SubType);
Print (L"\nFilePath->Length[1] = 0x%x", FilePath->Length[1]);
Print (L"\nFilePath->Length[2] = 0x%x", FilePath->Length[2]);
status = ShellFileExists(FILE_NAME);
Print(L"\nFile Exists?: %r %s \n\n", status, FILE_NAME);

Print(L"\nLets call FilePath %s", FilePath);
status = gBS->LoadImage(FALSE, ImageHandle, FilePath, NULL, 0, &parent);
Print(L"\nStatus: %r \n\n", status);
return EFI_SUCCESS;
}

My outputs are:
FilePath->Type = 0x4
FilePath->SubType= 0x4
FilePath->Lenght[1] = 0x0
FilePath->Lenght[2] = 0x66
File Exists?: Success fs0:\a.efi

Lets call FilePathfs0:\a.efi
Status: Not Found

Is there anythinng wrong with my portion of code or did I forget something?

Thanks,
Medina