7-Zip does not handle pre-DOS 4 disk images (FATHandler.cpp)
A free file archiver for extremely high compression
Brought to you by:
ipavlov
7-Zip does not handle pre-DOS 4 disk images. This issue is cause because of the following code in FatHandler.cpp function Parse:
UInt16 numRootDirEntries = Get16(p + 17); if (numRootDirEntries == 0) { if (codeOffset < 90) return false; NumFatBits = 32; NumRootDirSectors = 0; } else { if (codeOffset < 62) return false; NumFatBits = 0; UInt32 mask = (1 << (SectorSizeLog - 5)) - 1; if ((numRootDirEntries & mask) != 0) return false; NumRootDirSectors = (numRootDirEntries + mask) >> (SectorSizeLog - 5); }
The if (codeOffset < 62) should be if (codeOffset < 36) because prior to DOS 4, the BIOS parameter block (BPB) in disk boot sectors only defined fields up to the number of hidden sectors field (20h-23h).
Patching v9.20 7z.dll (dated 11-18-2010) offset 10FDB byte from 3E to 24 fixes the problem.
Actually the field at 20h-23h is the 32-bit sector count, the hidden sector field is before that. Regardless 36 is the minimum code offset that should be used for FAT12/FAT16 disk images.
Last edit: dosfan01 2014-03-30
Please give me the link to image example with smallest offset.
Checking all versions of DOS from DOS 2.0 to DOS 7.0 the smallest offset I could find is used by Compaq MS-DOS 3.31 but you should use 36 as the minimum code offset as that is where the BPB ended prior to DOS 4. Note DOS 1.x did not have a BPB so those disks will always be unreadable by 7-Zip.
Compaq MS-DOS 3.31 boot sector (on a 1.44MB floppy)
Found an ever smaller code offset with Multitasking MS-DOS 4.0 (360K floppy):
Images here: http://jsmachines.net/disks/pc/dos/microsoft/4.0M/
Last edit: dosfan01 2014-03-30
7-Zip 9.32 supports MS-DOS 2.0+ FAT images.