diff options
| author | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-02 18:34:23 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-02 18:34:23 +0100 |
| commit | 1b7cde24b45bb9cb8335767d4e50101867d21a37 (patch) | |
| tree | 91b0151017edcd715061ba9d6aa37e4b67e7bd02 | |
| parent | 5613b2627a4f9e74296ec2dcfb9079516d4f41e0 (diff) | |
Bootloader: Found Bug: Will make a device path helper tomorrow.
Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
| -rw-r--r-- | Private/EFIKit/EFI.hxx | 11 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/AMD64-BootKit.cxx | 19 |
2 files changed, 24 insertions, 6 deletions
diff --git a/Private/EFIKit/EFI.hxx b/Private/EFIKit/EFI.hxx index c830b30f..243211e9 100644 --- a/Private/EFIKit/EFI.hxx +++ b/Private/EFIKit/EFI.hxx @@ -59,8 +59,8 @@ typedef UInt64(EFI_API *EfiTextClear)(struct EfiSimpleTextOutputProtocol *This); typedef UInt64(EFI_API *EfiLoadFile)(EfiLoadFileProtocol *This, EfiFileDevicePathProtocol *FilePath, - Boolean BootPolicy, UInt32 *BufferSize, - Void *Buffer); + Boolean BootPolicy, UInt32 **BufferSize, + VoidPtr *Buffer); typedef UInt64(EFI_API *EfiCopyMem)(VoidPtr DstBuf, VoidPtr SrcBuf, SizeT Length); @@ -230,6 +230,13 @@ typedef struct EfiTableHeader { } \ } +#define EFI_LOAD_FILE2_PROTOCOL_GUID \ + { \ + 0x4006c0c1, 0xfcb3, 0x403e, { \ + 0x99, 0x6d, 0x4a, 0x6c, 0x87, 0x24, 0xe0, 0x6d \ + } \ + } + #define EFI_LOADED_IMAGE_PROTOCOL_GUID \ { \ 0x5B1B31A1, 0x9562, 0x11d2, { \ diff --git a/Private/NewBoot/Source/HEL/AMD64/AMD64-BootKit.cxx b/Private/NewBoot/Source/HEL/AMD64/AMD64-BootKit.cxx index 1533194b..8ca7737d 100644 --- a/Private/NewBoot/Source/HEL/AMD64/AMD64-BootKit.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/AMD64-BootKit.cxx @@ -113,7 +113,7 @@ HCore::VoidPtr BFileReader::ReadAll(SizeT &size) { EfiHandlePtr handleFile = nullptr; EfiLoadFileProtocol *loadFile = nullptr; - EfiGUID loadFileGUID = EfiGUID(EFI_LOAD_FILE_PROTOCOL_GUID); + EfiGUID loadFileGUID = EfiGUID(EFI_LOAD_FILE2_PROTOCOL_GUID); BS->LocateProtocol(&loadFileGUID, nullptr, (VoidPtr *)&loadFile); @@ -126,7 +126,7 @@ HCore::VoidPtr BFileReader::ReadAll(SizeT &size) { VoidPtr buf = nullptr; BS->AllocatePool(EfiLoaderCode, sizeof(UInt32), (VoidPtr *)&bufSz); - *bufSz = 0; + *bufSz = KIB(324); BS->AllocatePool(EfiLoaderCode, *bufSz, &buf); @@ -134,12 +134,15 @@ HCore::VoidPtr BFileReader::ReadAll(SizeT &size) { EfiFileDevicePathProtocol filePath{0}; + filePath.Proto.Length[0] = sizeof(EfiDevicePathProtocol); + filePath.Proto.Length[1] = BStrLen(mPath); + filePath.Proto.Type = kEFIMediaDevicePath; filePath.Proto.SubType = kEFIMediaDevicePath; // from all drives. - BCopyMem(filePath.Path, mPath, kPathLen); + BCopyMem(filePath.Path, mPath, BStrLen(mPath)); - auto err = loadFile->LoadFile(loadFile, &filePath, true, bufSz, buf); + auto err = loadFile->LoadFile(loadFile, &filePath, false, &bufSz, &buf); size = *bufSz; @@ -168,6 +171,14 @@ HCore::VoidPtr BFileReader::ReadAll(SizeT &size) { break; } + default: { + writer.WriteString(L"HCoreLdr: Error: ") + .WriteString(mPath) + .WriteString(L" , EFI-Code: Unknown-Error") + .WriteString(L"\r\n"); + + break; + } } } |
