I want to check efi image path is valid, This is the code:
gBS->LocateHandleBuffer (
ByProtocol,
&gEfiSimpleFileSystemProtocolGuid,
NULL,
&NumberSimpleFileSystemHandles,
&SimpleFileSystemHandles
);
for (Index = 0; Index < NumberSimpleFileSystemHandles; Index++) {
TempImagePath = FileDevicePath (SimpleFileSystemHandles[Index], L"\\EFI\\BOOT\\boo.efi");
if(IsDevicePathValid(TempImagePath,sizeof(EFI_DEVICE_PATH_PROTOCOL)) == TRUE){
//OK
}
This code always returns that the path is invalid, I think there is a problem in the second parameter of IsDevicePathValid
.
What is the problem?
Thanks.
IsDevicePathValid returns false if the total length of the device path exceeds the value of the second parameter, MaxPath. Obviously it exceeds sizeof (EFI_DEVICE_PATH_PROTOCOL), which is 4. You should pass 0 for this parameter.