diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-28 15:12:50 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-28 15:12:50 +0200 |
| commit | 38dbf64f9007cd6104c63989b9b8311d4d1ffd76 (patch) | |
| tree | 5ee5d9fc3ef612fb164f3a4a4ddc95621740d2b7 | |
| parent | b608517c047f7e4f7d7d70af7db76b0e9b0873b0 (diff) | |
MHR-18: Support parent directories inside format class.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
| -rw-r--r-- | Private/NewBoot/BootKit/BootKit.hxx | 18 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootMain.cxx | 3 |
2 files changed, 19 insertions, 2 deletions
diff --git a/Private/NewBoot/BootKit/BootKit.hxx b/Private/NewBoot/BootKit/BootKit.hxx index 14609e77..c3e438ae 100644 --- a/Private/NewBoot/BootKit/BootKit.hxx +++ b/Private/NewBoot/BootKit/BootKit.hxx @@ -185,11 +185,15 @@ public: Char fFileName[kNewFSNodeNameLen]; Char fForkName[kNewFSNodeNameLen]; - UInt32 fKind; + Int32 fKind; + Int64 fLba; VoidPtr fBlob; SizeT fBlobSz; + bool IsCatalogValid() { return fLba != 0 && fLba >= kNewFSCatalogStartAddress; } + + struct BFileDescriptor* fParent; struct BFileDescriptor* fPrev; struct BFileDescriptor* fNext; }; @@ -262,7 +266,17 @@ private: while (blob) { NewCatalog* catalogKind = (NewCatalog*)bufCatalog; - catalogKind->PrevSibling = startLba; + blob->fLba = startLba; + + if (!blob->fParent) + catalogKind->PrevSibling = startLba; + else { + if (blob->IsCatalogValid()) { + catalogKind->PrevSibling = blob->fParent->fLba; + } else { + EFI::ThrowError(L"Invalid-Catalog-Location", L"Invalid catalog location."); + } + } /// Fill catalog kind. catalogKind->Kind = blob->fKind; diff --git a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx index 12d34232..2939c182 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx @@ -173,6 +173,7 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, rootDesc.fBlobSz = BootDeviceATA::kSectorSize; rootDesc.fBlob = new Char[rootDesc.fBlobSz]; + rootDesc.fParent = &rootDesc; memset(rootDesc.fBlob, 0, rootDesc.fBlobSz); @@ -190,6 +191,7 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, bootDesc.fBlobSz = BootDeviceATA::kSectorSize; bootDesc.fBlob = new Char[bootDesc.fBlobSz]; + bootDesc.fParent = &rootDesc; memset(bootDesc.fBlob, 0, bootDesc.fBlobSz); @@ -208,6 +210,7 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, appDesc.fBlobSz = BootDeviceATA::kSectorSize; appDesc.fBlob = new Char[appDesc.fBlobSz]; + appDesc.fParent = &rootDesc; memset(appDesc.fBlob, 0, appDesc.fBlobSz); |
