Files
Aaru/Aaru.Partitions/MBR.cs

963 lines
39 KiB
C#
Raw Normal View History

* 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
// /***************************************************************************
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 : MBR.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Partitioning scheme plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Manages Intel/Microsoft MBR (aka Master Boot Record).
* 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
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
2024-12-19 10:45:18 +00: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.Collections.Generic;
2020-07-20 07:47:12 +01:00
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
2020-02-27 00:33:26 +00:00
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Partitions;
2022-03-06 13:29:38 +00:00
// TODO: Support AAP extensions
/// <inheritdoc />
/// <summary>Implements decoding of Intel/Microsoft Master Boot Record and extensions</summary>
public sealed class MBR : IPartition
{
2022-03-06 13:29:38 +00:00
const ulong GPT_MAGIC = 0x5452415020494645;
const ushort MBR_MAGIC = 0xAA55;
const ushort NEC_MAGIC = 0xA55A;
const ushort DM_MAGIC = 0x55AA;
const string MODULE_NAME = "Master Boot Record (MBR) plugin";
2022-03-06 13:29:38 +00:00
[SuppressMessage("ReSharper", "StringLiteralTypo")]
2022-03-06 13:29:38 +00:00
static readonly string[] _mbrTypes =
2024-05-01 04:39:38 +01:00
[
2022-03-06 13:29:38 +00:00
// 0x00
Localization.Empty, Localization.FAT12, Localization.XENIX_root, Localization.XENIX_usr,
2022-03-06 13:29:38 +00:00
// 0x04
Localization.FAT16_32_MiB, Localization.Extended, Localization.FAT16, Localization.IFS_HPFS_NTFS,
2022-03-06 13:29:38 +00:00
// 0x08
Localization.AIX_boot_OS2_Commodore_DOS, Localization.AIX_data_Coherent_QNX,
Localization.Coherent_swap_OPUS_OS_2_Boot_Manager, Localization.FAT32,
2022-03-06 13:29:38 +00:00
// 0x0C
Localization.FAT32_LBA, Localization.Unknown_partition_type, Localization.FAT16_LBA, Localization.Extended_LBA,
2022-03-06 13:29:38 +00:00
// 0x10
Localization.OPUS, Localization.Hidden_FAT12, Localization.Compaq_diagnostics_recovery_partition,
Localization.Unknown_partition_type,
2022-03-06 13:29:38 +00:00
// 0x14
Localization.Hidden_FAT16_32_MiB_AST_DOS, Localization.Unknown_partition_type, Localization.Hidden_FAT16,
Localization.Hidden_IFS_HPFS_NTFS,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x18
Localization.AST_Windows_swap, Localization.Willowtech_Photon_coS, Localization.Unknown_partition_type,
Localization.Hidden_FAT32,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x1C
Localization.Hidden_FAT32_LBA, Localization.Unknown_partition_type, Localization.Hidden_FAT16_LBA,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x20
Localization.Willowsoft_Overture_File_System, Localization.Oxygen_FSo2, Localization.Oxygen_Extended,
Localization.SpeedStor_reserved,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x24
Localization.NEC_DOS, Localization.Unknown_partition_type, Localization.SpeedStor_reserved,
Localization.Hidden_NTFS,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x28
Localization.Unknown_partition_type, Localization.Unknown_partition_type, Localization.Unknown_partition_type,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x2C
Localization.Unknown_partition_type, Localization.Unknown_partition_type, Localization.Unknown_partition_type,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x30
Localization.Unknown_partition_type, Localization.SpeedStor_reserved, Localization.Unknown_partition_type,
Localization.SpeedStor_reserved,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x34
Localization.SpeedStor_reserved, Localization.Unknown_partition_type, Localization.SpeedStor_reserved,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x38
Localization.Theos, Localization.Plan_9, Localization.Unknown_partition_type,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x3C
Localization.Partition_Magic, Localization.Hidden_NetWare, Localization.Unknown_partition_type,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x40
Localization.VENIX_80286, Localization.PReP_Boot, Localization.Secure_File_System, Localization.PTS_DOS,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x44
Localization.Unknown_partition_type, Localization.Priam_EUMEL_Elan, Localization.EUMEL_Elan,
Localization.EUMEL_Elan,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x48
Localization.EUMEL_Elan, Localization.Unknown_partition_type,
Localization.ALFS_THIN_lightweight_filesystem_for_DOS, Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x4C
Localization.Unknown_partition_type, Localization.QNX_4, Localization.QNX_4, Localization.QNX_4_Oberon,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x50
Localization.Ontrack_DM_RO_FAT, Localization.Ontrack_DM_RW_FAT, Localization.CPM_Microport_UNIX,
Localization.Ontrack_DM_6,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x54
Localization.Ontrack_DM_6, Localization.EZ_Drive, Localization.Golden_Bow_VFeature,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x58
Localization.Unknown_partition_type, Localization.Unknown_partition_type, Localization.Unknown_partition_type,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x5C
Localization.Priam_EDISK, Localization.Unknown_partition_type, Localization.Unknown_partition_type,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x60
Localization.Unknown_partition_type, Localization.SpeedStor, Localization.Unknown_partition_type,
Localization.GNU_Hurd_System_V_386ix,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x64
Localization.NetWare_286, Localization.NetWare, Localization.NetWare_386, Localization.NetWare,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x68
Localization.NetWare, Localization.NetWare_NSS, Localization.Unknown_partition_type,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x6C
Localization.Unknown_partition_type, Localization.Unknown_partition_type, Localization.Unknown_partition_type,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x70
Localization.DiskSecure_Multi_Boot, Localization.Unknown_partition_type, Localization.UNIX_7th_Edition,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x74
Localization.Unknown_partition_type, Localization.IBM_PC_IX, Localization.Unknown_partition_type,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x78
Localization.Unknown_partition_type, Localization.Unknown_partition_type, Localization.Unknown_partition_type,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x7C
Localization.Unknown_partition_type, Localization.Unknown_partition_type, Localization.Unknown_partition_type,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x80
Localization.Old_MINIX, Localization.MINIX_Old_Linux, Localization.Linux_swap_Solaris, Localization.Linux,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x84
Localization.Hidden_by_OS2_APM_hibernation, Localization.Linux_extended, Localization.NT_Stripe_Set,
Localization.NT_Stripe_Set,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x88
Localization.Linux_Plaintext, Localization.Unknown_partition_type, Localization.Unknown_partition_type,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x8C
Localization.Unknown_partition_type, Localization.Unknown_partition_type, Localization.Linux_LVM,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x90
Localization.Unknown_partition_type, Localization.Unknown_partition_type, Localization.Unknown_partition_type,
Localization.Amoeba_Hidden_Linux,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x94
Localization.Amoeba_bad_blocks, Localization.Unknown_partition_type, Localization.Unknown_partition_type,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x98
Localization.Unknown_partition_type, Localization.Mylex_EISA_SCSI, Localization.Unknown_partition_type,
Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0x9C
Localization.Unknown_partition_type, Localization.Unknown_partition_type, Localization.Unknown_partition_type,
Localization.BSD_OS,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xA0
Localization.Hibernation, Localization.HP_Volume_Expansion, Localization.Unknown_partition_type,
Localization.HP_Volume_Expansion,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xA4
Localization.HP_Volume_Expansion, Localization.FreeBSD, Localization.OpenBSD, Localization.NeXTStep,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xA8
Localization.Apple_UFS, Localization.NetBSD, Localization.Olivetti_DOS_FAT12, Localization.Apple_Boot,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xAC
Localization.Unknown_partition_type, Localization.Unknown_partition_type, Localization.Unknown_partition_type,
Localization.Apple_HFS,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xB0
Localization.BootStar, Localization.HP_Volume_Expansion, Localization.Unknown_partition_type,
Localization.HP_Volume_Expansion,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xB4
Localization.HP_Volume_Expansion, Localization.Unknown_partition_type, Localization.HP_Volume_Expansion,
Localization.BSDi,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xB8
"BSDi swap", Localization.Unknown_partition_type, Localization.Unknown_partition_type,
Localization.PTS_BootWizard,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xBC
Localization.Unknown_partition_type, Localization.Unknown_partition_type, Localization.Solaris_boot,
Localization.Solaris,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xC0
Localization.Novell_DOS_DR_DOS_secured, Localization.DR_DOS_secured_FAT12, Localization.DR_DOS_reserved,
Localization.DR_DOS_reserved,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xC4
Localization.DR_DOS_secured_FAT16_32_MiB, Localization.Unknown_partition_type,
Localization.DR_DOS_secured_FAT16, Localization.Syrinx,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xC8
Localization.DR_DOS_reserved, Localization.DR_DOS_reserved, Localization.DR_DOS_reserved,
Localization.DR_DOS_secured_FAT32,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xCC
Localization.DR_DOS_secured_FAT32_LBA, Localization.DR_DOS_reserved, Localization.DR_DOS_secured_FAT16_LBA,
Localization.DR_DOS_secured_extended_LBA,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xD0
Localization.Multiuser_DOS_secured_FAT12, Localization.Multiuser_DOS_secured_FAT12,
Localization.Unknown_partition_type, Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xD4
Localization.Multiuser_DOS_secured_FAT16_32_MiB, Localization.Multiuser_DOS_secured_extended,
Localization.Multiuser_DOS_secured_FAT16, Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xD8
Localization.CPM, Localization.Unknown_partition_type, Localization.Filesystem_less_data,
Localization.CPM_CCPM_CTOS,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xDC
Localization.Unknown_partition_type, Localization.Unknown_partition_type, Localization.Dell_partition,
Localization.BootIt_EMBRM,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xE0
Localization.Unknown_partition_type, Localization.SpeedStor, Localization.DOS_read_only, Localization.SpeedStor,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xE4
Localization.SpeedStor, Localization.Tandy_DOS, Localization.SpeedStor, Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xE8
Localization.Unknown_partition_type, Localization.Unknown_partition_type, Localization.Unknown_partition_type,
Localization.BeOS,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xEC
Localization.Unknown_partition_type, Localization.Sprytx, Localization.Guid_Partition_Table,
Localization.EFI_system_partition,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xF0
Localization.Linux_boot, Localization.SpeedStor, Localization.DOS_3_3_secondary_Unisys_DOS,
Localization.SpeedStor,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xF4
Localization.SpeedStor, Localization.Prologue, Localization.SpeedStor, Localization.Unknown_partition_type,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xF8
Localization.Unknown_partition_type, Localization.Unknown_partition_type, Localization.Unknown_partition_type,
Localization.VMware_VMFS,
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
// 0xFC
Localization.VMWare_VMKCORE, Localization.Linux_RAID_FreeDOS, Localization.SpeedStor_LANStep_PS2_IML,
Localization.Xenix_bad_block
2024-05-01 04:39:38 +01:00
];
2020-02-29 18:03:35 +00:00
#region IPartition Members
2022-03-06 13:29:38 +00:00
/// <inheritdoc />
public string Name => Localization.MBR_Name;
2022-03-06 13:29:38 +00:00
/// <inheritdoc />
public Guid Id => new("5E8A34E8-4F1A-59E6-4BF7-7EA647063A76");
2022-03-06 13:29:38 +00:00
/// <inheritdoc />
2023-10-05 01:52:48 +01:00
public string Author => Authors.NATALIA_PORTILLO;
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
/// <inheritdoc />
[SuppressMessage("ReSharper", "UnusedVariable")]
public bool GetInformation(IMediaImage imagePlugin, out List<Partition> partitions, ulong sectorOffset)
{
ulong counter = 0;
2020-02-29 18:03:35 +00:00
2024-05-01 04:39:38 +01:00
partitions = [];
2020-02-29 18:03:35 +00:00
2024-05-01 04:05:22 +01:00
if(imagePlugin.Info.SectorSize < 512) return false;
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
uint sectorSize = imagePlugin.Info.SectorSize;
2022-03-06 13:29:38 +00:00
// Divider of sector size in MBR between real sector size
ulong divider = 1;
* 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
if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc)
* 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
{
2022-03-06 13:29:38 +00:00
sectorSize = 512;
divider = 4;
}
2016-04-19 02:11:47 +01:00
2022-03-06 13:29:38 +00:00
ErrorNumber errno = imagePlugin.ReadSector(sectorOffset, out byte[] sector);
2024-05-01 04:05:22 +01:00
if(errno != ErrorNumber.NoError) return false;
2022-03-06 13:29:38 +00:00
MasterBootRecord mbr = Marshal.ByteArrayToStructureLittleEndian<MasterBootRecord>(sector);
TimedMasterBootRecord mbrTime = Marshal.ByteArrayToStructureLittleEndian<TimedMasterBootRecord>(sector);
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
SerializedMasterBootRecord mbrSerial =
Marshal.ByteArrayToStructureLittleEndian<SerializedMasterBootRecord>(sector);
2016-04-19 02:11:47 +01:00
2022-03-06 13:29:38 +00:00
ModernMasterBootRecord mbrModern = Marshal.ByteArrayToStructureLittleEndian<ModernMasterBootRecord>(sector);
NecMasterBootRecord mbrNec = Marshal.ByteArrayToStructureLittleEndian<NecMasterBootRecord>(sector);
* 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
2022-03-06 13:29:38 +00:00
DiskManagerMasterBootRecord mbrOntrack =
Marshal.ByteArrayToStructureLittleEndian<DiskManagerMasterBootRecord>(sector);
AaruConsole.DebugWriteLine(MODULE_NAME, "xmlmedia = {0}", imagePlugin.Info.MetadataMediaType);
AaruConsole.DebugWriteLine(MODULE_NAME, "mbr.magic = {0:X4}", mbr.magic);
* 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
2024-05-01 04:05:22 +01:00
if(mbr.magic != MBR_MAGIC) return false; // Not MBR
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
errno = imagePlugin.ReadSector(1 + sectorOffset, out byte[] hdrBytes);
2020-02-29 18:03:35 +00:00
2024-05-01 04:05:22 +01:00
if(errno != ErrorNumber.NoError) return false;
2020-02-29 18:03:35 +00:00
var signature = BitConverter.ToUInt64(hdrBytes, 0);
2016-04-19 02:11:47 +01:00
AaruConsole.DebugWriteLine(MODULE_NAME, "gpt.signature = 0x{0:X16}", signature);
2024-05-01 04:05:22 +01:00
if(signature == GPT_MAGIC) return false;
if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc)
2022-03-06 13:29:38 +00:00
{
errno = imagePlugin.ReadSector(sectorOffset, out hdrBytes);
2024-05-01 04:05:22 +01:00
if(errno != ErrorNumber.NoError) return false;
2022-03-06 13:29:38 +00:00
signature = BitConverter.ToUInt64(hdrBytes, 512);
AaruConsole.DebugWriteLine(MODULE_NAME, "gpt.signature @ 0x200 = 0x{0:X16}", signature);
2024-05-01 04:05:22 +01:00
if(signature == GPT_MAGIC) return false;
2022-03-06 13:29:38 +00:00
}
PartitionEntry[] entries;
if(mbrOntrack.dm_magic == DM_MAGIC)
entries = mbrOntrack.entries;
else if(mbrNec.nec_magic == NEC_MAGIC)
entries = mbrNec.entries;
else
entries = mbr.entries;
2022-03-06 13:29:38 +00:00
foreach(PartitionEntry entry in entries)
{
var startSector = (byte)(entry.start_sector & 0x3F);
var startCylinder = (ushort)((entry.start_sector & 0xC0) << 2 | entry.start_cylinder);
var endSector = (byte)(entry.end_sector & 0x3F);
var endCylinder = (ushort)((entry.end_sector & 0xC0) << 2 | entry.end_cylinder);
ulong lbaStart = entry.lba_start;
ulong lbaSectors = entry.lba_sectors;
2022-03-06 13:29:38 +00:00
// Let's start the fun...
var valid = true;
var extended = false;
var minix = false;
2022-03-06 13:29:38 +00:00
2024-05-01 04:05:22 +01:00
if(entry.status != 0x00 && entry.status != 0x80) return false; // Maybe a FAT filesystem
2022-03-06 13:29:38 +00:00
valid &= entry.type != 0x00;
2022-03-16 11:47:00 +00:00
if(entry.type is 0x05 or 0x0F or 0x15 or 0x1F or 0x85 or 0x91 or 0x9B or 0xC5 or 0xCF or 0xD5)
{
2022-03-06 13:29:38 +00:00
valid = false;
extended = true; // Extended partition
}
2022-03-16 11:47:00 +00:00
minix |= entry.type is 0x81 or 0x80; // MINIX partition
2022-03-06 13:29:38 +00:00
valid &= entry.lba_start != 0 ||
entry.lba_sectors != 0 ||
entry.start_cylinder != 0 ||
entry.start_head != 0 ||
entry.start_sector != 0 ||
entry.end_cylinder != 0 ||
entry.end_head != 0 ||
entry.end_sector != 0;
if(entry is { lba_start: 0, lba_sectors: 0 } && valid)
2022-03-06 13:29:38 +00:00
{
2024-05-01 04:05:22 +01:00
lbaStart = CHS.ToLBA(startCylinder,
entry.start_head,
startSector,
imagePlugin.Info.Heads,
2022-03-06 13:29:38 +00:00
imagePlugin.Info.SectorsPerTrack);
2020-02-29 18:03:35 +00:00
2024-05-01 04:05:22 +01:00
lbaSectors = CHS.ToLBA(endCylinder,
entry.end_head,
entry.end_sector,
imagePlugin.Info.Heads,
imagePlugin.Info.SectorsPerTrack) -
lbaStart;
}
2022-03-06 13:29:38 +00:00
// For optical media
lbaStart /= divider;
lbaSectors /= divider;
2016-04-19 02:11:47 +01:00
2024-05-01 04:05:22 +01:00
if(minix && lbaStart == sectorOffset) minix = false;
2016-04-19 02:11:47 +01:00
2022-03-06 13:29:38 +00:00
if(lbaStart > imagePlugin.Info.Sectors)
{
2022-03-06 13:29:38 +00:00
valid = false;
extended = false;
}
2018-06-22 08:08:38 +01:00
2022-03-06 13:29:38 +00:00
// Some buggy implementations do some rounding errors getting a few sectors beyond device size
2024-05-01 04:05:22 +01:00
if(lbaStart + lbaSectors > imagePlugin.Info.Sectors) lbaSectors = imagePlugin.Info.Sectors - lbaStart;
2022-03-06 13:29:38 +00:00
AaruConsole.DebugWriteLine(MODULE_NAME, "entry.status {0}", entry.status);
AaruConsole.DebugWriteLine(MODULE_NAME, "entry.type {0}", entry.type);
AaruConsole.DebugWriteLine(MODULE_NAME, "entry.lba_start {0}", entry.lba_start);
AaruConsole.DebugWriteLine(MODULE_NAME, "entry.lba_sectors {0}", entry.lba_sectors);
AaruConsole.DebugWriteLine(MODULE_NAME, "entry.start_cylinder {0}", startCylinder);
AaruConsole.DebugWriteLine(MODULE_NAME, "entry.start_head {0}", entry.start_head);
AaruConsole.DebugWriteLine(MODULE_NAME, "entry.start_sector {0}", startSector);
AaruConsole.DebugWriteLine(MODULE_NAME, "entry.end_cylinder {0}", endCylinder);
AaruConsole.DebugWriteLine(MODULE_NAME, "entry.end_head {0}", entry.end_head);
AaruConsole.DebugWriteLine(MODULE_NAME, "entry.end_sector {0}", endSector);
2022-03-06 13:29:38 +00:00
AaruConsole.DebugWriteLine(MODULE_NAME, "entry.minix = {0}", minix);
2022-03-06 13:29:38 +00:00
AaruConsole.DebugWriteLine(MODULE_NAME, "lba_start {0}", lbaStart);
AaruConsole.DebugWriteLine(MODULE_NAME, "lba_sectors {0}", lbaSectors);
2022-03-06 13:29:38 +00:00
if(valid && minix) // Let's mix the fun
{
2022-03-06 13:29:38 +00:00
if(GetMinix(imagePlugin, lbaStart, divider, sectorOffset, sectorSize, out List<Partition> mnxParts))
partitions.AddRange(mnxParts);
else
minix = false;
}
* 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
2022-03-06 13:29:38 +00:00
if(valid && !minix)
{
var part = new Partition();
2020-02-29 18:03:35 +00:00
if((lbaStart > 0 || imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc) &&
2022-03-06 13:29:38 +00:00
lbaSectors > 0)
* 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
{
2022-03-06 13:29:38 +00:00
part.Start = lbaStart + sectorOffset;
part.Length = lbaSectors;
part.Offset = part.Start * sectorSize;
part.Size = part.Length * sectorSize;
* 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
}
2022-03-06 13:29:38 +00:00
else
valid = false;
2022-03-06 13:29:38 +00:00
if(valid)
{
part.Type = $"0x{entry.type:X2}";
part.Name = DecodeMbrType(entry.type);
part.Sequence = counter;
part.Description = entry.status == 0x80 ? Localization.Partition_is_bootable : "";
2022-03-06 13:29:38 +00:00
part.Scheme = Name;
2022-03-06 13:29:38 +00:00
counter++;
2022-03-06 13:29:38 +00:00
partitions.Add(part);
* 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
}
2022-03-06 13:29:38 +00:00
}
2016-04-19 02:11:47 +01:00
AaruConsole.DebugWriteLine(MODULE_NAME, "entry.extended = {0}", extended);
2017-07-25 02:47:42 +01:00
2024-05-01 04:05:22 +01:00
if(!extended) continue;
2020-02-29 18:03:35 +00:00
var processingExtended = true;
2022-03-06 13:29:38 +00:00
ulong chainStart = lbaStart;
2016-04-19 02:11:47 +01:00
2022-03-06 13:29:38 +00:00
while(processingExtended)
{
errno = imagePlugin.ReadSector(lbaStart, out sector);
2016-04-19 02:11:47 +01:00
2024-05-01 04:05:22 +01:00
if(errno != ErrorNumber.NoError) break;
2016-04-19 02:11:47 +01:00
2022-03-06 13:29:38 +00:00
ExtendedBootRecord ebr = Marshal.ByteArrayToStructureLittleEndian<ExtendedBootRecord>(sector);
2016-04-19 02:11:47 +01:00
AaruConsole.DebugWriteLine(MODULE_NAME, "ebr.magic == MBR_Magic = {0}", ebr.magic == MBR_MAGIC);
2024-05-01 04:05:22 +01:00
if(ebr.magic != MBR_MAGIC) break;
2022-03-06 13:29:38 +00:00
ulong nextStart = 0;
2022-03-06 13:29:38 +00:00
foreach(PartitionEntry ebrEntry in ebr.entries)
* 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
{
var extValid = true;
2022-03-06 13:29:38 +00:00
startSector = (byte)(ebrEntry.start_sector & 0x3F);
startCylinder = (ushort)((ebrEntry.start_sector & 0xC0) << 2 | ebrEntry.start_cylinder);
2022-03-06 13:29:38 +00:00
endSector = (byte)(ebrEntry.end_sector & 0x3F);
endCylinder = (ushort)((ebrEntry.end_sector & 0xC0) << 2 | ebrEntry.end_cylinder);
2022-03-06 13:29:38 +00:00
ulong extStart = ebrEntry.lba_start;
ulong extSectors = ebrEntry.lba_sectors;
var extMinix = false;
2022-03-06 13:29:38 +00:00
AaruConsole.DebugWriteLine(MODULE_NAME, "ebr_entry.status {0}", ebrEntry.status);
AaruConsole.DebugWriteLine(MODULE_NAME, "ebr_entry.type {0}", ebrEntry.type);
AaruConsole.DebugWriteLine(MODULE_NAME, "ebr_entry.lba_start {0}", ebrEntry.lba_start);
AaruConsole.DebugWriteLine(MODULE_NAME, "ebr_entry.lba_sectors {0}", ebrEntry.lba_sectors);
AaruConsole.DebugWriteLine(MODULE_NAME, "ebr_entry.start_cylinder {0}", startCylinder);
AaruConsole.DebugWriteLine(MODULE_NAME, "ebr_entry.start_head {0}", ebrEntry.start_head);
AaruConsole.DebugWriteLine(MODULE_NAME, "ebr_entry.start_sector {0}", startSector);
AaruConsole.DebugWriteLine(MODULE_NAME, "ebr_entry.end_cylinder {0}", endCylinder);
AaruConsole.DebugWriteLine(MODULE_NAME, "ebr_entry.end_head {0}", ebrEntry.end_head);
AaruConsole.DebugWriteLine(MODULE_NAME, "ebr_entry.end_sector {0}", endSector);
2022-03-06 13:29:38 +00:00
// Let's start the fun...
2022-03-16 11:47:00 +00:00
extValid &= ebrEntry.status is 0x00 or 0x80;
2022-03-06 13:29:38 +00:00
extValid &= ebrEntry.type != 0x00;
extValid &= ebrEntry.lba_start != 0 ||
ebrEntry.lba_sectors != 0 ||
ebrEntry.start_cylinder != 0 ||
ebrEntry.start_head != 0 ||
ebrEntry.start_sector != 0 ||
ebrEntry.end_cylinder != 0 ||
ebrEntry.end_head != 0 ||
ebrEntry.end_sector != 0;
2022-03-06 13:29:38 +00:00
if(ebrEntry is { lba_start: 0, lba_sectors: 0 } && extValid)
2022-03-06 13:29:38 +00:00
{
2024-05-01 04:05:22 +01:00
extStart = CHS.ToLBA(startCylinder,
ebrEntry.start_head,
startSector,
imagePlugin.Info.Heads,
2022-03-07 07:36:44 +00:00
imagePlugin.Info.SectorsPerTrack);
2024-05-01 04:05:22 +01:00
extSectors = CHS.ToLBA(endCylinder,
ebrEntry.end_head,
ebrEntry.end_sector,
imagePlugin.Info.Heads,
imagePlugin.Info.SectorsPerTrack) -
extStart;
2022-03-06 13:29:38 +00:00
}
2022-03-16 11:47:00 +00:00
extMinix |= ebrEntry.type is 0x81 or 0x80;
2022-03-06 13:29:38 +00:00
// For optical media
extStart /= divider;
extSectors /= divider;
AaruConsole.DebugWriteLine(MODULE_NAME, "ext_start {0}", extStart);
AaruConsole.DebugWriteLine(MODULE_NAME, "ext_sectors {0}", extSectors);
2022-03-06 13:29:38 +00:00
2022-03-16 11:47:00 +00:00
if(ebrEntry.type is 0x05 or 0x0F or 0x15 or 0x1F or 0x85 or 0x91 or 0x9B or 0xC5 or 0xCF or 0xD5)
2022-03-06 13:29:38 +00:00
{
extValid = false;
nextStart = chainStart + extStart;
}
* 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
2022-03-06 13:29:38 +00:00
extStart += lbaStart;
extValid &= extStart <= imagePlugin.Info.Sectors;
2022-03-06 13:29:38 +00:00
// Some buggy implementations do some rounding errors getting a few sectors beyond device size
if(extStart + extSectors > imagePlugin.Info.Sectors)
extSectors = imagePlugin.Info.Sectors - extStart;
2022-03-06 13:29:38 +00:00
if(extValid && extMinix) // Let's mix the fun
{
2024-05-01 04:05:22 +01:00
if(GetMinix(imagePlugin,
lbaStart,
divider,
sectorOffset,
sectorSize,
2022-03-06 13:29:38 +00:00
out List<Partition> mnxParts))
partitions.AddRange(mnxParts);
2020-02-29 18:03:35 +00:00
else
2022-03-06 13:29:38 +00:00
extMinix = false;
}
2024-05-01 04:05:22 +01:00
if(!extValid || extMinix) continue;
2022-03-06 13:29:38 +00:00
var part = new Partition();
if(extStart > 0 && extSectors > 0)
2022-03-06 13:29:38 +00:00
{
part.Start = extStart + sectorOffset;
part.Length = extSectors;
part.Offset = part.Start * sectorSize;
part.Size = part.Length * sectorSize;
* 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
}
2022-03-06 13:29:38 +00:00
else
extValid = false;
2024-05-01 04:05:22 +01:00
if(!extValid) continue;
2022-03-06 13:29:38 +00:00
part.Type = $"0x{ebrEntry.type:X2}";
part.Name = DecodeMbrType(ebrEntry.type);
part.Sequence = counter;
part.Description = ebrEntry.status == 0x80 ? Localization.Partition_is_bootable : "";
2022-03-06 13:29:38 +00:00
part.Scheme = Name;
counter++;
partitions.Add(part);
* 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
}
2016-04-19 02:11:47 +01:00
AaruConsole.DebugWriteLine(MODULE_NAME, "next_start {0}", nextStart);
2022-03-06 13:29:38 +00:00
processingExtended &= nextStart != 0;
processingExtended &= nextStart <= imagePlugin.Info.Sectors;
lbaStart = nextStart;
}
* 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
}
2022-03-06 13:29:38 +00:00
// An empty MBR may exist, NeXT creates one and then hardcodes its disklabel
return partitions.Count != 0;
}
2017-07-25 02:47:42 +01:00
#endregion
2022-03-06 13:29:38 +00:00
static bool GetMinix(IMediaImage imagePlugin, ulong start, ulong divider, ulong sectorOffset, uint sectorSize,
out List<Partition> partitions)
{
2024-05-01 04:39:38 +01:00
partitions = [];
2022-03-06 13:29:38 +00:00
ErrorNumber errno = imagePlugin.ReadSector(start, out byte[] sector);
2017-07-25 02:47:42 +01:00
2024-05-01 04:05:22 +01:00
if(errno != ErrorNumber.NoError) return false;
2017-07-25 02:47:42 +01:00
2022-03-06 13:29:38 +00:00
ExtendedBootRecord mnx = Marshal.ByteArrayToStructureLittleEndian<ExtendedBootRecord>(sector);
2017-07-25 02:47:42 +01:00
AaruConsole.DebugWriteLine(MODULE_NAME, "mnx.magic == MBR_Magic = {0}", mnx.magic == MBR_MAGIC);
2017-07-25 02:47:42 +01:00
2024-05-01 04:05:22 +01:00
if(mnx.magic != MBR_MAGIC) return false;
2017-07-25 02:47:42 +01:00
var anyMnx = false;
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
foreach(PartitionEntry mnxEntry in mnx.entries)
{
var mnxValid = true;
var startSector = (byte)(mnxEntry.start_sector & 0x3F);
var startCylinder = (ushort)((mnxEntry.start_sector & 0xC0) << 2 | mnxEntry.start_cylinder);
var endSector = (byte)(mnxEntry.end_sector & 0x3F);
var endCylinder = (ushort)((mnxEntry.end_sector & 0xC0) << 2 | mnxEntry.end_cylinder);
ulong mnxStart = mnxEntry.lba_start;
ulong mnxSectors = mnxEntry.lba_sectors;
AaruConsole.DebugWriteLine(MODULE_NAME, "mnx_entry.status {0}", mnxEntry.status);
AaruConsole.DebugWriteLine(MODULE_NAME, "mnx_entry.type {0}", mnxEntry.type);
AaruConsole.DebugWriteLine(MODULE_NAME, "mnx_entry.lba_start {0}", mnxEntry.lba_start);
AaruConsole.DebugWriteLine(MODULE_NAME, "mnx_entry.lba_sectors {0}", mnxEntry.lba_sectors);
AaruConsole.DebugWriteLine(MODULE_NAME, "mnx_entry.start_cylinder {0}", startCylinder);
AaruConsole.DebugWriteLine(MODULE_NAME, "mnx_entry.start_head {0}", mnxEntry.start_head);
AaruConsole.DebugWriteLine(MODULE_NAME, "mnx_entry.start_sector {0}", startSector);
AaruConsole.DebugWriteLine(MODULE_NAME, "mnx_entry.end_cylinder {0}", endCylinder);
AaruConsole.DebugWriteLine(MODULE_NAME, "mnx_entry.end_head {0}", mnxEntry.end_head);
AaruConsole.DebugWriteLine(MODULE_NAME, "mnx_entry.end_sector {0}", endSector);
2022-03-06 13:29:38 +00:00
2022-03-16 11:47:00 +00:00
mnxValid &= mnxEntry.status is 0x00 or 0x80;
mnxValid &= mnxEntry.type is 0x81 or 0x80;
2022-03-06 13:29:38 +00:00
mnxValid &= mnxEntry.lba_start != 0 ||
mnxEntry.lba_sectors != 0 ||
mnxEntry.start_cylinder != 0 ||
mnxEntry.start_head != 0 ||
mnxEntry.start_sector != 0 ||
mnxEntry.end_cylinder != 0 ||
mnxEntry.end_head != 0 ||
mnxEntry.end_sector != 0;
2022-03-06 13:29:38 +00:00
if(mnxEntry is { lba_start: 0, lba_sectors: 0 } && mnxValid)
2022-03-06 13:29:38 +00:00
{
2024-05-01 04:05:22 +01:00
mnxStart = CHS.ToLBA(startCylinder,
mnxEntry.start_head,
startSector,
imagePlugin.Info.Heads,
2022-03-06 13:29:38 +00:00
imagePlugin.Info.SectorsPerTrack);
2017-07-25 02:47:42 +01:00
2024-05-01 04:05:22 +01:00
mnxSectors = CHS.ToLBA(endCylinder,
mnxEntry.end_head,
mnxEntry.end_sector,
imagePlugin.Info.Heads,
imagePlugin.Info.SectorsPerTrack) -
mnxStart;
2022-03-06 13:29:38 +00:00
}
2022-03-06 13:29:38 +00:00
// For optical media
mnxStart /= divider;
mnxSectors /= divider;
2017-07-25 02:47:42 +01:00
AaruConsole.DebugWriteLine(MODULE_NAME, "mnx_start {0}", mnxStart);
AaruConsole.DebugWriteLine(MODULE_NAME, "mnx_sectors {0}", mnxSectors);
2020-02-29 18:03:35 +00:00
2024-05-01 04:05:22 +01:00
if(!mnxValid) continue;
2022-03-06 13:29:38 +00:00
var part = new Partition();
2017-07-25 02:47:42 +01:00
if(mnxStart > 0 && mnxSectors > 0)
2022-03-06 13:29:38 +00:00
{
part.Start = mnxStart + sectorOffset;
part.Length = mnxSectors;
part.Offset = part.Start * sectorSize;
part.Size = part.Length * sectorSize;
}
else
mnxValid = false;
2017-07-25 02:47:42 +01:00
2024-05-01 04:05:22 +01:00
if(!mnxValid) continue;
2022-03-06 13:29:38 +00:00
anyMnx = true;
part.Type = "MINIX";
part.Name = Localization.MINIX;
part.Description = mnxEntry.status == 0x80 ? Localization.Partition_is_bootable : "";
2022-03-06 13:29:38 +00:00
part.Scheme = "MINIX";
2017-07-25 02:47:42 +01:00
2022-03-06 13:29:38 +00:00
partitions.Add(part);
2017-07-25 02:47:42 +01:00
}
2022-03-06 13:29:38 +00:00
return anyMnx;
}
static string DecodeMbrType(byte type) => _mbrTypes[type];
#region Nested type: DiskManagerMasterBootRecord
2022-03-06 13:29:38 +00:00
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct DiskManagerMasterBootRecord
2022-03-06 13:29:38 +00:00
{
/// <summary>Boot code</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 252)]
2022-03-06 13:29:38 +00:00
public readonly byte[] boot_code;
/// <summary>
/// <see cref="MBR.DM_MAGIC" />
/// </summary>
public readonly ushort dm_magic;
2022-03-06 13:29:38 +00:00
/// <summary>Partitions</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
2022-03-06 13:29:38 +00:00
public readonly PartitionEntry[] entries;
/// <summary>
/// <see cref="MBR.MBR_MAGIC" />
/// </summary>
public readonly ushort magic;
}
#endregion
#region Nested type: ExtendedBootRecord
2022-03-06 13:29:38 +00:00
// TODO: IBM Boot Manager
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct ExtendedBootRecord
{
/// <summary>Boot code, almost always unused</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 446)]
public readonly byte[] boot_code;
/// <summary>Partitions or pointers</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public readonly PartitionEntry[] entries;
/// <summary>
/// <see cref="MBR.MBR_MAGIC" />
/// </summary>
public readonly ushort magic;
}
#endregion
#region Nested type: MasterBootRecord
2022-03-06 13:29:38 +00:00
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct MasterBootRecord
2022-03-06 13:29:38 +00:00
{
/// <summary>Boot code</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 446)]
2022-03-06 13:29:38 +00:00
public readonly byte[] boot_code;
/// <summary>Partitions</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public readonly PartitionEntry[] entries;
/// <summary>
/// <see cref="MBR.MBR_MAGIC" />
/// </summary>
public readonly ushort magic;
}
#endregion
#region Nested type: ModernMasterBootRecord
2022-03-06 13:29:38 +00:00
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct ModernMasterBootRecord
{
/// <summary>Boot code</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 218)]
public readonly byte[] boot_code;
/// <summary>Set to 0</summary>
public readonly ushort zero;
/// <summary>Original physical drive</summary>
public readonly byte drive;
/// <summary>Disk timestamp, seconds</summary>
public readonly byte seconds;
/// <summary>Disk timestamp, minutes</summary>
public readonly byte minutes;
/// <summary>Disk timestamp, hours</summary>
public readonly byte hours;
/// <summary>Boot code, continuation</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 216)]
public readonly byte[] boot_code2;
/// <summary>Disk serial number</summary>
public readonly uint serial;
/// <summary>Set to 0</summary>
public readonly ushort zero2;
/// <summary>Partitions</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public readonly PartitionEntry[] entries;
/// <summary>
/// <see cref="MBR.MBR_MAGIC" />
/// </summary>
public readonly ushort magic;
}
#endregion
#region Nested type: NecMasterBootRecord
2022-03-06 13:29:38 +00:00
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct NecMasterBootRecord
{
/// <summary>Boot code</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 380)]
public readonly byte[] boot_code;
/// <summary>
/// <see cref="MBR.NEC_MAGIC" />
/// </summary>
public readonly ushort nec_magic;
/// <summary>Partitions</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly PartitionEntry[] entries;
/// <summary>
/// <see cref="MBR.MBR_MAGIC" />
/// </summary>
public readonly ushort magic;
}
#endregion
#region Nested type: PartitionEntry
2022-03-06 13:29:38 +00:00
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct PartitionEntry
{
/// <summary>Partition status, 0x80 or 0x00, else invalid</summary>
public readonly byte status;
/// <summary>Starting head [0,254]</summary>
public readonly byte start_head;
/// <summary>Starting sector [1,63]</summary>
public readonly byte start_sector;
/// <summary>Starting cylinder [0,1023]</summary>
public readonly byte start_cylinder;
/// <summary>Partition type</summary>
public readonly byte type;
/// <summary>Ending head [0,254]</summary>
public readonly byte end_head;
/// <summary>Ending sector [1,63]</summary>
public readonly byte end_sector;
/// <summary>Ending cylinder [0,1023]</summary>
public readonly byte end_cylinder;
/// <summary>Starting absolute sector</summary>
public readonly uint lba_start;
/// <summary>Total sectors</summary>
public readonly uint lba_sectors;
* 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
}
#endregion
#region Nested type: SerializedMasterBootRecord
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct SerializedMasterBootRecord
{
/// <summary>Boot code</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 440)]
public readonly byte[] boot_code;
/// <summary>Disk serial number</summary>
public readonly uint serial;
/// <summary>Set to 0</summary>
public readonly ushort zero;
/// <summary>Partitions</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public readonly PartitionEntry[] entries;
/// <summary>
/// <see cref="MBR.MBR_MAGIC" />
/// </summary>
public readonly ushort magic;
}
#endregion
#region Nested type: TimedMasterBootRecord
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct TimedMasterBootRecord
{
/// <summary>Boot code</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 218)]
public readonly byte[] boot_code;
/// <summary>Set to 0</summary>
public readonly ushort zero;
/// <summary>Original physical drive</summary>
public readonly byte drive;
/// <summary>Disk timestamp, seconds</summary>
public readonly byte seconds;
/// <summary>Disk timestamp, minutes</summary>
public readonly byte minutes;
/// <summary>Disk timestamp, hours</summary>
public readonly byte hours;
/// <summary>Boot code, continuation</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 222)]
public readonly byte[] boot_code2;
/// <summary>Partitions</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public readonly PartitionEntry[] entries;
/// <summary>
/// <see cref="MBR.MBR_MAGIC" />
/// </summary>
public readonly ushort magic;
}
#endregion
}