Files
Aaru/Aaru.Filesystems/HPFS.cs

390 lines
19 KiB
C#
Raw Normal View History

// /***************************************************************************
2020-02-27 12:31:25 +00:00
// Aaru Data Preservation Suite
* LICENSE.MIT: * LICENSE.LGPL: Added LICENSE files for LGPL and MIT licenses. * DiscImageChef.Devices/Enums.cs: * DiscImageChef.Partitions/MBR.cs: * DiscImageChef.Partitions/RDB.cs: * DiscImageChef.DiscImages/GDI.cs: * DiscImageChef.Partitions/Sun.cs: * DiscImageChef.DiscImages/VHD.cs: * DiscImageChef.Partitions/GPT.cs: * DiscImageChef.Filesystems/FFS.cs: * DiscImageChef.Filesystems/FAT.cs: * DiscImageChef.Partitions/NeXT.cs: * DiscImageChef.Devices/Command.cs: * DiscImageChef.DiscImages/Nero.cs: * DiscImageChef.Decoders/CD/PMA.cs: * DiscImageChef.Decoders/CD/TOC.cs: * DiscImageChef.Filesystems/BFS.cs: * DiscImageChef.Filesystems/ODS.cs: * DiscImageChef.Helpers/PrintHex.cs: * DiscImageChef.Helpers/Swapping.cs: * DiscImageChef.Decoders/DVD/PRI.cs: * DiscImageChef.Decoders/DVD/DMI.cs: * DiscImageChef.Decoders/DVD/DDS.cs: * DiscImageChef.Decoders/DVD/RMD.cs: * DiscImageChef.Decoders/DVD/UDI.cs: * DiscImageChef.Partitions/Atari.cs: * DiscImageChef.Decoders/DVD/BCA.cs: * DiscImageChef.Filesystems/SysV.cs: * DiscImageChef.Filesystems/HPFS.cs: * DiscImageChef.Filesystems/NTFS.cs: * DiscImageChef.Filesystems/APFS.cs: * DiscImageChef.Decoders/DVD/PFI.cs: * DiscImageChef.Decoders/CD/ATIP.cs: * DiscImageChef.Filesystems/Acorn.cs: * DiscImageChef.DiscImages/CDRWin.cs: * DiscImageChef.DiscImages/CDRDAO.cs: * DiscImageChef.Filesystems/BTRFS.cs: * DiscImageChef.Decoders/Xbox/DMI.cs: * DiscImageChef.Helpers/ArrayFill.cs: * DiscImageChef.Settings/Settings.cs: * DiscImageChef.Filesystems/Opera.cs: * DiscImageChef.Filesystems/extFS.cs: * DiscImageChef.Decoders/DVD/CPRM.cs: * DiscImageChef.Decoders/DVD/ADIP.cs: * DiscImageChef.Decoders/CD/Enums.cs: * DiscImageChef.Decoders/DVD/AACS.cs: * DiscImageChef.Decoders/SCSI/EVPD.cs: * DiscImageChef.Filesystems/ProDOS.cs: * DiscImageChef.Metadata/MediaType.cs: * DiscImageChef.Console/DicConsole.cs: * DiscImageChef.Decoders/DVD/Spare.cs: * DiscImageChef.Filesystems/ext2FS.cs: * DiscImageChef.Decoders/DVD/Enums.cs: * DiscImageChef.Filesystems/Symbian.cs: * DiscImageChef.Decoders/SCSI/Types.cs: * DiscImageChef.Filesystems/UNIXBFS.cs: * DiscImageChef.DiscImages/TeleDisk.cs: * DiscImageChef.Decoders/SCSI/Sense.cs: * DiscImageChef.Decoders/CD/FullTOC.cs: * DiscImageChef.Decoders/Blu-ray/DI.cs: * DiscImageChef.Decoders/ATA/Errors.cs: * DiscImageChef.Filesystems/ISO9660.cs: * DiscImageChef.Filesystems/MinixFS.cs: * DiscImageChef.Devices/Linux/Enums.cs: * DiscImageChef.Filesystems/SolarFS.cs: * DiscImageChef.Filesystems/Structs.cs: * DiscImageChef.DiscImages/Apple2MG.cs: * DiscImageChef.Decoders/SCSI/Modes.cs: * DiscImageChef.Metadata/Dimensions.cs: * DiscImageChef.Partitions/AppleMap.cs: * DiscImageChef.Decoders/Floppy/ISO.cs: * DiscImageChef.Decoders/DVD/Layers.cs: * DiscImageChef.Decoders/CD/Session.cs: * DiscImageChef.Decoders/SCSI/Enums.cs: * DiscImageChef.Filesystems/Nintendo.cs: * DiscImageChef.Helpers/DateHandlers.cs: * DiscImageChef.Filesystems/AmigaDOS.cs: * DiscImageChef.DiscImages/ImageInfo.cs: * DiscImageChef.Checksums/MD5Context.cs: * DiscImageChef.Devices/Linux/Extern.cs: * DiscImageChef.Filesystems/AppleHFS.cs: * DiscImageChef.Filesystems/AppleMFS.cs: * DiscImageChef.Helpers/ArrayIsEmpty.cs: * DiscImageChef.Decoders/Blu-ray/BCA.cs: * DiscImageChef.Decoders/Blu-ray/DDS.cs: * DiscImageChef.Filesystems/PCEngine.cs: * DiscImageChef.Decoders/ATA/Identify.cs: * DiscImageChef.Devices/Linux/Command.cs: * DiscImageChef.Devices/FreeBSD/Enums.cs: * DiscImageChef.Decoders/SCSI/Inquiry.cs: * DiscImageChef.Metadata/DeviceReport.cs: * DiscImageChef.Decoders/Floppy/Amiga.cs: * DiscImageChef.Devices/Linux/Structs.cs: * DiscImageChef.Devices/Windows/Enums.cs: * DiscImageChef.Decoders/DVD/CSS&CPRM.cs: * DiscImageChef.Checksums/SHA1Context.cs: * DiscImageChef.DiscImages/DiskCopy42.cs: * DiscImageChef.Partitions/PartPlugin.cs: * DiscImageChef.CommonTypes/Partition.cs: * DiscImageChef.Decoders/Floppy/Enums.cs: * DiscImageChef.CommonTypes/MediaType.cs: * DiscImageChef.Decoders/Floppy/Apple2.cs: * DiscImageChef.Devices/Windows/Extern.cs: * DiscImageChef.Decoders/SCSI/MMC/CPRM.cs: * DiscImageChef.Helpers/StringHandlers.cs: * DiscImageChef.DiscImages/ImagePlugin.cs: * DiscImageChef.Checksums/CRC64Context.cs: * DiscImageChef.Checksums/CRC32Context.cs: * DiscImageChef.DiscImages/ZZZRawImage.cs: * DiscImageChef.Checksums/CRC16Context.cs: * DiscImageChef.Filesystems/LisaFS/Dir.cs: * DiscImageChef.Decoders/DVD/Cartridge.cs: * DiscImageChef.Decoders/Blu-ray/Spare.cs: * DiscImageChef.Filesystems/Filesystem.cs: * DiscImageChef.Decoders/SCSI/MMC/AACS.cs: * DiscImageChef.Devices/FreeBSD/Extern.cs: * DiscImageChef.Devices/Device/Commands.cs: * DiscImageChef.Checksums/SHA384Context.cs: * DiscImageChef.Devices/FreeBSD/Command.cs: * DiscImageChef.Checksums/SHA512Context.cs: * DiscImageChef.Decoders/SCSI/MMC/Enums.cs: * DiscImageChef.Devices/Windows/Command.cs: * DiscImageChef.Devices/FreeBSD/Structs.cs: * DiscImageChef.Devices/Windows/Structs.cs: * DiscImageChef.Filesystems/LisaFS/Info.cs: * DiscImageChef.Checksums/SHA256Context.cs: * DiscImageChef.Filesystems/LisaFS/File.cs: * DiscImageChef.Filesystems/AppleHFSPlus.cs: * DiscImageChef.Filesystems/LisaFS/Super.cs: * DiscImageChef.Filesystems/LisaFS/Xattr.cs: * DiscImageChef.Checksums/Adler32Context.cs: * DiscImageChef.Decoders/Floppy/System34.cs: * DiscImageChef.Checksums/SpamSumContext.cs: * DiscImageChef.Decoders/SCSI/MMC/Hybrid.cs: * DiscImageChef.Devices/Device/Variables.cs: * DiscImageChef.Filesystems/LisaFS/Consts.cs: * DiscImageChef.Filesystems/LisaFS/LisaFS.cs: * DiscImageChef.Decoders/Floppy/Commodore.cs: * DiscImageChef.Checksums/FletcherContext.cs: * DiscImageChef.Filesystems/LisaFS/Extent.cs: * DiscImageChef.Devices/Device/Destructor.cs: * DiscImageChef.Decoders/Floppy/AppleSony.cs: * DiscImageChef.Filesystems/LisaFS/Structs.cs: * DiscImageChef.Decoders/SCSI/VendorString.cs: * DiscImageChef.Decoders/SCSI/MMC/Features.cs: * DiscImageChef.Devices/Device/Constructor.cs: * DiscImageChef.Checksums/RIPEMD160Context.cs: * DiscImageChef.Decoders/CD/CDTextOnLeadIn.cs: * DiscImageChef.Decoders/Blu-ray/Cartridge.cs: * DiscImageChef.Decoders/Floppy/System3740.cs: * DiscImageChef.Filesystems/LisaFS/Encoding.cs: * DiscImageChef.Decoders/SCSI/ModesEncoders.cs: * DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs: * DiscImageChef.Helpers/BigEndianBitConverter.cs: * DiscImageChef.Decoders/Floppy/Perpendicular.cs: * DiscImageChef.Decoders/SCSI/SSC/BlockLimits.cs: * DiscImageChef.Decoders/SCSI/MMC/WriteProtect.cs: * DiscImageChef.Devices/Device/ScsiCommands/HP.cs: * DiscImageChef.Devices/Device/AtaCommands/Cfa.cs: * DiscImageChef.Devices/Device/ScsiCommands/NEC.cs: * DiscImageChef.Helpers/EndianAwareBinaryReader.cs: * DiscImageChef.Devices/Device/ScsiCommands/MMC.cs: * DiscImageChef.Devices/Device/AtaCommands/MCPT.cs: * DiscImageChef.Devices/Device/ScsiCommands/SSC.cs: * DiscImageChef.Devices/Device/ScsiCommands/SPC.cs: * DiscImageChef.Devices/Device/ScsiCommands/SMC.cs: * DiscImageChef.Devices/Device/ScsiCommands/SBC.cs: * DiscImageChef.Metadata/Properties/AssemblyInfo.cs: * DiscImageChef.Devices/Device/AtaCommands/Atapi.cs: * DiscImageChef.Devices/Device/AtaCommands/Ata28.cs: * DiscImageChef.Devices/Device/AtaCommands/Smart.cs: * DiscImageChef.Decoders/SCSI/SSC/DensitySupport.cs: * DiscImageChef.Devices/Device/AtaCommands/Ata48.cs: * DiscImageChef.Decoders/SCSI/MMC/DiscInformation.cs: * DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs: * DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs: * DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs: * DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs: * DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs: * DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs: * DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs: * DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs: * DiscImageChef.Devices/Device/ScsiCommands/Certance.cs: * DiscImageChef.Decoders/SCSI/DiscStructureCapabilities.cs: * DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs: Relicensed as LGPL. Updated standard header. * DiscImageChef/Main.cs: * DiscImageChef/Plugins.cs: * DiscImageChef/Options.cs: * DiscImageChef/Commands/Ls.cs: * DiscImageChef/Core/IBGLog.cs: * DiscImageChef/Core/MHDDLog.cs: * DiscImageChef/AssemblyInfo.cs: * DiscImageChef/Core/Checksum.cs: * DiscImageChef/Commands/Decode.cs: * DiscImageChef/Core/Statistics.cs: * DiscImageChef/Commands/Verify.cs: * DiscImageChef/Commands/Formats.cs: * DiscImageChef/Commands/Entropy.cs: * DiscImageChef/Commands/Compare.cs: * DiscImageChef.Interop/DetectOS.cs: * DiscImageChef/Commands/Analyze.cs: * DiscImageChef/Commands/Commands.cs: * DiscImageChef/Commands/PrintHex.cs: * DiscImageChef/Commands/Checksum.cs: * DiscImageChef/DetectImageFormat.cs: * DiscImageChef/Commands/DumpMedia.cs: * DiscImageChef/Commands/Benchmark.cs: * DiscImageChef/Commands/Configure.cs: * DiscImageChef/Commands/MediaInfo.cs: * DiscImageChef.Interop/PlatformID.cs: * DiscImageChef/Commands/MediaScan.cs: * DiscImageChef/Commands/Statistics.cs: * DiscImageChef/Commands/DeviceInfo.cs: * DiscImageChef.Checksums/ReedSolomon.cs: * DiscImageChef/Commands/DeviceReport.cs: * DiscImageChef/Commands/ExtractFiles.cs: * DiscImageChef.Checksums/CDChecksums.cs: * DiscImageChef/Commands/CreateSidecar.cs: Updated standard header. * DiscImageChef.Checksums/DiscImageChef.Checksums.csproj: Relicensed project as LGPL. Updated standard header. Embed license as resource. * DiscImageChef.Console/DiscImageChef.Console.csproj: * DiscImageChef.Devices/DiscImageChef.Devices.csproj: * DiscImageChef.Helpers/DiscImageChef.Helpers.csproj: * DiscImageChef.Settings/DiscImageChef.Settings.csproj: * DiscImageChef.Decoders/DiscImageChef.Decoders.csproj: * DiscImageChef.Metadata/DiscImageChef.Metadata.csproj: * DiscImageChef.Partitions/DiscImageChef.Partitions.csproj: * DiscImageChef.DiscImages/DiscImageChef.DiscImages.csproj: * DiscImageChef.Filesystems/DiscImageChef.Filesystems.csproj: * DiscImageChef.CommonTypes/DiscImageChef.CommonTypes.csproj: Relicensed as LGPL. Updated standard header. Embed license as resource. * DiscImageChef/DiscImageChef.csproj: * DiscImageChef.Interop/DiscImageChef.Interop.csproj: Updated standard header. Embed license as resource.
2016-07-28 18:13:49 +01:00
// ----------------------------------------------------------------------------
//
// Filename : HPFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : OS/2 High Performance File System plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the OS/2 High Performance File System and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
2025-08-14 02:49:52 +01:00
// Copyright © 2011-2025 Natalia Portillo
* LICENSE.MIT: * LICENSE.LGPL: Added LICENSE files for LGPL and MIT licenses. * DiscImageChef.Devices/Enums.cs: * DiscImageChef.Partitions/MBR.cs: * DiscImageChef.Partitions/RDB.cs: * DiscImageChef.DiscImages/GDI.cs: * DiscImageChef.Partitions/Sun.cs: * DiscImageChef.DiscImages/VHD.cs: * DiscImageChef.Partitions/GPT.cs: * DiscImageChef.Filesystems/FFS.cs: * DiscImageChef.Filesystems/FAT.cs: * DiscImageChef.Partitions/NeXT.cs: * DiscImageChef.Devices/Command.cs: * DiscImageChef.DiscImages/Nero.cs: * DiscImageChef.Decoders/CD/PMA.cs: * DiscImageChef.Decoders/CD/TOC.cs: * DiscImageChef.Filesystems/BFS.cs: * DiscImageChef.Filesystems/ODS.cs: * DiscImageChef.Helpers/PrintHex.cs: * DiscImageChef.Helpers/Swapping.cs: * DiscImageChef.Decoders/DVD/PRI.cs: * DiscImageChef.Decoders/DVD/DMI.cs: * DiscImageChef.Decoders/DVD/DDS.cs: * DiscImageChef.Decoders/DVD/RMD.cs: * DiscImageChef.Decoders/DVD/UDI.cs: * DiscImageChef.Partitions/Atari.cs: * DiscImageChef.Decoders/DVD/BCA.cs: * DiscImageChef.Filesystems/SysV.cs: * DiscImageChef.Filesystems/HPFS.cs: * DiscImageChef.Filesystems/NTFS.cs: * DiscImageChef.Filesystems/APFS.cs: * DiscImageChef.Decoders/DVD/PFI.cs: * DiscImageChef.Decoders/CD/ATIP.cs: * DiscImageChef.Filesystems/Acorn.cs: * DiscImageChef.DiscImages/CDRWin.cs: * DiscImageChef.DiscImages/CDRDAO.cs: * DiscImageChef.Filesystems/BTRFS.cs: * DiscImageChef.Decoders/Xbox/DMI.cs: * DiscImageChef.Helpers/ArrayFill.cs: * DiscImageChef.Settings/Settings.cs: * DiscImageChef.Filesystems/Opera.cs: * DiscImageChef.Filesystems/extFS.cs: * DiscImageChef.Decoders/DVD/CPRM.cs: * DiscImageChef.Decoders/DVD/ADIP.cs: * DiscImageChef.Decoders/CD/Enums.cs: * DiscImageChef.Decoders/DVD/AACS.cs: * DiscImageChef.Decoders/SCSI/EVPD.cs: * DiscImageChef.Filesystems/ProDOS.cs: * DiscImageChef.Metadata/MediaType.cs: * DiscImageChef.Console/DicConsole.cs: * DiscImageChef.Decoders/DVD/Spare.cs: * DiscImageChef.Filesystems/ext2FS.cs: * DiscImageChef.Decoders/DVD/Enums.cs: * DiscImageChef.Filesystems/Symbian.cs: * DiscImageChef.Decoders/SCSI/Types.cs: * DiscImageChef.Filesystems/UNIXBFS.cs: * DiscImageChef.DiscImages/TeleDisk.cs: * DiscImageChef.Decoders/SCSI/Sense.cs: * DiscImageChef.Decoders/CD/FullTOC.cs: * DiscImageChef.Decoders/Blu-ray/DI.cs: * DiscImageChef.Decoders/ATA/Errors.cs: * DiscImageChef.Filesystems/ISO9660.cs: * DiscImageChef.Filesystems/MinixFS.cs: * DiscImageChef.Devices/Linux/Enums.cs: * DiscImageChef.Filesystems/SolarFS.cs: * DiscImageChef.Filesystems/Structs.cs: * DiscImageChef.DiscImages/Apple2MG.cs: * DiscImageChef.Decoders/SCSI/Modes.cs: * DiscImageChef.Metadata/Dimensions.cs: * DiscImageChef.Partitions/AppleMap.cs: * DiscImageChef.Decoders/Floppy/ISO.cs: * DiscImageChef.Decoders/DVD/Layers.cs: * DiscImageChef.Decoders/CD/Session.cs: * DiscImageChef.Decoders/SCSI/Enums.cs: * DiscImageChef.Filesystems/Nintendo.cs: * DiscImageChef.Helpers/DateHandlers.cs: * DiscImageChef.Filesystems/AmigaDOS.cs: * DiscImageChef.DiscImages/ImageInfo.cs: * DiscImageChef.Checksums/MD5Context.cs: * DiscImageChef.Devices/Linux/Extern.cs: * DiscImageChef.Filesystems/AppleHFS.cs: * DiscImageChef.Filesystems/AppleMFS.cs: * DiscImageChef.Helpers/ArrayIsEmpty.cs: * DiscImageChef.Decoders/Blu-ray/BCA.cs: * DiscImageChef.Decoders/Blu-ray/DDS.cs: * DiscImageChef.Filesystems/PCEngine.cs: * DiscImageChef.Decoders/ATA/Identify.cs: * DiscImageChef.Devices/Linux/Command.cs: * DiscImageChef.Devices/FreeBSD/Enums.cs: * DiscImageChef.Decoders/SCSI/Inquiry.cs: * DiscImageChef.Metadata/DeviceReport.cs: * DiscImageChef.Decoders/Floppy/Amiga.cs: * DiscImageChef.Devices/Linux/Structs.cs: * DiscImageChef.Devices/Windows/Enums.cs: * DiscImageChef.Decoders/DVD/CSS&CPRM.cs: * DiscImageChef.Checksums/SHA1Context.cs: * DiscImageChef.DiscImages/DiskCopy42.cs: * DiscImageChef.Partitions/PartPlugin.cs: * DiscImageChef.CommonTypes/Partition.cs: * DiscImageChef.Decoders/Floppy/Enums.cs: * DiscImageChef.CommonTypes/MediaType.cs: * DiscImageChef.Decoders/Floppy/Apple2.cs: * DiscImageChef.Devices/Windows/Extern.cs: * DiscImageChef.Decoders/SCSI/MMC/CPRM.cs: * DiscImageChef.Helpers/StringHandlers.cs: * DiscImageChef.DiscImages/ImagePlugin.cs: * DiscImageChef.Checksums/CRC64Context.cs: * DiscImageChef.Checksums/CRC32Context.cs: * DiscImageChef.DiscImages/ZZZRawImage.cs: * DiscImageChef.Checksums/CRC16Context.cs: * DiscImageChef.Filesystems/LisaFS/Dir.cs: * DiscImageChef.Decoders/DVD/Cartridge.cs: * DiscImageChef.Decoders/Blu-ray/Spare.cs: * DiscImageChef.Filesystems/Filesystem.cs: * DiscImageChef.Decoders/SCSI/MMC/AACS.cs: * DiscImageChef.Devices/FreeBSD/Extern.cs: * DiscImageChef.Devices/Device/Commands.cs: * DiscImageChef.Checksums/SHA384Context.cs: * DiscImageChef.Devices/FreeBSD/Command.cs: * DiscImageChef.Checksums/SHA512Context.cs: * DiscImageChef.Decoders/SCSI/MMC/Enums.cs: * DiscImageChef.Devices/Windows/Command.cs: * DiscImageChef.Devices/FreeBSD/Structs.cs: * DiscImageChef.Devices/Windows/Structs.cs: * DiscImageChef.Filesystems/LisaFS/Info.cs: * DiscImageChef.Checksums/SHA256Context.cs: * DiscImageChef.Filesystems/LisaFS/File.cs: * DiscImageChef.Filesystems/AppleHFSPlus.cs: * DiscImageChef.Filesystems/LisaFS/Super.cs: * DiscImageChef.Filesystems/LisaFS/Xattr.cs: * DiscImageChef.Checksums/Adler32Context.cs: * DiscImageChef.Decoders/Floppy/System34.cs: * DiscImageChef.Checksums/SpamSumContext.cs: * DiscImageChef.Decoders/SCSI/MMC/Hybrid.cs: * DiscImageChef.Devices/Device/Variables.cs: * DiscImageChef.Filesystems/LisaFS/Consts.cs: * DiscImageChef.Filesystems/LisaFS/LisaFS.cs: * DiscImageChef.Decoders/Floppy/Commodore.cs: * DiscImageChef.Checksums/FletcherContext.cs: * DiscImageChef.Filesystems/LisaFS/Extent.cs: * DiscImageChef.Devices/Device/Destructor.cs: * DiscImageChef.Decoders/Floppy/AppleSony.cs: * DiscImageChef.Filesystems/LisaFS/Structs.cs: * DiscImageChef.Decoders/SCSI/VendorString.cs: * DiscImageChef.Decoders/SCSI/MMC/Features.cs: * DiscImageChef.Devices/Device/Constructor.cs: * DiscImageChef.Checksums/RIPEMD160Context.cs: * DiscImageChef.Decoders/CD/CDTextOnLeadIn.cs: * DiscImageChef.Decoders/Blu-ray/Cartridge.cs: * DiscImageChef.Decoders/Floppy/System3740.cs: * DiscImageChef.Filesystems/LisaFS/Encoding.cs: * DiscImageChef.Decoders/SCSI/ModesEncoders.cs: * DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs: * DiscImageChef.Helpers/BigEndianBitConverter.cs: * DiscImageChef.Decoders/Floppy/Perpendicular.cs: * DiscImageChef.Decoders/SCSI/SSC/BlockLimits.cs: * DiscImageChef.Decoders/SCSI/MMC/WriteProtect.cs: * DiscImageChef.Devices/Device/ScsiCommands/HP.cs: * DiscImageChef.Devices/Device/AtaCommands/Cfa.cs: * DiscImageChef.Devices/Device/ScsiCommands/NEC.cs: * DiscImageChef.Helpers/EndianAwareBinaryReader.cs: * DiscImageChef.Devices/Device/ScsiCommands/MMC.cs: * DiscImageChef.Devices/Device/AtaCommands/MCPT.cs: * DiscImageChef.Devices/Device/ScsiCommands/SSC.cs: * DiscImageChef.Devices/Device/ScsiCommands/SPC.cs: * DiscImageChef.Devices/Device/ScsiCommands/SMC.cs: * DiscImageChef.Devices/Device/ScsiCommands/SBC.cs: * DiscImageChef.Metadata/Properties/AssemblyInfo.cs: * DiscImageChef.Devices/Device/AtaCommands/Atapi.cs: * DiscImageChef.Devices/Device/AtaCommands/Ata28.cs: * DiscImageChef.Devices/Device/AtaCommands/Smart.cs: * DiscImageChef.Decoders/SCSI/SSC/DensitySupport.cs: * DiscImageChef.Devices/Device/AtaCommands/Ata48.cs: * DiscImageChef.Decoders/SCSI/MMC/DiscInformation.cs: * DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs: * DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs: * DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs: * DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs: * DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs: * DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs: * DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs: * DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs: * DiscImageChef.Devices/Device/ScsiCommands/Certance.cs: * DiscImageChef.Decoders/SCSI/DiscStructureCapabilities.cs: * DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs: Relicensed as LGPL. Updated standard header. * DiscImageChef/Main.cs: * DiscImageChef/Plugins.cs: * DiscImageChef/Options.cs: * DiscImageChef/Commands/Ls.cs: * DiscImageChef/Core/IBGLog.cs: * DiscImageChef/Core/MHDDLog.cs: * DiscImageChef/AssemblyInfo.cs: * DiscImageChef/Core/Checksum.cs: * DiscImageChef/Commands/Decode.cs: * DiscImageChef/Core/Statistics.cs: * DiscImageChef/Commands/Verify.cs: * DiscImageChef/Commands/Formats.cs: * DiscImageChef/Commands/Entropy.cs: * DiscImageChef/Commands/Compare.cs: * DiscImageChef.Interop/DetectOS.cs: * DiscImageChef/Commands/Analyze.cs: * DiscImageChef/Commands/Commands.cs: * DiscImageChef/Commands/PrintHex.cs: * DiscImageChef/Commands/Checksum.cs: * DiscImageChef/DetectImageFormat.cs: * DiscImageChef/Commands/DumpMedia.cs: * DiscImageChef/Commands/Benchmark.cs: * DiscImageChef/Commands/Configure.cs: * DiscImageChef/Commands/MediaInfo.cs: * DiscImageChef.Interop/PlatformID.cs: * DiscImageChef/Commands/MediaScan.cs: * DiscImageChef/Commands/Statistics.cs: * DiscImageChef/Commands/DeviceInfo.cs: * DiscImageChef.Checksums/ReedSolomon.cs: * DiscImageChef/Commands/DeviceReport.cs: * DiscImageChef/Commands/ExtractFiles.cs: * DiscImageChef.Checksums/CDChecksums.cs: * DiscImageChef/Commands/CreateSidecar.cs: Updated standard header. * DiscImageChef.Checksums/DiscImageChef.Checksums.csproj: Relicensed project as LGPL. Updated standard header. Embed license as resource. * DiscImageChef.Console/DiscImageChef.Console.csproj: * DiscImageChef.Devices/DiscImageChef.Devices.csproj: * DiscImageChef.Helpers/DiscImageChef.Helpers.csproj: * DiscImageChef.Settings/DiscImageChef.Settings.csproj: * DiscImageChef.Decoders/DiscImageChef.Decoders.csproj: * DiscImageChef.Metadata/DiscImageChef.Metadata.csproj: * DiscImageChef.Partitions/DiscImageChef.Partitions.csproj: * DiscImageChef.DiscImages/DiscImageChef.DiscImages.csproj: * DiscImageChef.Filesystems/DiscImageChef.Filesystems.csproj: * DiscImageChef.CommonTypes/DiscImageChef.CommonTypes.csproj: Relicensed as LGPL. Updated standard header. Embed license as resource. * DiscImageChef/DiscImageChef.csproj: * DiscImageChef.Interop/DiscImageChef.Interop.csproj: Updated standard header. Embed license as resource.
2016-07-28 18:13:49 +01:00
// ****************************************************************************/
using System;
using System.Runtime.InteropServices;
using System.Text;
2020-02-27 00:33:26 +00:00
using Aaru.Checksums;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
2020-07-20 15:43:52 +01:00
using Aaru.Helpers;
2017-12-21 14:30:38 +00:00
using Schemas;
2020-02-27 00:33:26 +00:00
using Marshal = Aaru.Helpers.Marshal;
2020-02-27 00:33:26 +00:00
namespace Aaru.Filesystems
{
2016-07-28 22:25:26 +01:00
// Information from an old unnamed document
/// <inheritdoc />
2021-08-17 21:23:10 +01:00
/// <summary>Implements detection of IBM's High Performance File System (HPFS)</summary>
2020-07-22 13:20:25 +01:00
public sealed class HPFS : IFilesystem
{
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
2017-12-26 08:01:40 +00:00
public FileSystemType XmlFsType { get; private set; }
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
2021-08-17 21:23:10 +01:00
public Encoding Encoding { get; private set; }
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
2021-08-17 21:23:10 +01:00
public string Name => "OS/2 High Performance File System";
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
2021-08-17 21:23:10 +01:00
public Guid Id => new Guid("33513B2C-f590-4acb-8bf2-0b1d5e19dec5");
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
2021-08-17 21:23:10 +01:00
public string Author => "Natalia Portillo";
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
2020-02-29 18:03:35 +00:00
if(16 + partition.Start >= partition.End)
return false;
byte[] hpfsSbSector =
2017-12-19 20:33:03 +00:00
imagePlugin.ReadSector(16 + partition.Start); // Seek to superblock, on logical sector 16
2020-02-29 18:03:35 +00:00
uint magic1 = BitConverter.ToUInt32(hpfsSbSector, 0x000);
uint magic2 = BitConverter.ToUInt32(hpfsSbSector, 0x004);
2016-04-19 02:11:47 +01:00
return magic1 == 0xF995E849 && magic2 == 0xFA53E9C5;
}
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
2017-12-26 08:01:40 +00:00
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
2020-02-29 18:03:35 +00:00
Encoding encoding)
{
Encoding = encoding ?? Encoding.GetEncoding("ibm850");
information = "";
2016-04-19 02:11:47 +01:00
2020-02-29 18:03:35 +00:00
var sb = new StringBuilder();
2016-04-19 02:11:47 +01:00
byte[] hpfsBpbSector =
2017-12-19 20:33:03 +00:00
imagePlugin.ReadSector(0 + partition.Start); // Seek to BIOS parameter block, on logical sector 0
2020-02-29 18:03:35 +00:00
byte[] hpfsSbSector =
2017-12-19 20:33:03 +00:00
imagePlugin.ReadSector(16 + partition.Start); // Seek to superblock, on logical sector 16
2020-02-29 18:03:35 +00:00
byte[] hpfsSpSector =
2017-12-19 20:33:03 +00:00
imagePlugin.ReadSector(17 + partition.Start); // Seek to spareblock, on logical sector 17
* FileSystemIDandChk/BigEndianBitConverter.cs: Added BitConverter for BigEndian * FileSystemIDandChk/FileSystemIDandChk.csproj: FileSystemIDandChk/BigEndianBitConverter.cs * FileSystemIDandChk/ImagePlugins/CDRWin.cs: Corrected parsing Implemented all ImagePlugin methods * FileSystemIDandChk/ImagePlugins/ImagePlugin.cs: Used document auto formatting * FileSystemIDandChk/Main.cs: * FileSystemIDandChk/Plugins/FAT.cs: * FileSystemIDandChk/Plugins/BFS.cs: * FileSystemIDandChk/Plugins/FFS.cs: * FileSystemIDandChk/Plugins/ODS.cs: * FileSystemIDandChk/Plugins/HPFS.cs: * FileSystemIDandChk/Plugins/SysV.cs: * FileSystemIDandChk/Plugins/NTFS.cs: * FileSystemIDandChk/Plugins/extFS.cs: * FileSystemIDandChk/Plugins/Opera.cs: * FileSystemIDandChk/Plugins/ext2FS.cs: * FileSystemIDandChk/Plugins/Plugin.cs: * FileSystemIDandChk/Plugins/UNIXBFS.cs: * FileSystemIDandChk/Plugins/SolarFS.cs: * FileSystemIDandChk/PartPlugins/MBR.cs: * FileSystemIDandChk/Plugins/MinixFS.cs: * FileSystemIDandChk/Plugins/ISO9660.cs: * FileSystemIDandChk/Plugins/PCEngine.cs: * FileSystemIDandChk/Plugins/AppleHFS.cs: * FileSystemIDandChk/PartPlugins/NeXT.cs: * FileSystemIDandChk/Plugins/AppleMFS.cs: * FileSystemIDandChk/PartPlugins/AppleMap.cs: * FileSystemIDandChk/Plugins/AppleHFSPlus.cs: Added support for disc image plugins * FileSystemIDandChk/PartPlugins/PartPlugin.cs: Added support for disc image plugins Added start sector and length in sectors to partitions * FileSystemIDandChk/Plugins/Symbian.cs: Commented til code is adapted for disc image plugins git-svn-id: svn://claunia.com/FileSystemIDandChk@27 17725271-3d32-4980-a8cb-9ff532f270ba
2014-04-14 01:14:20 +00:00
2020-07-20 21:11:32 +01:00
BiosParameterBlock bpb = Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlock>(hpfsBpbSector);
2016-04-19 02:11:47 +01:00
2020-07-20 21:11:32 +01:00
SuperBlock hpfsSb = Marshal.ByteArrayToStructureLittleEndian<SuperBlock>(hpfsSbSector);
2020-07-20 21:11:32 +01:00
SpareBlock sp = Marshal.ByteArrayToStructureLittleEndian<SpareBlock>(hpfsSpSector);
2016-04-19 02:11:47 +01:00
2020-07-20 21:11:32 +01:00
if(StringHandlers.CToString(bpb.fs_type) != "HPFS " ||
hpfsSb.magic1 != 0xF995E849 ||
hpfsSb.magic2 != 0xFA53E9C5 ||
sp.magic1 != 0xF9911849 ||
sp.magic2 != 0xFA5229C5)
{
sb.AppendLine("This may not be HPFS, following information may be not correct.");
2020-07-20 21:11:32 +01:00
sb.AppendFormat("File system type: \"{0}\" (Should be \"HPFS \")", bpb.fs_type).AppendLine();
sb.AppendFormat("Superblock magic1: 0x{0:X8} (Should be 0xF995E849)", hpfsSb.magic1).AppendLine();
sb.AppendFormat("Superblock magic2: 0x{0:X8} (Should be 0xFA53E9C5)", hpfsSb.magic2).AppendLine();
2020-07-20 21:11:32 +01:00
sb.AppendFormat("Spareblock magic1: 0x{0:X8} (Should be 0xF9911849)", sp.magic1).AppendLine();
sb.AppendFormat("Spareblock magic2: 0x{0:X8} (Should be 0xFA5229C5)", sp.magic2).AppendLine();
}
2016-04-19 02:11:47 +01:00
2020-07-20 21:11:32 +01:00
sb.AppendFormat("OEM name: {0}", StringHandlers.CToString(bpb.oem_name)).AppendLine();
sb.AppendFormat("{0} bytes per sector", bpb.bps).AppendLine();
2020-02-29 18:03:35 +00:00
// sb.AppendFormat("{0} sectors per cluster", hpfs_bpb.spc).AppendLine();
// sb.AppendFormat("{0} reserved sectors", hpfs_bpb.rsectors).AppendLine();
// sb.AppendFormat("{0} FATs", hpfs_bpb.fats_no).AppendLine();
// sb.AppendFormat("{0} entries on root directory", hpfs_bpb.root_ent).AppendLine();
// sb.AppendFormat("{0} mini sectors on volume", hpfs_bpb.sectors).AppendLine();
2020-07-20 21:11:32 +01:00
sb.AppendFormat("Media descriptor: 0x{0:X2}", bpb.media).AppendLine();
2020-02-29 18:03:35 +00:00
// sb.AppendFormat("{0} sectors per FAT", hpfs_bpb.spfat).AppendLine();
// sb.AppendFormat("{0} sectors per track", hpfs_bpb.sptrk).AppendLine();
// sb.AppendFormat("{0} heads", hpfs_bpb.heads).AppendLine();
2020-07-20 21:11:32 +01:00
sb.AppendFormat("{0} sectors hidden before BPB", bpb.hsectors).AppendLine();
2020-02-29 18:03:35 +00:00
2020-07-20 21:11:32 +01:00
sb.AppendFormat("{0} sectors on volume ({1} bytes)", hpfsSb.sectors, hpfsSb.sectors * bpb.bps).AppendLine();
2020-02-29 18:03:35 +00:00
// sb.AppendFormat("{0} sectors on volume ({1} bytes)", hpfs_bpb.big_sectors, hpfs_bpb.big_sectors * hpfs_bpb.bps).AppendLine();
2020-07-20 21:11:32 +01:00
sb.AppendFormat("BIOS Drive Number: 0x{0:X2}", bpb.drive_no).AppendLine();
sb.AppendFormat("NT Flags: 0x{0:X2}", bpb.nt_flags).AppendLine();
sb.AppendFormat("Signature: 0x{0:X2}", bpb.signature).AppendLine();
sb.AppendFormat("Serial number: 0x{0:X8}", bpb.serial_no).AppendLine();
sb.AppendFormat("Volume label: {0}", StringHandlers.CToString(bpb.volume_label, Encoding)).AppendLine();
2020-02-29 18:03:35 +00:00
// sb.AppendFormat("Filesystem type: \"{0}\"", hpfs_bpb.fs_type).AppendLine();
DateTime lastChk = DateHandlers.UnixToDateTime(hpfsSb.last_chkdsk);
2017-12-23 03:59:48 +00:00
DateTime lastOptim = DateHandlers.UnixToDateTime(hpfsSb.last_optim);
2018-06-22 08:08:38 +01:00
sb.AppendFormat("HPFS version: {0}", hpfsSb.version).AppendLine();
sb.AppendFormat("Functional version: {0}", hpfsSb.func_version).AppendLine();
sb.AppendFormat("Sector of root directory FNode: {0}", hpfsSb.root_fnode).AppendLine();
sb.AppendFormat("{0} sectors are marked bad", hpfsSb.badblocks).AppendLine();
sb.AppendFormat("Sector of free space bitmaps: {0}", hpfsSb.bitmap_lsn).AppendLine();
sb.AppendFormat("Sector of bad blocks list: {0}", hpfsSb.badblock_lsn).AppendLine();
2020-02-29 18:03:35 +00:00
if(hpfsSb.last_chkdsk > 0)
sb.AppendFormat("Date of last integrity check: {0}", lastChk).AppendLine();
else
sb.AppendLine("Filesystem integrity has never been checked");
if(hpfsSb.last_optim > 0)
sb.AppendFormat("Date of last optimization {0}", lastOptim).AppendLine();
else
sb.AppendLine("Filesystem has never been optimized");
2018-06-22 08:08:38 +01:00
sb.AppendFormat("Directory band has {0} sectors", hpfsSb.dband_sectors).AppendLine();
sb.AppendFormat("Directory band starts at sector {0}", hpfsSb.dband_start).AppendLine();
sb.AppendFormat("Directory band ends at sector {0}", hpfsSb.dband_last).AppendLine();
sb.AppendFormat("Sector of directory band bitmap: {0}", hpfsSb.dband_bitmap).AppendLine();
2018-06-22 08:08:38 +01:00
sb.AppendFormat("Sector of ACL directory: {0}", hpfsSb.acl_start).AppendLine();
2020-07-20 21:11:32 +01:00
sb.AppendFormat("Sector of Hotfix directory: {0}", sp.hotfix_start).AppendLine();
sb.AppendFormat("{0} used Hotfix entries", sp.hotfix_used).AppendLine();
sb.AppendFormat("{0} total Hotfix entries", sp.hotfix_entries).AppendLine();
sb.AppendFormat("{0} free spare DNodes", sp.spare_dnodes_free).AppendLine();
sb.AppendFormat("{0} total spare DNodes", sp.spare_dnodes).AppendLine();
sb.AppendFormat("Sector of codepage directory: {0}", sp.codepage_lsn).AppendLine();
sb.AppendFormat("{0} codepages used in the volume", sp.codepages).AppendLine();
sb.AppendFormat("SuperBlock CRC32: {0:X8}", sp.sb_crc32).AppendLine();
sb.AppendFormat("SpareBlock CRC32: {0:X8}", sp.sp_crc32).AppendLine();
2016-04-19 02:11:47 +01:00
sb.AppendLine("Flags:");
2020-07-20 21:11:32 +01:00
sb.AppendLine((sp.flags1 & 0x01) == 0x01 ? "Filesystem is dirty." : "Filesystem is clean.");
2020-02-29 18:03:35 +00:00
2020-07-20 21:11:32 +01:00
if((sp.flags1 & 0x02) == 0x02)
2020-02-29 18:03:35 +00:00
sb.AppendLine("Spare directory blocks are in use");
2020-07-20 21:11:32 +01:00
if((sp.flags1 & 0x04) == 0x04)
2020-02-29 18:03:35 +00:00
sb.AppendLine("Hotfixes are in use");
2020-07-20 21:11:32 +01:00
if((sp.flags1 & 0x08) == 0x08)
2020-02-29 18:03:35 +00:00
sb.AppendLine("Disk contains bad sectors");
2020-07-20 21:11:32 +01:00
if((sp.flags1 & 0x10) == 0x10)
2020-02-29 18:03:35 +00:00
sb.AppendLine("Disk has a bad bitmap");
2020-07-20 21:11:32 +01:00
if((sp.flags1 & 0x20) == 0x20)
2020-02-29 18:03:35 +00:00
sb.AppendLine("Filesystem was formatted fast");
2020-07-20 21:11:32 +01:00
if((sp.flags1 & 0x40) == 0x40)
2020-02-29 18:03:35 +00:00
sb.AppendLine("Unknown flag 0x40 on flags1 is active");
2020-07-20 21:11:32 +01:00
if((sp.flags1 & 0x80) == 0x80)
2020-02-29 18:03:35 +00:00
sb.AppendLine("Filesystem has been mounted by an old IFS");
2020-07-20 21:11:32 +01:00
if((sp.flags2 & 0x01) == 0x01)
2020-02-29 18:03:35 +00:00
sb.AppendLine("Install DASD limits");
2020-07-20 21:11:32 +01:00
if((sp.flags2 & 0x02) == 0x02)
2020-02-29 18:03:35 +00:00
sb.AppendLine("Resync DASD limits");
2020-07-20 21:11:32 +01:00
if((sp.flags2 & 0x04) == 0x04)
2020-02-29 18:03:35 +00:00
sb.AppendLine("DASD limits are operational");
2020-07-20 21:11:32 +01:00
if((sp.flags2 & 0x08) == 0x08)
2020-02-29 18:03:35 +00:00
sb.AppendLine("Multimedia is active");
2020-07-20 21:11:32 +01:00
if((sp.flags2 & 0x10) == 0x10)
2020-02-29 18:03:35 +00:00
sb.AppendLine("DCE ACLs are active");
2020-07-20 21:11:32 +01:00
if((sp.flags2 & 0x20) == 0x20)
2020-02-29 18:03:35 +00:00
sb.AppendLine("DASD limits are dirty");
2020-07-20 21:11:32 +01:00
if((sp.flags2 & 0x40) == 0x40)
2020-02-29 18:03:35 +00:00
sb.AppendLine("Unknown flag 0x40 on flags2 is active");
2020-07-20 21:11:32 +01:00
if((sp.flags2 & 0x80) == 0x80)
2020-02-29 18:03:35 +00:00
sb.AppendLine("Unknown flag 0x80 on flags2 is active");
2017-12-26 08:01:40 +00:00
XmlFsType = new FileSystemType();
// Theoretically everything from BPB to SB is boot code, should I hash everything or only the sector loaded by BIOS itself?
2020-07-20 21:11:32 +01:00
if(bpb.jump[0] == 0xEB &&
bpb.jump[1] > 0x3C &&
bpb.jump[1] < 0x80 &&
bpb.signature2 == 0xAA55)
{
2018-06-22 08:08:38 +01:00
XmlFsType.Bootable = true;
2020-07-20 21:11:32 +01:00
string bootChk = Sha1Context.Data(bpb.boot_code, out byte[] _);
sb.AppendLine("Volume is bootable");
sb.AppendFormat("Boot code's SHA1: {0}", bootChk).AppendLine();
}
2020-07-20 21:11:32 +01:00
XmlFsType.Dirty |= (sp.flags1 & 0x01) == 0x01;
XmlFsType.Clusters = hpfsSb.sectors;
2020-07-20 21:11:32 +01:00
XmlFsType.ClusterSize = bpb.bps;
XmlFsType.Type = "HPFS";
2020-07-20 21:11:32 +01:00
XmlFsType.VolumeName = StringHandlers.CToString(bpb.volume_label, Encoding);
XmlFsType.VolumeSerial = $"{bpb.serial_no:X8}";
XmlFsType.SystemIdentifier = StringHandlers.CToString(bpb.oem_name);
2016-04-19 02:11:47 +01:00
information = sb.ToString();
}
2020-02-29 18:03:35 +00:00
/// <summary>BIOS Parameter Block, at sector 0</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct BiosParameterBlock
{
2015-12-06 07:18:36 +00:00
/// <summary>0x000, Jump to boot code</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
2020-02-29 18:03:35 +00:00
public readonly byte[] jump;
2015-12-06 07:18:36 +00:00
/// <summary>0x003, OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
2020-02-29 18:03:35 +00:00
public readonly byte[] oem_name;
2015-12-06 07:18:36 +00:00
/// <summary>0x00B, Bytes per sector</summary>
2020-02-29 18:03:35 +00:00
public readonly ushort bps;
2015-12-06 07:18:36 +00:00
/// <summary>0x00D, Sectors per cluster</summary>
2020-02-29 18:03:35 +00:00
public readonly byte spc;
2015-12-06 07:18:36 +00:00
/// <summary>0x00E, Reserved sectors between BPB and... does it have sense in HPFS?</summary>
2020-02-29 18:03:35 +00:00
public readonly ushort rsectors;
2015-12-06 07:18:36 +00:00
/// <summary>0x010, Number of FATs... seriously?</summary>
2020-02-29 18:03:35 +00:00
public readonly byte fats_no;
2015-12-06 07:18:36 +00:00
/// <summary>0x011, Number of entries on root directory... ok</summary>
2020-02-29 18:03:35 +00:00
public readonly ushort root_ent;
2015-12-06 07:18:36 +00:00
/// <summary>0x013, Sectors in volume... doubt it</summary>
2020-02-29 18:03:35 +00:00
public readonly ushort sectors;
2015-12-06 07:18:36 +00:00
/// <summary>0x015, Media descriptor</summary>
2020-02-29 18:03:35 +00:00
public readonly byte media;
2015-12-06 07:18:36 +00:00
/// <summary>0x016, Sectors per FAT... again</summary>
2020-02-29 18:03:35 +00:00
public readonly ushort spfat;
2015-12-06 07:18:36 +00:00
/// <summary>0x018, Sectors per track... you're kidding</summary>
2020-02-29 18:03:35 +00:00
public readonly ushort sptrk;
2015-12-06 07:18:36 +00:00
/// <summary>0x01A, Heads... stop!</summary>
2020-02-29 18:03:35 +00:00
public readonly ushort heads;
2015-12-06 07:18:36 +00:00
/// <summary>0x01C, Hidden sectors before BPB</summary>
2020-02-29 18:03:35 +00:00
public readonly uint hsectors;
2015-12-06 07:18:36 +00:00
/// <summary>0x024, Sectors in volume if &gt; 65535...</summary>
2020-02-29 18:03:35 +00:00
public readonly uint big_sectors;
2015-12-06 07:18:36 +00:00
/// <summary>0x028, Drive number</summary>
2020-02-29 18:03:35 +00:00
public readonly byte drive_no;
2015-12-06 07:18:36 +00:00
/// <summary>0x029, Volume flags?</summary>
2020-02-29 18:03:35 +00:00
public readonly byte nt_flags;
2015-12-06 07:18:36 +00:00
/// <summary>0x02A, EPB signature, 0x29</summary>
2020-02-29 18:03:35 +00:00
public readonly byte signature;
2015-12-06 07:18:36 +00:00
/// <summary>0x02B, Volume serial number</summary>
2020-02-29 18:03:35 +00:00
public readonly uint serial_no;
2015-12-06 07:18:36 +00:00
/// <summary>0x02F, Volume label, 11 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
2020-02-29 18:03:35 +00:00
public readonly byte[] volume_label;
2015-12-06 07:18:36 +00:00
/// <summary>0x03A, Filesystem type, 8 bytes, space-padded ("HPFS ")</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
2020-02-29 18:03:35 +00:00
public readonly byte[] fs_type;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 448)]
2020-02-29 18:03:35 +00:00
public readonly byte[] boot_code;
/// <summary>0x1FE, 0xAA55</summary>
2020-02-29 18:03:35 +00:00
public readonly ushort signature2;
}
2020-02-29 18:03:35 +00:00
/// <summary>HPFS superblock at sector 16</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct SuperBlock
{
2015-12-06 07:18:36 +00:00
/// <summary>0x000, 0xF995E849</summary>
2020-02-29 18:03:35 +00:00
public readonly uint magic1;
2015-12-06 07:18:36 +00:00
/// <summary>0x004, 0xFA53E9C5</summary>
2020-02-29 18:03:35 +00:00
public readonly uint magic2;
2015-12-06 07:18:36 +00:00
/// <summary>0x008, HPFS version</summary>
2020-02-29 18:03:35 +00:00
public readonly byte version;
2015-12-06 07:18:36 +00:00
/// <summary>0x009, 2 if &lt;= 4 GiB, 3 if &gt; 4 GiB</summary>
2020-02-29 18:03:35 +00:00
public readonly byte func_version;
2015-12-06 07:18:36 +00:00
/// <summary>0x00A, Alignment</summary>
2020-02-29 18:03:35 +00:00
public readonly ushort dummy;
2015-12-06 07:18:36 +00:00
/// <summary>0x00C, LSN pointer to root fnode</summary>
2020-02-29 18:03:35 +00:00
public readonly uint root_fnode;
2015-12-06 07:18:36 +00:00
/// <summary>0x010, Sectors on volume</summary>
2020-02-29 18:03:35 +00:00
public readonly uint sectors;
2015-12-06 07:18:36 +00:00
/// <summary>0x014, Bad blocks on volume</summary>
2020-02-29 18:03:35 +00:00
public readonly uint badblocks;
2015-12-06 07:18:36 +00:00
/// <summary>0x018, LSN pointer to volume bitmap</summary>
2020-02-29 18:03:35 +00:00
public readonly uint bitmap_lsn;
2015-12-06 07:18:36 +00:00
/// <summary>0x01C, 0</summary>
2020-02-29 18:03:35 +00:00
public readonly uint zero1;
2015-12-06 07:18:36 +00:00
/// <summary>0x020, LSN pointer to badblock directory</summary>
2020-02-29 18:03:35 +00:00
public readonly uint badblock_lsn;
2015-12-06 07:18:36 +00:00
/// <summary>0x024, 0</summary>
2020-02-29 18:03:35 +00:00
public readonly uint zero2;
2015-12-06 07:18:36 +00:00
/// <summary>0x028, Time of last CHKDSK</summary>
2020-02-29 18:03:35 +00:00
public readonly int last_chkdsk;
2015-12-06 07:18:36 +00:00
/// <summary>0x02C, Time of last optimization</summary>
2020-02-29 18:03:35 +00:00
public readonly int last_optim;
2015-12-06 07:18:36 +00:00
/// <summary>0x030, Sectors of dir band</summary>
2020-02-29 18:03:35 +00:00
public readonly uint dband_sectors;
2015-12-06 07:18:36 +00:00
/// <summary>0x034, Start sector of dir band</summary>
2020-02-29 18:03:35 +00:00
public readonly uint dband_start;
2015-12-06 07:18:36 +00:00
/// <summary>0x038, Last sector of dir band</summary>
2020-02-29 18:03:35 +00:00
public readonly uint dband_last;
2015-12-06 07:18:36 +00:00
/// <summary>0x03C, LSN of free space bitmap</summary>
2020-02-29 18:03:35 +00:00
public readonly uint dband_bitmap;
2015-12-06 07:18:36 +00:00
/// <summary>0x040, Can be used for volume name (32 bytes)</summary>
2020-02-29 18:03:35 +00:00
public readonly ulong zero3;
2015-12-06 07:18:36 +00:00
/// <summary>0x048, ...</summary>
2020-02-29 18:03:35 +00:00
public readonly ulong zero4;
2015-12-06 07:18:36 +00:00
/// <summary>0x04C, ...</summary>
2020-02-29 18:03:35 +00:00
public readonly ulong zero5;
2015-12-06 07:18:36 +00:00
/// <summary>0x050, ...;</summary>
2020-02-29 18:03:35 +00:00
public readonly ulong zero6;
2015-12-06 07:18:36 +00:00
/// <summary>0x058, LSN pointer to ACLs (only HPFS386)</summary>
2020-02-29 18:03:35 +00:00
public readonly uint acl_start;
}
2020-02-29 18:03:35 +00:00
/// <summary>HPFS spareblock at sector 17</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct SpareBlock
{
2015-12-06 07:18:36 +00:00
/// <summary>0x000, 0xF9911849</summary>
2020-02-29 18:03:35 +00:00
public readonly uint magic1;
2015-12-06 07:18:36 +00:00
/// <summary>0x004, 0xFA5229C5</summary>
2020-02-29 18:03:35 +00:00
public readonly uint magic2;
2015-12-06 07:18:36 +00:00
/// <summary>0x008, HPFS flags</summary>
2020-02-29 18:03:35 +00:00
public readonly byte flags1;
2015-12-06 07:18:36 +00:00
/// <summary>0x009, HPFS386 flags</summary>
2020-02-29 18:03:35 +00:00
public readonly byte flags2;
2015-12-06 07:18:36 +00:00
/// <summary>0x00A, Alignment</summary>
2020-02-29 18:03:35 +00:00
public readonly ushort dummy;
2015-12-06 07:18:36 +00:00
/// <summary>0x00C, LSN of hotfix directory</summary>
2020-02-29 18:03:35 +00:00
public readonly uint hotfix_start;
2015-12-06 07:18:36 +00:00
/// <summary>0x010, Used hotfixes</summary>
2020-02-29 18:03:35 +00:00
public readonly uint hotfix_used;
2015-12-06 07:18:36 +00:00
/// <summary>0x014, Total hotfixes available</summary>
2020-02-29 18:03:35 +00:00
public readonly uint hotfix_entries;
2015-12-06 07:18:36 +00:00
/// <summary>0x018, Unused spare dnodes</summary>
2020-02-29 18:03:35 +00:00
public readonly uint spare_dnodes_free;
2015-12-06 07:18:36 +00:00
/// <summary>0x01C, Length of spare dnodes list</summary>
2020-02-29 18:03:35 +00:00
public readonly uint spare_dnodes;
2015-12-06 07:18:36 +00:00
/// <summary>0x020, LSN of codepage directory</summary>
2020-02-29 18:03:35 +00:00
public readonly uint codepage_lsn;
2015-12-06 07:18:36 +00:00
/// <summary>0x024, Number of codepages used</summary>
2020-02-29 18:03:35 +00:00
public readonly uint codepages;
2015-12-06 07:18:36 +00:00
/// <summary>0x028, SuperBlock CRC32 (only HPFS386)</summary>
2020-02-29 18:03:35 +00:00
public readonly uint sb_crc32;
2015-12-06 07:18:36 +00:00
/// <summary>0x02C, SpareBlock CRC32 (only HPFS386)</summary>
2020-02-29 18:03:35 +00:00
public readonly uint sp_crc32;
}
}
2017-12-19 20:33:03 +00:00
}