summaryrefslogtreecommitdiffhomepage
path: root/Private/NewBoot
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-02 18:34:23 +0100
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-02 18:34:23 +0100
commit1b7cde24b45bb9cb8335767d4e50101867d21a37 (patch)
tree91b0151017edcd715061ba9d6aa37e4b67e7bd02 /Private/NewBoot
parent5613b2627a4f9e74296ec2dcfb9079516d4f41e0 (diff)
Bootloader: Found Bug: Will make a device path helper tomorrow.
Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/NewBoot')
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/AMD64-BootKit.cxx19
1 files changed, 15 insertions, 4 deletions
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;
+ }
}
}