diff options
| -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); |
