Implement and use BlGetEfiPath() routine to get valid EFI path
This commit is contained in:
parent
9f739df595
commit
269858f5a1
@ -105,6 +105,7 @@ typedef struct _XTBL_BOOT_PARAMETERS
|
||||
{
|
||||
PEFI_DEVICE_PATH_PROTOCOL DevicePath;
|
||||
PWCHAR ArcName;
|
||||
PWCHAR EfiPath;
|
||||
PWCHAR SystemPath;
|
||||
PWCHAR SystemType;
|
||||
PWCHAR KernelFile;
|
||||
|
@ -130,6 +130,11 @@ XTCDECL
|
||||
PWCHAR
|
||||
BlGetConfigValue(IN CONST PWCHAR ConfigName);
|
||||
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
BlGetEfiPath(IN PWCHAR SystemPath,
|
||||
OUT PWCHAR *EfiPath);
|
||||
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
BlGetMemoryMap(OUT PEFI_MEMORY_MAP MemoryMap);
|
||||
|
@ -276,6 +276,56 @@ BlFindVolumeDevicePath(IN PEFI_DEVICE_PATH_PROTOCOL FsHandle,
|
||||
return STATUS_EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a copy of the system path with EFI standard directory separators.
|
||||
*
|
||||
* @param SystemPath
|
||||
* Supplies a pointer to the system path.
|
||||
*
|
||||
* @param EfiPath
|
||||
* Supplies a pointer to the memory area, where EFI path will be stored.
|
||||
*
|
||||
* @return This routine returns a status code.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
BlGetEfiPath(IN PWCHAR SystemPath,
|
||||
OUT PWCHAR *EfiPath)
|
||||
{
|
||||
SIZE_T Index, PathLength;
|
||||
EFI_STATUS Status;
|
||||
|
||||
/* Get system path length */
|
||||
PathLength = RtlWideStringLength(SystemPath, 0);
|
||||
|
||||
/* Allocate memory for storing EFI path */
|
||||
Status = BlAllocateMemoryPool(sizeof(WCHAR) * (PathLength + 1), (PVOID *)EfiPath);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Failed to allocate memory, print error message and return status code */
|
||||
BlDebugPrint(L"ERROR: Memory allocation failure (Status Code: 0x%lx)\n", Status);
|
||||
return STATUS_EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
/* Make a copy of SystemPath string */
|
||||
RtlCopyMemory(*EfiPath, SystemPath, sizeof(WCHAR) * (PathLength + 1));
|
||||
|
||||
/* Replace directory separator if needed to comply with EFI standard */
|
||||
for(Index = 0; Index < PathLength; Index++)
|
||||
{
|
||||
if((*EfiPath)[Index] == L'/')
|
||||
{
|
||||
/* Replace '/' with '\' */
|
||||
(*EfiPath)[Index] = L'\\';
|
||||
}
|
||||
}
|
||||
|
||||
/* Return success */
|
||||
return STATUS_EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a volume device path based on the specified ARC name or UUID.
|
||||
*
|
||||
|
@ -227,6 +227,15 @@ BlInvokeBootProtocol(IN PLIST_ENTRY OptionsList)
|
||||
BlDebugPrint(L"ERROR: Failed to find volume device path (Status Code: 0x%lx)\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Get EFI compatible system path */
|
||||
Status = BlGetEfiPath(BootParameters.SystemPath, &BootParameters.EfiPath);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Failed to get EFI path */
|
||||
BlDebugPrint(L"ERROR: Failed to get EFI path (Status Code: 0x%lx)\n", Status);
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
else if(RtlCompareWideStringInsensitive(Option->Name, L"KERNELFILE", 0) == 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user