I need get the DevicePath of the File, then i pass the FileName (CHAR16) and i want get return as DevicePath to use with LoadImage... I can not to use Shell Protocol.
VOID
GetDevicePathFromText (IN CHAR16* FileName,IN EFI_HANDLE ImageHandle)
{
EFI_GUID
DevicePathFromTextGUID =
EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID;
EFI_HANDLE
*handle;
EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL
*DevicePathFromTextProtocol;
EFI_STATUS
Status;
UINTN
bufferSize;
int
index;
EFI_DEVICE_PATH
*FilePath;
EFI_HANDLE
*LoadedDriverHandle;
LoadedDriverHandle = NULL;
Status = gBS->LocateHandleBuffer(ByProtocol,
&DevicePathFromTextGUID,
NULL,
&bufferSize,
&handle
);
if(!EFI_ERROR(Status))
{
Print(L"\nLocate: %r",Status);
for(index = 0 ; index < bufferSize ; index++)
{
Status = gBS->OpenProtocol( handle[index],
&DevicePathFromTextGUID,
(void **)&DevicePathFromTextProtocol,
ImageHandle,
NULL,
EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
);
if(EFI_ERROR(Status))
{
Print(L"\nERRO");
}else{
FilePath =
DevicePathFromTextProtocol->ConvertTextToDevicePath(FileName);
Status =
gBS->LoadImage(FALSE,ImageHandle,FilePath,NULL,0,LoadedDriverHandle);
if(!EFI_ERROR(Status)){
Print(L"Loaded %r",Status);
}else
{
Print(L"Loaded %r",Status);
}
}
}
}else
{
Print(L"\nLocate: %r",Status);
}
}
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel
