diff options
| author | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-04 13:36:19 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-04 13:36:19 +0100 |
| commit | a3d92ea68a74ef3cc3d3c9a34540754869e4d014 (patch) | |
| tree | fb9e80874de01a76a9664d0ceef53e1abd3895ec /Private/NewBoot/Source/FileReader.cxx | |
| parent | 46ec13f846a25dffaac0525d45003e7ee2a101ff (diff) | |
NewBoot: Fix NewBoot EFI implementation.
Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/NewBoot/Source/FileReader.cxx')
| -rw-r--r-- | Private/NewBoot/Source/FileReader.cxx | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/Private/NewBoot/Source/FileReader.cxx b/Private/NewBoot/Source/FileReader.cxx index 7bcccc10..8602114f 100644 --- a/Private/NewBoot/Source/FileReader.cxx +++ b/Private/NewBoot/Source/FileReader.cxx @@ -50,7 +50,7 @@ BFileReader::~BFileReader() { @brief this reads all of the buffer. @param ImageHandle used internally. */ -HCore::VoidPtr BFileReader::Fetch(EfiHandlePtr ImageHandle) { +HCore::VoidPtr BFileReader::Fetch(EfiHandlePtr ImageHandle, SizeT& imageSz) { mWriter.WriteString(L"HCoreLdr: Fetch-File: ") .WriteString(mPath) .WriteString(L"\r\n"); @@ -100,6 +100,13 @@ HCore::VoidPtr BFileReader::Fetch(EfiHandlePtr ImageHandle) { return nullptr; } + if (kernelFile->Revision < EFI_FILE_PROTOCOL_REVISION2) { + mWriter.WriteString(L"HCoreLdr: Fetch-Protocol: Invalid-Revision: ") + .WriteString(mPath) + .WriteString(L"\r\n"); + return nullptr; + } + /// File FAT info. UInt32 szInfo = sizeof(EfiFileInfo); @@ -139,6 +146,7 @@ HCore::VoidPtr BFileReader::Fetch(EfiHandlePtr ImageHandle) { } *sz = info.FileSize; + imageSz = *sz; if (BS->AllocatePool(EfiLoaderData, *sz, (VoidPtr*)&blob) != kEfiOk) { mWriter @@ -155,14 +163,17 @@ HCore::VoidPtr BFileReader::Fetch(EfiHandlePtr ImageHandle) { BSetMem((CharacterType*)blob, 0, *sz); mWriter.WriteString(L"HCoreLdr: Fetch-File: In-Progress...") + .WriteString(info.FileName) .WriteString(L"\r\n"); - kernelFile->Read(kernelFile, sz, blob); - - mWriter.WriteString(L"HCoreLdr: Fetch-File: OK").WriteString(L"\r\n"); - + auto resultEfiRead = kernelFile->Read(kernelFile, sz, blob); kernelFile->Close(kernelFile); + if (resultEfiRead == kEfiOk) + mWriter.WriteString(L"HCoreLdr: Fetch-File: OK").WriteString(L"\r\n"); + else + return nullptr; + this->mCached = true; this->mErrorCode = kOperationOkay; |
