I am looking at using Bootservices function LoadImage to load a UEFI application image from memory. Function parameters are:
typedef
EFI_STATUS
LoadImage (
IN BOOLEAN BootPolicy,
IN EFI_HANDLE ParentImageHandle,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN VOID *SourceBuffer OPTIONAL,
IN UINTN SourceSize,
OUT EFI_HANDLE *ImageHandle
);
Where I am allowed to provide a sourcebuffer that is already populated with the PE/COFF image to load. I am currently using sourcebuffer, and have prepopulated the buffer with a valid PE/COFF files contents. I pass that in under SourceBuffer and set DevicePath to Null. I receive the error "EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not understood."
What am I doing wrong?