mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-02-04 05:35:49 +00:00
Fix DIFAT assumptions for directory entries
This commit is contained in:
@@ -389,14 +389,6 @@ namespace BinaryObjectScanner.FileType
|
||||
|
||||
#region Directory Entries
|
||||
|
||||
// Get the offset of the first directory sector
|
||||
long firstDirectoryOffset = (long)(fileHeader.FirstDirectorySectorLocation * Math.Pow(2, fileHeader.SectorShift));
|
||||
if (firstDirectoryOffset < 0 || firstDirectoryOffset >= data.Length)
|
||||
return null;
|
||||
|
||||
// Seek to the first directory sector
|
||||
data.Seek(firstDirectoryOffset, SeekOrigin.Begin);
|
||||
|
||||
// Create a directory sector table
|
||||
var directorySectors = new List<DirectoryEntry>();
|
||||
|
||||
@@ -440,9 +432,8 @@ namespace BinaryObjectScanner.FileType
|
||||
// Add the sector shifts
|
||||
directorySectors.AddRange(directoryEntries);
|
||||
|
||||
// Get the next sector from the DIFAT
|
||||
var fat = binary.DIFATSectorNumbers[(int)currentSector];
|
||||
currentSector = binary.FATSectorNumbers[(int)fat];
|
||||
// Get the next sector from the FAT
|
||||
currentSector = binary.FATSectorNumbers[(int)currentSector];
|
||||
}
|
||||
|
||||
// Assign the Directory sectors table
|
||||
|
||||
Reference in New Issue
Block a user