Make FAT filesystem plugin implement IReadOnlyFilesystem.

This commit is contained in:
2019-04-25 01:25:13 +01:00
parent f79b809322
commit b7cf7148a5
13 changed files with 1340 additions and 962 deletions

View File

@@ -1246,7 +1246,16 @@
<e p="ECMA67.cs" t="Include" />
<e p="EFS.cs" t="Include" />
<e p="F2FS.cs" t="Include" />
<e p="FAT" t="Include">
<e p="Consts.cs" t="Include" />
<e p="Dir.cs" t="Include" />
<e p="FAT.cs" t="Include" />
<e p="File.cs" t="Include" />
<e p="Info.cs" t="Include" />
<e p="Structs.cs" t="Include" />
<e p="Super.cs" t="Include" />
<e p="Xattr.cs" t="Include" />
</e>
<e p="FATX" t="Include">
<e p="Consts.cs" t="Include" />
<e p="Dir.cs" t="Include" />

View File

@@ -60,6 +60,14 @@
<Compile Include="FATX\Info.cs" />
<Compile Include="FATX\Structs.cs" />
<Compile Include="FATX\Super.cs" />
<Compile Include="FAT\Consts.cs" />
<Compile Include="FAT\Dir.cs" />
<Compile Include="FAT\FAT.cs" />
<Compile Include="FAT\File.cs" />
<Compile Include="FAT\Info.cs" />
<Compile Include="FAT\Structs.cs" />
<Compile Include="FAT\Super.cs" />
<Compile Include="FAT\Xattr.cs" />
<Compile Include="HPOFS.cs" />
<Compile Include="PCFX.cs" />
<Compile Include="AmigaDOS.cs" />
@@ -68,7 +76,6 @@
<Compile Include="BFS.cs" />
<Compile Include="ext2FS.cs" />
<Compile Include="extFS.cs" />
<Compile Include="FAT.cs" />
<Compile Include="FFS.cs" />
<Compile Include="HPFS.cs" />
<Compile Include="MinixFS.cs" />

View File

@@ -0,0 +1,151 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Consts.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Microsoft FAT filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Microsoft FAT filesystem constants.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
namespace DiscImageChef.Filesystems.FAT
{
public partial class FAT
{
const uint FSINFO_SIGNATURE1 = 0x41615252;
const uint FSINFO_SIGNATURE2 = 0x61417272;
const uint FSINFO_SIGNATURE3 = 0xAA550000;
readonly (string hash, string name)[] knownBootHashes =
{
("b639b4d5b25f63560e3b34a3a0feb732aa65486f", "Amstrad MS-DOS 3.20 (8-sector floppy)"),
("9311151f13f7611b1431593da05ddd3153370574", "Amstrad MS-DOS 3.20 (Spanish)"),
("55eda6a9b955f5199020e6b56a6954fa6fcb7dc6", "AT&T MS-DOS 2.11"),
("d5e10822977efa96e4fbaec2b268ca008d74fe6f", "Atari TOS"),
("17f11a12b96899d2a4976d889cef160502167f2d", "BeOS"),
("d0e31673028fcfcea38dff71a7be13669aa20b8d", "Compaq MS-DOS 3.30"),
("3aa4ce2fa6f9a297b5b15aaef930401af369fcbc", "Compaq MS-DOS 3.30 (8-sector floppy)"),
("8f1d33520343f35034aa3ce47e4180b10e960b43", "Compaq MS-DOS 3.30 (8-sector floppy)"),
("2f4011ae0670ff3aff2bdd412a4651f255b600a9", "Compaq MS-DOS 3.31"),
("afc3fb751089a52c9f0bd37098d3137d32ab4982", "Concurrent DOS 6.0"),
("c25e2d93d3b8bf9870043bf9d12580ef07f5375e", "CrossDOS"),
("43fb2afa1ab3102b3f8d0fe901b652a5b0a973e1", "DR-DOS >=7.02"),
("92d83b7e9e3bd4b73c6b98f8c6434206eac7212f", "DR-DOS 3.40"),
("6a7aba05f91c5a7108edc5d5ccc9dac0ebf5dd28", "DR-DOS 3.40"),
("715e78bb1e38b56452dd1c15db8c096dc506eea3", "DR-DOS 3.41"),
("01e46cb2bc6d65ddd89ba28d254baf563d8fc609", "DR-DOS 5.00"),
("dd297f159eef8a61f5eec638ce7318a098fa26f4", "DR-DOS 5.00"),
("f590e53ae7f9caec5dba93241e557710be61b6fe", "DR-DOS 6.00"),
("630e4aaf230f15eb2d09985f294815b6bc50384c", "DR-DOS 6.00"),
("8851459816d714f53b9c469472e51460ebd44b98", "DR-DOS 7.03"),
("cf24388b61eb1b137f2bb8a4c319e7461d460b72", "DR-DOS 7.03"),
("26bf8efe8368e598397b1f79d635faccf5ca4f87", "DR-DOS 8.00"),
("36ddd6bf8686801f5a2a3cbd4656afa175cabdfc", "DR-DOS 8.00"),
("9ac09781e4090d9ba5e1a31816b4ebfa6b54f39e", "DR-DOS 8.00"),
("f5d68f26abec8392ac23716581c4ab1d6e8456a2", "eComStation"),
("e2a852db8c3eb3d86ca86a706186a9dd54cdc815", "Epson MS-DOS 3.10"),
("74675d158dd0f6b5983bd30dda7018a814bd34dd", "Epson MS-DOS 3.20"),
("683a04f34714555df5e862f709f9abc7de51488e", "Epson MS-DOS 5.00 (PC-98)"),
("1b062df94fc576af069e40603bf2558000a2ca10", "FreeBSD, NetBSD, Mac OS X"),
("33c8e306b3a51e09668fd60f099450019a1238ea", "FreeBSD, NetBSD, Mac OS X"),
("ca386b1cefaf964a49192c2cd08077aff09b82af", "FreeDOS"),
("26033e0db1ee4f439f07077b790e189d1b77688c", "HP MS-DOS 3.20"),
("66867cd665e0e87c32de0bcb721ecfe91a551bc5", "mkfs.vfat"),
("48d4811dbea5d724803017d6d45a49d604982b7b", "mkfs.vfat"),
("02d615c5fb68bc49766bf89777dd36accb1428b7", "MS-DOS >=4.01, PC-DOS >=5.00 (8-sector floppy)"),
("cffb1dc01bf9f533ba63d949c359c9ae97944c9b", "MS-DOS >=5.00"),
("bd099151f2f9f8b3815eef7d9fed90abead52d97", "MS-DOS 3.21"),
("f338eeff68f4e03ce489eb165e18fd94f8a0c63e", "MS-DOS 3.30A"),
("0eb0c789e141d59d91f075ef14d63fd4255aeac2", "MS-DOS 3.30A, 5.00, 6.xx (8-sector floppy)"),
("7aa06595490f92e542965b43805eaa0d6da9c86c", "MS-DOS 3.31"),
("00401ca66900d7defcbc3d794654d1ba2376e83d", "MS-DOS 3.31"),
("00e39a27d9b36e88f2b0caaa1959a8e17223bf31", "MS-DOS 3.31 (8-sector floppy)"),
("1e74fbad5948582247280b116e7175b5a16bcede", "MS-DOS 3.31 (8-sector floppy)"),
("1cfb2cc3a34c8164b8f5051c118643b23a60f4d0", "MS-DOS 4.01"),
("d370551c8aca9cfcd964e2a1235071329f93cc03", "Multiuser DOS 7.22r4"),
("7106ea11dd0b9a39649cbb4f6314a0fa1241da38", "NEC >=MS-DOS 5.00 (PC-98)"),
("30d4f5f54215af0fc69236594e52b94989b35c21", "NEC MS-DOS 3.30 (PC-98)"),
("eae42777f562eb81ed624f0c0479347ba11158c9", "Novell DOS 7.00"),
("c67a7d0bab94a960cca8720d476f5317c960b2fb", "Novell DOS 7.00"),
("0ed508c71bcf1418a1701b9267ddf166e7993b6b", "Olivetti MS-DOS 3.10"),
("3e1a3f22973d9f2d15f9a053204c2f7b72de00a9", "OS/2 1.00"),
("4acb13943f21a266f9eb110969980481783c41c4", "OS/2 1.10"),
("cc7b32236c76d34edefdac3ca6a7be8e26163cea", "OS/2 1.20, 1.30"),
("05c6706189fa0532ea83a7484b88d1dcba63e167", "OS/2 2.00"),
("eefb4383b3e2b05f7f7e0051d58f4617a4f39e42", "OS/2 2.1x, Warp 3"),
("b1d9666ae8781958242da27d319e73aa2dda6805", "OS/2 Warp 4"),
("661d92970ab0f81cec453dc7584e0debdd1b4928", "PC-DOS >=5.00"),
("78522b303fe5752f3cb37eabb6cb54e6cb0cd276", "PC-DOS 2.xx"),
("277edfefdc3f05a219f9378076227c4126b6c8ef", "PC-DOS 3.00"),
("f72ef6ff4c90a170bc8cdd1b01e8d98235c16a3b", "PC-DOS 3.10"),
("cb6b6c1bc024e025710288da652d0d93527a71db", "PC-DOS 3.30"),
("3b844e2a411182958c2d9e6ee17c6d4fff18bd73", "PC-DOS 4.00"),
("45e82fcff4c6f8a9c31418323bc063011f5730e5", "PCExchange 2.0"),
("707849fd75b6a52fd219c3cebe060ecb23c40fc7", "SCO OpenServer"),
("9f7f146b513b00ff9e8b5b927aee24025c3f3fb8", "Toshiba MS-DOS 3.30"),
("30eafc45a4606a7b840dcd5899dfb977a837c835", "Toshiba MS-DOS 4.01"),
("5695a9a69637bd4d4eaa531b976d6f3b71e8d4ad", "Toshiba MS-DOS 4.01"),
("036a59138d620c16e8d0dba45af4dec4ae1376f7", "Windows 10"),
("3dd2941b79f0f6644b3a973c7d81e64e434c0b70", "Windows 2000"),
("cd1e2fced2e49825df23c08a3d1e280c1cf468a7", "Windows 2000"),
("c20c6e706be97091768da8654fffc2f3c0431318", "Windows 95"),
("cf750cc0d2d52251a1a0fb9f2568fed3ff81717a", "Windows 95 >=OSR2"),
("48865a298d4bbe73f89c4de10153e16250c1a9ae", "Windows 95 >=OSR2"),
("1d2df8f3b1b336fc4aa1c6e49b21956194884b41", "Windows 98 (Spanish)"),
("6e6fb4a3ea034415d716b1f81217ffecf78813c3", "Windows 98 (Spanish)"),
("9b5e6be09200145a6ed7c22d14b1e6b4de2f362b", "Windows 98 (Spanish)"),
("3cea1921d29fcd3343d36c090cb3e3dba926781d", "Windows 98, Me"),
("037f9c8caed602d93c88f7e9d8f13a732b3ada76", "Windows NT"),
("a63806bfe11140c873082318dd4da834068be327", "Windows Vista"),
("8f024b3d501c39ee6e3f8ca28173ad6a780d3eb0", "Windows Vista, 8, 10"),
("d3e93f8b82ef250db216037d827a4896dc97d2be", "TracerST"), // OEM ID: "TracerST"
//("b741f85ef40288ccc8887de1f6e849009097e1c9", "Norton Utilities"), // OEM ID: "IBM PNCI", need to confirm
("c49b275537ac7237cac64d83f34d2024ae0ca96a",
"Windows NT (Spanish)"), // Need to check Windows >= 2000 (Spanish)
//("a48b0e4b696317eed829e960d1aa576562a4f185", "TracerST"), // Unknown OEM ID, apparently Tracer, unconfirmed
("fe477972602ba76658ff7143859045b3c4036ca5",
"iomega"), // OEM ID: "SHIPDISK", contains timedate on boot code may not be unique
("ef79a1f33e5237827eb812dda548f0e4e916d815", "GEOS"), // OEM ID: "GEOWORKS"
("8524587ee91494cc51cc2c9d07453e84be0cdc33", "Hero Soft v1.10"),
("681a0d9d662ba368e6acb0d0bf602e1f56411144", "Human68k 2.00")
};
[Flags]
enum FatAttributes : byte
{
ReadOnly = 0x01,
Hidden = 0x02,
System = 0x04,
VolumeLabel = 0x08,
Subdirectory = 0x10,
Archive = 0x20,
Device = 0x40,
Reserved = 0x80,
LFN = 0x0F
}
}
}

View File

@@ -0,0 +1,59 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Dir.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Microsoft FAT filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Methods to handle Microsoft FAT filesystem directories.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.Filesystems.FAT
{
public partial class FAT
{
/// <summary>
/// Solves a symbolic link.
/// </summary>
/// <param name="path">Link path.</param>
/// <param name="dest">Link destination.</param>
public Errno ReadLink(string path, out string dest)
{
dest = null;
return Errno.NotSupported;
}
/// <summary>
/// Lists contents from a directory.
/// </summary>
/// <param name="path">Directory path.</param>
/// <param name="contents">Directory contents.</param>
public Errno ReadDir(string path, out List<string> contents) => throw new NotImplementedException();
}
}

View File

@@ -0,0 +1,51 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : FAT.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Microsoft FAT filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the Microsoft FAT filesystem and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Text;
using DiscImageChef.CommonTypes.Interfaces;
using Schemas;
namespace DiscImageChef.Filesystems.FAT
{
// TODO: Differentiate between Atari and X68k FAT, as this one uses a standard BPB.
// X68K uses cdate/adate from direntry for extending filename
public partial class FAT : IFilesystem
{
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Microsoft File Allocation Table";
public Guid Id => new Guid("33513B2C-0D26-0D2D-32C3-79D8611158E0");
public string Author => "Natalia Portillo";
}
}

View File

@@ -0,0 +1,48 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : File.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Microsoft FAT filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Methods to handle files.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.Filesystems.FAT
{
public partial class FAT
{
public Errno MapBlock(string path, long fileBlock, out long deviceBlock) => throw new NotImplementedException();
public Errno GetAttributes(string path, out FileAttributes attributes) => throw new NotImplementedException();
public Errno Read(string path, long offset, long size, ref byte[] buf) => throw new NotImplementedException();
public Errno Stat(string path, out FileEntryInfo stat) => throw new NotImplementedException();
}
}

View File

@@ -2,7 +2,7 @@
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : FAT.cs
// Filename : Info.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Microsoft FAT filesystem plugin.
@@ -33,7 +33,6 @@
using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.Checksums;
using DiscImageChef.CommonTypes;
@@ -42,119 +41,11 @@ using DiscImageChef.CommonTypes.Interfaces;
using DiscImageChef.Console;
using DiscImageChef.Helpers;
using Schemas;
using Marshal = DiscImageChef.Helpers.Marshal;
namespace DiscImageChef.Filesystems
namespace DiscImageChef.Filesystems.FAT
{
// TODO: Differentiate between Atari and X68k FAT, as this one uses a standard BPB.
// X68K uses cdate/adate from direntry for extending filename
public class FAT : IFilesystem
public partial class FAT
{
const uint FSINFO_SIGNATURE1 = 0x41615252;
const uint FSINFO_SIGNATURE2 = 0x61417272;
const uint FSINFO_SIGNATURE3 = 0xAA550000;
readonly (string hash, string name)[] knownBootHashes =
{
("b639b4d5b25f63560e3b34a3a0feb732aa65486f", "Amstrad MS-DOS 3.20 (8-sector floppy)"),
("9311151f13f7611b1431593da05ddd3153370574", "Amstrad MS-DOS 3.20 (Spanish)"),
("55eda6a9b955f5199020e6b56a6954fa6fcb7dc6", "AT&T MS-DOS 2.11"),
("d5e10822977efa96e4fbaec2b268ca008d74fe6f", "Atari TOS"),
("17f11a12b96899d2a4976d889cef160502167f2d", "BeOS"),
("d0e31673028fcfcea38dff71a7be13669aa20b8d", "Compaq MS-DOS 3.30"),
("3aa4ce2fa6f9a297b5b15aaef930401af369fcbc", "Compaq MS-DOS 3.30 (8-sector floppy)"),
("8f1d33520343f35034aa3ce47e4180b10e960b43", "Compaq MS-DOS 3.30 (8-sector floppy)"),
("2f4011ae0670ff3aff2bdd412a4651f255b600a9", "Compaq MS-DOS 3.31"),
("afc3fb751089a52c9f0bd37098d3137d32ab4982", "Concurrent DOS 6.0"),
("c25e2d93d3b8bf9870043bf9d12580ef07f5375e", "CrossDOS"),
("43fb2afa1ab3102b3f8d0fe901b652a5b0a973e1", "DR-DOS >=7.02"),
("92d83b7e9e3bd4b73c6b98f8c6434206eac7212f", "DR-DOS 3.40"),
("6a7aba05f91c5a7108edc5d5ccc9dac0ebf5dd28", "DR-DOS 3.40"),
("715e78bb1e38b56452dd1c15db8c096dc506eea3", "DR-DOS 3.41"),
("01e46cb2bc6d65ddd89ba28d254baf563d8fc609", "DR-DOS 5.00"),
("dd297f159eef8a61f5eec638ce7318a098fa26f4", "DR-DOS 5.00"),
("f590e53ae7f9caec5dba93241e557710be61b6fe", "DR-DOS 6.00"),
("630e4aaf230f15eb2d09985f294815b6bc50384c", "DR-DOS 6.00"),
("8851459816d714f53b9c469472e51460ebd44b98", "DR-DOS 7.03"),
("cf24388b61eb1b137f2bb8a4c319e7461d460b72", "DR-DOS 7.03"),
("26bf8efe8368e598397b1f79d635faccf5ca4f87", "DR-DOS 8.00"),
("36ddd6bf8686801f5a2a3cbd4656afa175cabdfc", "DR-DOS 8.00"),
("9ac09781e4090d9ba5e1a31816b4ebfa6b54f39e", "DR-DOS 8.00"),
("f5d68f26abec8392ac23716581c4ab1d6e8456a2", "eComStation"),
("e2a852db8c3eb3d86ca86a706186a9dd54cdc815", "Epson MS-DOS 3.10"),
("74675d158dd0f6b5983bd30dda7018a814bd34dd", "Epson MS-DOS 3.20"),
("683a04f34714555df5e862f709f9abc7de51488e", "Epson MS-DOS 5.00 (PC-98)"),
("1b062df94fc576af069e40603bf2558000a2ca10", "FreeBSD, NetBSD, Mac OS X"),
("33c8e306b3a51e09668fd60f099450019a1238ea", "FreeBSD, NetBSD, Mac OS X"),
("ca386b1cefaf964a49192c2cd08077aff09b82af", "FreeDOS"),
("26033e0db1ee4f439f07077b790e189d1b77688c", "HP MS-DOS 3.20"),
("66867cd665e0e87c32de0bcb721ecfe91a551bc5", "mkfs.vfat"),
("48d4811dbea5d724803017d6d45a49d604982b7b", "mkfs.vfat"),
("02d615c5fb68bc49766bf89777dd36accb1428b7", "MS-DOS >=4.01, PC-DOS >=5.00 (8-sector floppy)"),
("cffb1dc01bf9f533ba63d949c359c9ae97944c9b", "MS-DOS >=5.00"),
("bd099151f2f9f8b3815eef7d9fed90abead52d97", "MS-DOS 3.21"),
("f338eeff68f4e03ce489eb165e18fd94f8a0c63e", "MS-DOS 3.30A"),
("0eb0c789e141d59d91f075ef14d63fd4255aeac2", "MS-DOS 3.30A, 5.00, 6.xx (8-sector floppy)"),
("7aa06595490f92e542965b43805eaa0d6da9c86c", "MS-DOS 3.31"),
("00401ca66900d7defcbc3d794654d1ba2376e83d", "MS-DOS 3.31"),
("00e39a27d9b36e88f2b0caaa1959a8e17223bf31", "MS-DOS 3.31 (8-sector floppy)"),
("1e74fbad5948582247280b116e7175b5a16bcede", "MS-DOS 3.31 (8-sector floppy)"),
("1cfb2cc3a34c8164b8f5051c118643b23a60f4d0", "MS-DOS 4.01"),
("d370551c8aca9cfcd964e2a1235071329f93cc03", "Multiuser DOS 7.22r4"),
("7106ea11dd0b9a39649cbb4f6314a0fa1241da38", "NEC >=MS-DOS 5.00 (PC-98)"),
("30d4f5f54215af0fc69236594e52b94989b35c21", "NEC MS-DOS 3.30 (PC-98)"),
("eae42777f562eb81ed624f0c0479347ba11158c9", "Novell DOS 7.00"),
("c67a7d0bab94a960cca8720d476f5317c960b2fb", "Novell DOS 7.00"),
("0ed508c71bcf1418a1701b9267ddf166e7993b6b", "Olivetti MS-DOS 3.10"),
("3e1a3f22973d9f2d15f9a053204c2f7b72de00a9", "OS/2 1.00"),
("4acb13943f21a266f9eb110969980481783c41c4", "OS/2 1.10"),
("cc7b32236c76d34edefdac3ca6a7be8e26163cea", "OS/2 1.20, 1.30"),
("05c6706189fa0532ea83a7484b88d1dcba63e167", "OS/2 2.00"),
("eefb4383b3e2b05f7f7e0051d58f4617a4f39e42", "OS/2 2.1x, Warp 3"),
("b1d9666ae8781958242da27d319e73aa2dda6805", "OS/2 Warp 4"),
("661d92970ab0f81cec453dc7584e0debdd1b4928", "PC-DOS >=5.00"),
("78522b303fe5752f3cb37eabb6cb54e6cb0cd276", "PC-DOS 2.xx"),
("277edfefdc3f05a219f9378076227c4126b6c8ef", "PC-DOS 3.00"),
("f72ef6ff4c90a170bc8cdd1b01e8d98235c16a3b", "PC-DOS 3.10"),
("cb6b6c1bc024e025710288da652d0d93527a71db", "PC-DOS 3.30"),
("3b844e2a411182958c2d9e6ee17c6d4fff18bd73", "PC-DOS 4.00"),
("45e82fcff4c6f8a9c31418323bc063011f5730e5", "PCExchange 2.0"),
("707849fd75b6a52fd219c3cebe060ecb23c40fc7", "SCO OpenServer"),
("9f7f146b513b00ff9e8b5b927aee24025c3f3fb8", "Toshiba MS-DOS 3.30"),
("30eafc45a4606a7b840dcd5899dfb977a837c835", "Toshiba MS-DOS 4.01"),
("5695a9a69637bd4d4eaa531b976d6f3b71e8d4ad", "Toshiba MS-DOS 4.01"),
("036a59138d620c16e8d0dba45af4dec4ae1376f7", "Windows 10"),
("3dd2941b79f0f6644b3a973c7d81e64e434c0b70", "Windows 2000"),
("cd1e2fced2e49825df23c08a3d1e280c1cf468a7", "Windows 2000"),
("c20c6e706be97091768da8654fffc2f3c0431318", "Windows 95"),
("cf750cc0d2d52251a1a0fb9f2568fed3ff81717a", "Windows 95 >=OSR2"),
("48865a298d4bbe73f89c4de10153e16250c1a9ae", "Windows 95 >=OSR2"),
("1d2df8f3b1b336fc4aa1c6e49b21956194884b41", "Windows 98 (Spanish)"),
("6e6fb4a3ea034415d716b1f81217ffecf78813c3", "Windows 98 (Spanish)"),
("9b5e6be09200145a6ed7c22d14b1e6b4de2f362b", "Windows 98 (Spanish)"),
("3cea1921d29fcd3343d36c090cb3e3dba926781d", "Windows 98, Me"),
("037f9c8caed602d93c88f7e9d8f13a732b3ada76", "Windows NT"),
("a63806bfe11140c873082318dd4da834068be327", "Windows Vista"),
("8f024b3d501c39ee6e3f8ca28173ad6a780d3eb0", "Windows Vista, 8, 10"),
("d3e93f8b82ef250db216037d827a4896dc97d2be", "TracerST"), // OEM ID: "TracerST"
//("b741f85ef40288ccc8887de1f6e849009097e1c9", "Norton Utilities"), // OEM ID: "IBM PNCI", need to confirm
("c49b275537ac7237cac64d83f34d2024ae0ca96a",
"Windows NT (Spanish)"), // Need to check Windows >= 2000 (Spanish)
//("a48b0e4b696317eed829e960d1aa576562a4f185", "TracerST"), // Unknown OEM ID, apparently Tracer, unconfirmed
("fe477972602ba76658ff7143859045b3c4036ca5",
"iomega"), // OEM ID: "SHIPDISK", contains timedate on boot code may not be unique
("ef79a1f33e5237827eb812dda548f0e4e916d815", "GEOS"), // OEM ID: "GEOWORKS"
("8524587ee91494cc51cc2c9d07453e84be0cdc33", "Hero Soft v1.10"),
("681a0d9d662ba368e6acb0d0bf602e1f56411144", "Human68k 2.00")
};
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Microsoft File Allocation Table";
public Guid Id => new Guid("33513B2C-0D26-0D2D-32C3-79D8611158E0");
public string Author => "Natalia Portillo";
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
if(2 + partition.Start >= partition.End) return false;
@@ -1593,850 +1484,5 @@ namespace DiscImageChef.Filesystems
information = sb.ToString();
}
/// <summary>
/// BIOS Parameter Block as used by Atari ST GEMDOS on FAT12 volumes.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct AtariParameterBlock
{
/// <summary>68000 BRA.S jump or x86 loop</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public readonly byte[] jump;
/// <summary>OEM Name, 6 bytes, space-padded, "Loader" for Atari ST boot loader</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public readonly byte[] oem_name;
/// <summary>Volume serial number</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] serial_no;
/// <summary>Bytes per sector</summary>
public readonly ushort bps;
/// <summary>Sectors per cluster</summary>
public readonly byte spc;
/// <summary>Reserved sectors between BPB and FAT (inclusive)</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume</summary>
public ushort sectors;
/// <summary>Media descriptor, unused by GEMDOS</summary>
public readonly byte media;
/// <summary>Sectors per FAT</summary>
public readonly ushort spfat;
/// <summary>Sectors per track</summary>
public readonly ushort sptrk;
/// <summary>Heads</summary>
public readonly ushort heads;
/// <summary>Hidden sectors before BPB, unused by GEMDOS</summary>
public readonly ushort hsectors;
/// <summary>Word to be loaded in the cmdload system variable. Big-endian.</summary>
public readonly ushort execflag;
/// <summary>
/// Word indicating load mode. If zero, file named <see cref="fname" /> is located and loaded. It not, sectors
/// specified in <see cref="ssect" /> and <see cref="sectcnt" /> are loaded. Big endian.
/// </summary>
public readonly ushort ldmode;
/// <summary>Starting sector of boot code.</summary>
public readonly ushort ssect;
/// <summary>Count of sectors of boot code.</summary>
public readonly ushort sectcnt;
/// <summary>Address where boot code should be loaded.</summary>
public readonly ushort ldaaddr;
/// <summary>Padding.</summary>
public readonly ushort padding;
/// <summary>Address where FAT and root directory sectors must be loaded.</summary>
public readonly ushort fatbuf;
/// <summary>Unknown.</summary>
public readonly ushort unknown;
/// <summary>Filename to be loaded for booting.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
public readonly byte[] fname;
/// <summary>Reserved</summary>
public readonly ushort reserved;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 455)]
public readonly byte[] boot_code;
/// <summary>Big endian word to make big endian sum of all sector words be equal to 0x1234 if disk is bootable.</summary>
public readonly ushort checksum;
}
/// <summary>
/// BIOS Parameter Block as used by MSX-DOS 2.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct MsxParameterBlock
{
/// <summary>x86 loop</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] jump;
/// <summary>OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] oem_name;
/// <summary>Bytes per sector</summary>
public readonly ushort bps;
/// <summary>Sectors per cluster</summary>
public readonly byte spc;
/// <summary>Reserved sectors between BPB and FAT (inclusive)</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Sectors per FAT</summary>
public readonly ushort spfat;
/// <summary>Sectors per track</summary>
public readonly ushort sptrk;
/// <summary>Heads</summary>
public readonly ushort heads;
/// <summary>Hidden sectors before BPB</summary>
public readonly ushort hsectors;
/// <summary>Jump for MSX-DOS 1 boot code</summary>
public readonly ushort msxdos_jmp;
/// <summary>Set to "VOL_ID" by MSX-DOS 2</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
public readonly byte[] vol_id;
/// <summary>Bigger than 0 if there are deleted files (MSX-DOS 2)</summary>
public readonly byte undelete_flag;
/// <summary>Volume serial number (MSX-DOS 2)</summary>
public readonly uint serial_no;
/// <summary>Reserved (MSX-DOS 2)</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public readonly byte[] reserved;
/// <summary>Jump for MSX-DOS 2 boot code (MSX-DOS 2)</summary>
public readonly ushort msxdos2_jmp;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 460)]
public readonly byte[] boot_code;
/// <summary>Always 0x55 0xAA.</summary>
public readonly ushort boot_signature;
}
/// <summary>DOS 2.0 BIOS Parameter Block.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BiosParameterBlock2
{
/// <summary>x86 jump</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] jump;
/// <summary>OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] oem_name;
/// <summary>Bytes per sector</summary>
public readonly ushort bps;
/// <summary>Sectors per cluster</summary>
public readonly byte spc;
/// <summary>Reserved sectors between BPB and FAT</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Sectors per FAT</summary>
public readonly ushort spfat;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 486)]
public readonly byte[] boot_code;
/// <summary>0x55 0xAA if bootable.</summary>
public readonly ushort boot_signature;
}
/// <summary>DOS 3.0 BIOS Parameter Block.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BiosParameterBlock30
{
/// <summary>x86 jump</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] jump;
/// <summary>OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] oem_name;
/// <summary>Bytes per sector</summary>
public readonly ushort bps;
/// <summary>Sectors per cluster</summary>
public readonly byte spc;
/// <summary>Reserved sectors between BPB and FAT</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Sectors per FAT</summary>
public readonly ushort spfat;
/// <summary>Sectors per track</summary>
public readonly ushort sptrk;
/// <summary>Heads</summary>
public readonly ushort heads;
/// <summary>Hidden sectors before BPB</summary>
public readonly ushort hsectors;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 480)]
public readonly byte[] boot_code;
/// <summary>Always 0x55 0xAA.</summary>
public readonly ushort boot_signature;
}
/// <summary>DOS 3.2 BIOS Parameter Block.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BiosParameterBlock32
{
/// <summary>x86 jump</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] jump;
/// <summary>OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] oem_name;
/// <summary>Bytes per sector</summary>
public readonly ushort bps;
/// <summary>Sectors per cluster</summary>
public readonly byte spc;
/// <summary>Reserved sectors between BPB and FAT</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Sectors per FAT</summary>
public readonly ushort spfat;
/// <summary>Sectors per track</summary>
public readonly ushort sptrk;
/// <summary>Heads</summary>
public readonly ushort heads;
/// <summary>Hidden sectors before BPB</summary>
public readonly ushort hsectors;
/// <summary>Total sectors including hidden ones</summary>
public readonly ushort total_sectors;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 478)]
public readonly byte[] boot_code;
/// <summary>Always 0x55 0xAA.</summary>
public readonly ushort boot_signature;
}
/// <summary>DOS 3.31 BIOS Parameter Block.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BiosParameterBlock33
{
/// <summary>x86 jump</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] jump;
/// <summary>OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] oem_name;
/// <summary>Bytes per sector</summary>
public readonly ushort bps;
/// <summary>Sectors per cluster</summary>
public readonly byte spc;
/// <summary>Reserved sectors between BPB and FAT</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Sectors per FAT</summary>
public readonly ushort spfat;
/// <summary>Sectors per track</summary>
public readonly ushort sptrk;
/// <summary>Heads</summary>
public readonly ushort heads;
/// <summary>Hidden sectors before BPB</summary>
public readonly uint hsectors;
/// <summary>Sectors in volume if > 65535</summary>
public uint big_sectors;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 474)]
public readonly byte[] boot_code;
/// <summary>Always 0x55 0xAA.</summary>
public readonly ushort boot_signature;
}
/// <summary>DOS 3.4 BIOS Parameter Block.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BiosParameterBlockShortEbpb
{
/// <summary>x86 jump</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] jump;
/// <summary>OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] oem_name;
/// <summary>Bytes per sector</summary>
public readonly ushort bps;
/// <summary>Sectors per cluster</summary>
public readonly byte spc;
/// <summary>Reserved sectors between BPB and FAT</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Sectors per FAT</summary>
public readonly ushort spfat;
/// <summary>Sectors per track</summary>
public readonly ushort sptrk;
/// <summary>Heads</summary>
public readonly ushort heads;
/// <summary>Hidden sectors before BPB</summary>
public readonly uint hsectors;
/// <summary>Sectors in volume if > 65535</summary>
public uint big_sectors;
/// <summary>Drive number</summary>
public readonly byte drive_no;
/// <summary>Volume flags</summary>
public readonly byte flags;
/// <summary>EPB signature, 0x28</summary>
public readonly byte signature;
/// <summary>Volume serial number</summary>
public readonly uint serial_no;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 467)]
public readonly byte[] boot_code;
/// <summary>Always 0x55 0xAA.</summary>
public readonly ushort boot_signature;
}
/// <summary>DOS 4.0 or higher BIOS Parameter Block.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BiosParameterBlockEbpb
{
/// <summary>x86 jump</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public byte[] jump;
/// <summary>OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public byte[] oem_name;
/// <summary>Bytes per sector</summary>
public ushort bps;
/// <summary>Sectors per cluster</summary>
public byte spc;
/// <summary>Reserved sectors between BPB and FAT</summary>
public ushort rsectors;
/// <summary>Number of FATs</summary>
public byte fats_no;
/// <summary>Number of entries on root directory</summary>
public ushort root_ent;
/// <summary>Sectors in volume</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public byte media;
/// <summary>Sectors per FAT</summary>
public ushort spfat;
/// <summary>Sectors per track</summary>
public ushort sptrk;
/// <summary>Heads</summary>
public ushort heads;
/// <summary>Hidden sectors before BPB</summary>
public uint hsectors;
/// <summary>Sectors in volume if > 65535</summary>
public uint big_sectors;
/// <summary>Drive number</summary>
public byte drive_no;
/// <summary>Volume flags</summary>
public byte flags;
/// <summary>EPB signature, 0x29</summary>
public byte signature;
/// <summary>Volume serial number</summary>
public uint serial_no;
/// <summary>Volume label, 11 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
public readonly byte[] volume_label;
/// <summary>Filesystem type, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] fs_type;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 448)]
public byte[] boot_code;
/// <summary>Always 0x55 0xAA.</summary>
public ushort boot_signature;
}
/// <summary>FAT32 Parameter Block</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct Fat32ParameterBlockShort
{
/// <summary>x86 jump</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] jump;
/// <summary>OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] oem_name;
/// <summary>Bytes per sector</summary>
public readonly ushort bps;
/// <summary>Sectors per cluster</summary>
public readonly byte spc;
/// <summary>Reserved sectors between BPB and FAT</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory, set to 0</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume, set to 0</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Sectors per FAT, set to 0</summary>
public readonly ushort spfat;
/// <summary>Sectors per track</summary>
public readonly ushort sptrk;
/// <summary>Heads</summary>
public readonly ushort heads;
/// <summary>Hidden sectors before BPB</summary>
public readonly uint hsectors;
/// <summary>Sectors in volume</summary>
public uint big_sectors;
/// <summary>Sectors per FAT</summary>
public readonly uint big_spfat;
/// <summary>FAT flags</summary>
public readonly ushort mirror_flags;
/// <summary>FAT32 version</summary>
public readonly ushort version;
/// <summary>Cluster of root directory</summary>
public readonly uint root_cluster;
/// <summary>Sector of FSINFO structure</summary>
public readonly ushort fsinfo_sector;
/// <summary>Sector of FAT32PB backup</summary>
public readonly ushort backup_sector;
/// <summary>Reserved</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
public readonly byte[] reserved;
/// <summary>Drive number</summary>
public readonly byte drive_no;
/// <summary>Volume flags</summary>
public readonly byte flags;
/// <summary>Signature, should be 0x28</summary>
public readonly byte signature;
/// <summary>Volume serial number</summary>
public readonly uint serial_no;
/// <summary>Volume label, 11 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
public readonly byte[] reserved2;
/// <summary>Sectors in volume if <see cref="big_sectors" /> equals 0</summary>
public ulong huge_sectors;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 420)]
public readonly byte[] boot_code;
/// <summary>Always 0x55 0xAA.</summary>
public readonly ushort boot_signature;
}
/// <summary>FAT32 Parameter Block</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct Fat32ParameterBlock
{
/// <summary>x86 jump</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] jump;
/// <summary>OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] oem_name;
/// <summary>Bytes per sector</summary>
public ushort bps;
/// <summary>Sectors per cluster</summary>
public byte spc;
/// <summary>Reserved sectors between BPB and FAT</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory, set to 0</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume, set to 0</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Sectors per FAT, set to 0</summary>
public readonly ushort spfat;
/// <summary>Sectors per track</summary>
public ushort sptrk;
/// <summary>Heads</summary>
public readonly ushort heads;
/// <summary>Hidden sectors before BPB</summary>
public uint hsectors;
/// <summary>Sectors in volume</summary>
public uint big_sectors;
/// <summary>Sectors per FAT</summary>
public uint big_spfat;
/// <summary>FAT flags</summary>
public readonly ushort mirror_flags;
/// <summary>FAT32 version</summary>
public readonly ushort version;
/// <summary>Cluster of root directory</summary>
public readonly uint root_cluster;
/// <summary>Sector of FSINFO structure</summary>
public readonly ushort fsinfo_sector;
/// <summary>Sector of FAT32PB backup</summary>
public readonly ushort backup_sector;
/// <summary>Reserved</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
public readonly byte[] reserved;
/// <summary>Drive number</summary>
public readonly byte drive_no;
/// <summary>Volume flags</summary>
public readonly byte flags;
/// <summary>Signature, should be 0x29</summary>
public readonly byte signature;
/// <summary>Volume serial number</summary>
public readonly uint serial_no;
/// <summary>Volume label, 11 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
public readonly byte[] volume_label;
/// <summary>Filesystem type, 8 bytes, space-padded, must be "FAT32 "</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] fs_type;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 419)]
public readonly byte[] boot_code;
/// <summary>Always 0x55 0xAA.</summary>
public readonly ushort boot_signature;
}
/// <summary>Apricot Label.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct ApricotLabel
{
/// <summary>Version of format which created disk</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] version;
/// <summary>Operating system.</summary>
public readonly byte operatingSystem;
/// <summary>Software write protection.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool writeProtected;
/// <summary>Copy protected.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool copyProtected;
/// <summary>Boot type.</summary>
public readonly byte bootType;
/// <summary>Partitions.</summary>
public readonly byte partitionCount;
/// <summary>Is hard disk?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool winchester;
/// <summary>Sector size.</summary>
public readonly ushort sectorSize;
/// <summary>Sectors per track.</summary>
public readonly ushort spt;
/// <summary>Tracks per side.</summary>
public readonly uint cylinders;
/// <summary>Sides.</summary>
public readonly byte heads;
/// <summary>Interleave factor.</summary>
public readonly byte interleave;
/// <summary>Skew factor.</summary>
public readonly ushort skew;
/// <summary>Sector where boot code starts.</summary>
public readonly uint bootLocation;
/// <summary>Size in sectors of boot code.</summary>
public readonly ushort bootSize;
/// <summary>Address at which to load boot code.</summary>
public readonly uint bootAddress;
/// <summary>Offset where to jump to boot.</summary>
public readonly ushort bootOffset;
/// <summary>Segment where to jump to boot.</summary>
public readonly ushort bootSegment;
/// <summary>First data sector.</summary>
public readonly uint firstDataBlock;
/// <summary>Generation.</summary>
public readonly ushort generation;
/// <summary>Copy count.</summary>
public readonly ushort copyCount;
/// <summary>Maximum number of copies.</summary>
public readonly ushort maxCopies;
/// <summary>Serial number.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] serialNumber;
/// <summary>Part number.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] partNumber;
/// <summary>Copyright.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)]
public readonly byte[] copyright;
/// <summary>BPB for whole disk.</summary>
public ApricotParameterBlock mainBPB;
/// <summary>Name of FONT file.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] fontName;
/// <summary>Name of KEYBOARD file.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] keyboardName;
/// <summary>Minor BIOS version.</summary>
public readonly byte biosMinorVersion;
/// <summary>Major BIOS version.</summary>
public readonly byte biosMajorVersion;
/// <summary>Diagnostics enabled?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool diagnosticsFlag;
/// <summary>Printer device.</summary>
public readonly byte prnDevice;
/// <summary>Bell volume.</summary>
public readonly byte bellVolume;
/// <summary>Cache enabled?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool enableCache;
/// <summary>Graphics enabled?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool enableGraphics;
/// <summary>Length in sectors of DOS.</summary>
public readonly byte dosLength;
/// <summary>Length in sectors of FONT file.</summary>
public readonly byte fontLength;
/// <summary>Length in sectors of KEYBOARD file.</summary>
public readonly byte keyboardLength;
/// <summary>Starting sector of DOS.</summary>
public readonly ushort dosStart;
/// <summary>Starting sector of FONT file.</summary>
public readonly ushort fontStart;
/// <summary>Starting sector of KEYBOARD file.</summary>
public readonly ushort keyboardStart;
/// <summary>Keyboard click volume.</summary>
public readonly byte keyboardVolume;
/// <summary>Auto-repeat enabled?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool autorepeat;
/// <summary>Auto-repeat lead-in.</summary>
public readonly byte autorepeatLeadIn;
/// <summary>Auto-repeat interval.</summary>
public readonly byte autorepeatInterval;
/// <summary>Microscreen mode.</summary>
public readonly byte microscreenMode;
/// <summary>Spare area for keyboard values expansion.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
public readonly byte[] spareKeyboard;
/// <summary>Screen line mode.</summary>
public readonly byte lineMode;
/// <summary>Screen line width.</summary>
public readonly byte lineWidth;
/// <summary>Screen disabled?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool imageOff;
/// <summary>Spare area for screen values expansion.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)]
public readonly byte[] spareScreen;
/// <summary>TX baud rate.</summary>
public readonly byte txBaudRate;
/// <summary>RX baud rate.</summary>
public readonly byte rxBaudRate;
/// <summary>TX bits.</summary>
public readonly byte txBits;
/// <summary>RX bits.</summary>
public readonly byte rxBits;
/// <summary>Stop bits.</summary>
public readonly byte stopBits;
/// <summary>Parity enabled?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool parityCheck;
/// <summary>Parity type.</summary>
public readonly byte parityType;
/// <summary>Xon/Xoff enabled on TX.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool txXonXoff;
/// <summary>Xon/Xoff enabled on RX.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool rxXonXoff;
/// <summary>Xon character.</summary>
public readonly byte xonCharacter;
/// <summary>Xoff character.</summary>
public readonly byte xoffCharacter;
/// <summary>Xon/Xoff buffer on RX.</summary>
public readonly ushort rxXonXoffBuffer;
/// <summary>DTR/DSR enabled?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool dtrDsr;
/// <summary>CTS/RTS enabled?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool ctsRts;
/// <summary>NULLs after CR.</summary>
public readonly byte nullsAfterCr;
/// <summary>NULLs after 0xFF.</summary>
public readonly byte nullsAfterFF;
/// <summary>Send LF after CR in serial port.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool lfAfterCRSerial;
/// <summary>BIOS error report in serial port.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool biosErrorReportSerial;
/// <summary>Spare area for serial port values expansion.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)]
public readonly byte[] spareSerial;
/// <summary>Send LF after CR in parallel port.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool lfAfterCrParallel;
/// <summary>Select line supported?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool selectLine;
/// <summary>Paper empty supported?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool paperEmpty;
/// <summary>Fault line supported?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool faultLine;
/// <summary>BIOS error report in parallel port.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool biosErrorReportParallel;
/// <summary>Spare area for parallel port values expansion.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
public readonly byte[] spareParallel;
/// <summary>Spare area for Winchester values expansion.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)]
public readonly byte[] spareWinchester;
/// <summary>Parking enabled?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool parkingEnabled;
/// <summary>Format protection?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool formatProtection;
/// <summary>Spare area for RAM disk values expansion.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] spareRamDisk;
/// <summary>List of bad blocks.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public readonly ushort[] badBlocks;
/// <summary>Array of partition BPBs.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly ApricotParameterBlock[] partitions;
/// <summary>Spare area.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 63)]
public readonly byte[] spare;
/// <summary>CP/M double side indicator?.</summary>
public readonly bool cpmDoubleSided;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct ApricotParameterBlock
{
/// <summary>Bytes per sector</summary>
public readonly ushort bps;
/// <summary>Sectors per cluster</summary>
public readonly byte spc;
/// <summary>Reserved sectors between BPB and FAT</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Sectors per FAT</summary>
public readonly ushort spfat;
/// <summary>Disk type</summary>
public readonly byte diskType;
/// <summary>Volume starting sector</summary>
public readonly ushort startSector;
}
/// <summary>FAT32 FS Information Sector</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct FsInfoSector
{
/// <summary>Signature must be <see cref="FAT.FSINFO_SIGNATURE1" /></summary>
public readonly uint signature1;
/// <summary>Reserved</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 480)]
public readonly byte[] reserved1;
/// <summary>Signature must be <see cref="FAT.FSINFO_SIGNATURE2" /></summary>
public readonly uint signature2;
/// <summary>Free clusters</summary>
public readonly uint free_clusters;
/// <summary> cated cluster</summary>
public readonly uint last_cluster;
/// <summary>Reserved</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
public readonly byte[] reserved2;
/// <summary>Signature must be <see cref="FAT.FSINFO_SIGNATURE3" /></summary>
public readonly uint signature3;
}
/// <summary>Human68k Parameter Block, big endian, 512 bytes even on 256 bytes/sector.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct HumanParameterBlock
{
/// <summary>68k bra.S</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public readonly byte[] jump;
/// <summary>OEM Name, 16 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] oem_name;
/// <summary>Bytes per cluster</summary>
public readonly ushort bpc;
/// <summary>Unknown, seen 1, 2 and 16</summary>
public readonly byte unknown1;
/// <summary>Unknown, always 512?</summary>
public readonly ushort unknown2;
/// <summary>Unknown, always 1?</summary>
public readonly byte unknown3;
/// <summary>Number of entries on root directory</summary>
public readonly ushort root_ent;
/// <summary>Clusters, set to 0 if more than 65536</summary>
public readonly ushort clusters;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Clusters per FAT, set to 0</summary>
public readonly byte cpfat;
/// <summary>Clustersin volume</summary>
public readonly uint big_clusters;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 478)]
public readonly byte[] boot_code;
}
[Flags]
enum FatAttributes : byte
{
ReadOnly = 0x01,
Hidden = 0x02,
System = 0x04,
VolumeLabel = 0x08,
Subdirectory = 0x10,
Archive = 0x20,
Device = 0x40,
Reserved = 0x80,
LFN = 0x0F
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct DirectoryEntry
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] filename;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] extension;
public readonly FatAttributes attributes;
public readonly byte caseinfo;
public readonly byte ctime_ms;
public readonly ushort ctime;
public readonly ushort cdate;
public readonly ushort adate;
public readonly ushort ea_handle;
public readonly ushort mtime;
public readonly ushort mdate;
public readonly ushort start_cluster;
public readonly uint size;
}
}
}

View File

@@ -0,0 +1,870 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Microsoft FAT filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Microsoft FAT filesystem structures.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Runtime.InteropServices;
namespace DiscImageChef.Filesystems.FAT
{
public partial class FAT
{
/// <summary>
/// BIOS Parameter Block as used by Atari ST GEMDOS on FAT12 volumes.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct AtariParameterBlock
{
/// <summary>68000 BRA.S jump or x86 loop</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public readonly byte[] jump;
/// <summary>OEM Name, 6 bytes, space-padded, "Loader" for Atari ST boot loader</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public readonly byte[] oem_name;
/// <summary>Volume serial number</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] serial_no;
/// <summary>Bytes per sector</summary>
public readonly ushort bps;
/// <summary>Sectors per cluster</summary>
public readonly byte spc;
/// <summary>Reserved sectors between BPB and FAT (inclusive)</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume</summary>
public ushort sectors;
/// <summary>Media descriptor, unused by GEMDOS</summary>
public readonly byte media;
/// <summary>Sectors per FAT</summary>
public readonly ushort spfat;
/// <summary>Sectors per track</summary>
public readonly ushort sptrk;
/// <summary>Heads</summary>
public readonly ushort heads;
/// <summary>Hidden sectors before BPB, unused by GEMDOS</summary>
public readonly ushort hsectors;
/// <summary>Word to be loaded in the cmdload system variable. Big-endian.</summary>
public readonly ushort execflag;
/// <summary>
/// Word indicating load mode. If zero, file named <see cref="fname" /> is located and loaded. It not, sectors
/// specified in <see cref="ssect" /> and <see cref="sectcnt" /> are loaded. Big endian.
/// </summary>
public readonly ushort ldmode;
/// <summary>Starting sector of boot code.</summary>
public readonly ushort ssect;
/// <summary>Count of sectors of boot code.</summary>
public readonly ushort sectcnt;
/// <summary>Address where boot code should be loaded.</summary>
public readonly ushort ldaaddr;
/// <summary>Padding.</summary>
public readonly ushort padding;
/// <summary>Address where FAT and root directory sectors must be loaded.</summary>
public readonly ushort fatbuf;
/// <summary>Unknown.</summary>
public readonly ushort unknown;
/// <summary>Filename to be loaded for booting.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
public readonly byte[] fname;
/// <summary>Reserved</summary>
public readonly ushort reserved;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 455)]
public readonly byte[] boot_code;
/// <summary>Big endian word to make big endian sum of all sector words be equal to 0x1234 if disk is bootable.</summary>
public readonly ushort checksum;
}
/// <summary>
/// BIOS Parameter Block as used by MSX-DOS 2.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct MsxParameterBlock
{
/// <summary>x86 loop</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] jump;
/// <summary>OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] oem_name;
/// <summary>Bytes per sector</summary>
public readonly ushort bps;
/// <summary>Sectors per cluster</summary>
public readonly byte spc;
/// <summary>Reserved sectors between BPB and FAT (inclusive)</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Sectors per FAT</summary>
public readonly ushort spfat;
/// <summary>Sectors per track</summary>
public readonly ushort sptrk;
/// <summary>Heads</summary>
public readonly ushort heads;
/// <summary>Hidden sectors before BPB</summary>
public readonly ushort hsectors;
/// <summary>Jump for MSX-DOS 1 boot code</summary>
public readonly ushort msxdos_jmp;
/// <summary>Set to "VOL_ID" by MSX-DOS 2</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
public readonly byte[] vol_id;
/// <summary>Bigger than 0 if there are deleted files (MSX-DOS 2)</summary>
public readonly byte undelete_flag;
/// <summary>Volume serial number (MSX-DOS 2)</summary>
public readonly uint serial_no;
/// <summary>Reserved (MSX-DOS 2)</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public readonly byte[] reserved;
/// <summary>Jump for MSX-DOS 2 boot code (MSX-DOS 2)</summary>
public readonly ushort msxdos2_jmp;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 460)]
public readonly byte[] boot_code;
/// <summary>Always 0x55 0xAA.</summary>
public readonly ushort boot_signature;
}
/// <summary>DOS 2.0 BIOS Parameter Block.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BiosParameterBlock2
{
/// <summary>x86 jump</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] jump;
/// <summary>OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] oem_name;
/// <summary>Bytes per sector</summary>
public readonly ushort bps;
/// <summary>Sectors per cluster</summary>
public readonly byte spc;
/// <summary>Reserved sectors between BPB and FAT</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Sectors per FAT</summary>
public readonly ushort spfat;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 486)]
public readonly byte[] boot_code;
/// <summary>0x55 0xAA if bootable.</summary>
public readonly ushort boot_signature;
}
/// <summary>DOS 3.0 BIOS Parameter Block.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BiosParameterBlock30
{
/// <summary>x86 jump</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] jump;
/// <summary>OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] oem_name;
/// <summary>Bytes per sector</summary>
public readonly ushort bps;
/// <summary>Sectors per cluster</summary>
public readonly byte spc;
/// <summary>Reserved sectors between BPB and FAT</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Sectors per FAT</summary>
public readonly ushort spfat;
/// <summary>Sectors per track</summary>
public readonly ushort sptrk;
/// <summary>Heads</summary>
public readonly ushort heads;
/// <summary>Hidden sectors before BPB</summary>
public readonly ushort hsectors;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 480)]
public readonly byte[] boot_code;
/// <summary>Always 0x55 0xAA.</summary>
public readonly ushort boot_signature;
}
/// <summary>DOS 3.2 BIOS Parameter Block.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BiosParameterBlock32
{
/// <summary>x86 jump</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] jump;
/// <summary>OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] oem_name;
/// <summary>Bytes per sector</summary>
public readonly ushort bps;
/// <summary>Sectors per cluster</summary>
public readonly byte spc;
/// <summary>Reserved sectors between BPB and FAT</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Sectors per FAT</summary>
public readonly ushort spfat;
/// <summary>Sectors per track</summary>
public readonly ushort sptrk;
/// <summary>Heads</summary>
public readonly ushort heads;
/// <summary>Hidden sectors before BPB</summary>
public readonly ushort hsectors;
/// <summary>Total sectors including hidden ones</summary>
public readonly ushort total_sectors;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 478)]
public readonly byte[] boot_code;
/// <summary>Always 0x55 0xAA.</summary>
public readonly ushort boot_signature;
}
/// <summary>DOS 3.31 BIOS Parameter Block.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BiosParameterBlock33
{
/// <summary>x86 jump</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] jump;
/// <summary>OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] oem_name;
/// <summary>Bytes per sector</summary>
public readonly ushort bps;
/// <summary>Sectors per cluster</summary>
public readonly byte spc;
/// <summary>Reserved sectors between BPB and FAT</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Sectors per FAT</summary>
public readonly ushort spfat;
/// <summary>Sectors per track</summary>
public readonly ushort sptrk;
/// <summary>Heads</summary>
public readonly ushort heads;
/// <summary>Hidden sectors before BPB</summary>
public readonly uint hsectors;
/// <summary>Sectors in volume if > 65535</summary>
public uint big_sectors;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 474)]
public readonly byte[] boot_code;
/// <summary>Always 0x55 0xAA.</summary>
public readonly ushort boot_signature;
}
/// <summary>DOS 3.4 BIOS Parameter Block.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BiosParameterBlockShortEbpb
{
/// <summary>x86 jump</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] jump;
/// <summary>OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] oem_name;
/// <summary>Bytes per sector</summary>
public readonly ushort bps;
/// <summary>Sectors per cluster</summary>
public readonly byte spc;
/// <summary>Reserved sectors between BPB and FAT</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Sectors per FAT</summary>
public readonly ushort spfat;
/// <summary>Sectors per track</summary>
public readonly ushort sptrk;
/// <summary>Heads</summary>
public readonly ushort heads;
/// <summary>Hidden sectors before BPB</summary>
public readonly uint hsectors;
/// <summary>Sectors in volume if > 65535</summary>
public uint big_sectors;
/// <summary>Drive number</summary>
public readonly byte drive_no;
/// <summary>Volume flags</summary>
public readonly byte flags;
/// <summary>EPB signature, 0x28</summary>
public readonly byte signature;
/// <summary>Volume serial number</summary>
public readonly uint serial_no;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 467)]
public readonly byte[] boot_code;
/// <summary>Always 0x55 0xAA.</summary>
public readonly ushort boot_signature;
}
/// <summary>DOS 4.0 or higher BIOS Parameter Block.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BiosParameterBlockEbpb
{
/// <summary>x86 jump</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public byte[] jump;
/// <summary>OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public byte[] oem_name;
/// <summary>Bytes per sector</summary>
public ushort bps;
/// <summary>Sectors per cluster</summary>
public byte spc;
/// <summary>Reserved sectors between BPB and FAT</summary>
public ushort rsectors;
/// <summary>Number of FATs</summary>
public byte fats_no;
/// <summary>Number of entries on root directory</summary>
public ushort root_ent;
/// <summary>Sectors in volume</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public byte media;
/// <summary>Sectors per FAT</summary>
public ushort spfat;
/// <summary>Sectors per track</summary>
public ushort sptrk;
/// <summary>Heads</summary>
public ushort heads;
/// <summary>Hidden sectors before BPB</summary>
public uint hsectors;
/// <summary>Sectors in volume if > 65535</summary>
public uint big_sectors;
/// <summary>Drive number</summary>
public byte drive_no;
/// <summary>Volume flags</summary>
public byte flags;
/// <summary>EPB signature, 0x29</summary>
public byte signature;
/// <summary>Volume serial number</summary>
public uint serial_no;
/// <summary>Volume label, 11 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
public readonly byte[] volume_label;
/// <summary>Filesystem type, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] fs_type;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 448)]
public byte[] boot_code;
/// <summary>Always 0x55 0xAA.</summary>
public ushort boot_signature;
}
/// <summary>FAT32 Parameter Block</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct Fat32ParameterBlockShort
{
/// <summary>x86 jump</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] jump;
/// <summary>OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] oem_name;
/// <summary>Bytes per sector</summary>
public readonly ushort bps;
/// <summary>Sectors per cluster</summary>
public readonly byte spc;
/// <summary>Reserved sectors between BPB and FAT</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory, set to 0</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume, set to 0</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Sectors per FAT, set to 0</summary>
public readonly ushort spfat;
/// <summary>Sectors per track</summary>
public readonly ushort sptrk;
/// <summary>Heads</summary>
public readonly ushort heads;
/// <summary>Hidden sectors before BPB</summary>
public readonly uint hsectors;
/// <summary>Sectors in volume</summary>
public uint big_sectors;
/// <summary>Sectors per FAT</summary>
public readonly uint big_spfat;
/// <summary>FAT flags</summary>
public readonly ushort mirror_flags;
/// <summary>FAT32 version</summary>
public readonly ushort version;
/// <summary>Cluster of root directory</summary>
public readonly uint root_cluster;
/// <summary>Sector of FSINFO structure</summary>
public readonly ushort fsinfo_sector;
/// <summary>Sector of FAT32PB backup</summary>
public readonly ushort backup_sector;
/// <summary>Reserved</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
public readonly byte[] reserved;
/// <summary>Drive number</summary>
public readonly byte drive_no;
/// <summary>Volume flags</summary>
public readonly byte flags;
/// <summary>Signature, should be 0x28</summary>
public readonly byte signature;
/// <summary>Volume serial number</summary>
public readonly uint serial_no;
/// <summary>Volume label, 11 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
public readonly byte[] reserved2;
/// <summary>Sectors in volume if <see cref="big_sectors" /> equals 0</summary>
public ulong huge_sectors;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 420)]
public readonly byte[] boot_code;
/// <summary>Always 0x55 0xAA.</summary>
public readonly ushort boot_signature;
}
/// <summary>FAT32 Parameter Block</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct Fat32ParameterBlock
{
/// <summary>x86 jump</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] jump;
/// <summary>OEM Name, 8 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] oem_name;
/// <summary>Bytes per sector</summary>
public ushort bps;
/// <summary>Sectors per cluster</summary>
public byte spc;
/// <summary>Reserved sectors between BPB and FAT</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory, set to 0</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume, set to 0</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Sectors per FAT, set to 0</summary>
public readonly ushort spfat;
/// <summary>Sectors per track</summary>
public ushort sptrk;
/// <summary>Heads</summary>
public readonly ushort heads;
/// <summary>Hidden sectors before BPB</summary>
public uint hsectors;
/// <summary>Sectors in volume</summary>
public uint big_sectors;
/// <summary>Sectors per FAT</summary>
public uint big_spfat;
/// <summary>FAT flags</summary>
public readonly ushort mirror_flags;
/// <summary>FAT32 version</summary>
public readonly ushort version;
/// <summary>Cluster of root directory</summary>
public readonly uint root_cluster;
/// <summary>Sector of FSINFO structure</summary>
public readonly ushort fsinfo_sector;
/// <summary>Sector of FAT32PB backup</summary>
public readonly ushort backup_sector;
/// <summary>Reserved</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
public readonly byte[] reserved;
/// <summary>Drive number</summary>
public readonly byte drive_no;
/// <summary>Volume flags</summary>
public readonly byte flags;
/// <summary>Signature, should be 0x29</summary>
public readonly byte signature;
/// <summary>Volume serial number</summary>
public readonly uint serial_no;
/// <summary>Volume label, 11 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
public readonly byte[] volume_label;
/// <summary>Filesystem type, 8 bytes, space-padded, must be "FAT32 "</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] fs_type;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 419)]
public readonly byte[] boot_code;
/// <summary>Always 0x55 0xAA.</summary>
public readonly ushort boot_signature;
}
/// <summary>Apricot Label.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct ApricotLabel
{
/// <summary>Version of format which created disk</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] version;
/// <summary>Operating system.</summary>
public readonly byte operatingSystem;
/// <summary>Software write protection.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool writeProtected;
/// <summary>Copy protected.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool copyProtected;
/// <summary>Boot type.</summary>
public readonly byte bootType;
/// <summary>Partitions.</summary>
public readonly byte partitionCount;
/// <summary>Is hard disk?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool winchester;
/// <summary>Sector size.</summary>
public readonly ushort sectorSize;
/// <summary>Sectors per track.</summary>
public readonly ushort spt;
/// <summary>Tracks per side.</summary>
public readonly uint cylinders;
/// <summary>Sides.</summary>
public readonly byte heads;
/// <summary>Interleave factor.</summary>
public readonly byte interleave;
/// <summary>Skew factor.</summary>
public readonly ushort skew;
/// <summary>Sector where boot code starts.</summary>
public readonly uint bootLocation;
/// <summary>Size in sectors of boot code.</summary>
public readonly ushort bootSize;
/// <summary>Address at which to load boot code.</summary>
public readonly uint bootAddress;
/// <summary>Offset where to jump to boot.</summary>
public readonly ushort bootOffset;
/// <summary>Segment where to jump to boot.</summary>
public readonly ushort bootSegment;
/// <summary>First data sector.</summary>
public readonly uint firstDataBlock;
/// <summary>Generation.</summary>
public readonly ushort generation;
/// <summary>Copy count.</summary>
public readonly ushort copyCount;
/// <summary>Maximum number of copies.</summary>
public readonly ushort maxCopies;
/// <summary>Serial number.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] serialNumber;
/// <summary>Part number.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] partNumber;
/// <summary>Copyright.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)]
public readonly byte[] copyright;
/// <summary>BPB for whole disk.</summary>
public ApricotParameterBlock mainBPB;
/// <summary>Name of FONT file.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] fontName;
/// <summary>Name of KEYBOARD file.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] keyboardName;
/// <summary>Minor BIOS version.</summary>
public readonly byte biosMinorVersion;
/// <summary>Major BIOS version.</summary>
public readonly byte biosMajorVersion;
/// <summary>Diagnostics enabled?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool diagnosticsFlag;
/// <summary>Printer device.</summary>
public readonly byte prnDevice;
/// <summary>Bell volume.</summary>
public readonly byte bellVolume;
/// <summary>Cache enabled?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool enableCache;
/// <summary>Graphics enabled?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool enableGraphics;
/// <summary>Length in sectors of DOS.</summary>
public readonly byte dosLength;
/// <summary>Length in sectors of FONT file.</summary>
public readonly byte fontLength;
/// <summary>Length in sectors of KEYBOARD file.</summary>
public readonly byte keyboardLength;
/// <summary>Starting sector of DOS.</summary>
public readonly ushort dosStart;
/// <summary>Starting sector of FONT file.</summary>
public readonly ushort fontStart;
/// <summary>Starting sector of KEYBOARD file.</summary>
public readonly ushort keyboardStart;
/// <summary>Keyboard click volume.</summary>
public readonly byte keyboardVolume;
/// <summary>Auto-repeat enabled?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool autorepeat;
/// <summary>Auto-repeat lead-in.</summary>
public readonly byte autorepeatLeadIn;
/// <summary>Auto-repeat interval.</summary>
public readonly byte autorepeatInterval;
/// <summary>Microscreen mode.</summary>
public readonly byte microscreenMode;
/// <summary>Spare area for keyboard values expansion.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
public readonly byte[] spareKeyboard;
/// <summary>Screen line mode.</summary>
public readonly byte lineMode;
/// <summary>Screen line width.</summary>
public readonly byte lineWidth;
/// <summary>Screen disabled?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool imageOff;
/// <summary>Spare area for screen values expansion.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)]
public readonly byte[] spareScreen;
/// <summary>TX baud rate.</summary>
public readonly byte txBaudRate;
/// <summary>RX baud rate.</summary>
public readonly byte rxBaudRate;
/// <summary>TX bits.</summary>
public readonly byte txBits;
/// <summary>RX bits.</summary>
public readonly byte rxBits;
/// <summary>Stop bits.</summary>
public readonly byte stopBits;
/// <summary>Parity enabled?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool parityCheck;
/// <summary>Parity type.</summary>
public readonly byte parityType;
/// <summary>Xon/Xoff enabled on TX.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool txXonXoff;
/// <summary>Xon/Xoff enabled on RX.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool rxXonXoff;
/// <summary>Xon character.</summary>
public readonly byte xonCharacter;
/// <summary>Xoff character.</summary>
public readonly byte xoffCharacter;
/// <summary>Xon/Xoff buffer on RX.</summary>
public readonly ushort rxXonXoffBuffer;
/// <summary>DTR/DSR enabled?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool dtrDsr;
/// <summary>CTS/RTS enabled?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool ctsRts;
/// <summary>NULLs after CR.</summary>
public readonly byte nullsAfterCr;
/// <summary>NULLs after 0xFF.</summary>
public readonly byte nullsAfterFF;
/// <summary>Send LF after CR in serial port.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool lfAfterCRSerial;
/// <summary>BIOS error report in serial port.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool biosErrorReportSerial;
/// <summary>Spare area for serial port values expansion.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)]
public readonly byte[] spareSerial;
/// <summary>Send LF after CR in parallel port.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool lfAfterCrParallel;
/// <summary>Select line supported?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool selectLine;
/// <summary>Paper empty supported?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool paperEmpty;
/// <summary>Fault line supported?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool faultLine;
/// <summary>BIOS error report in parallel port.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool biosErrorReportParallel;
/// <summary>Spare area for parallel port values expansion.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
public readonly byte[] spareParallel;
/// <summary>Spare area for Winchester values expansion.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)]
public readonly byte[] spareWinchester;
/// <summary>Parking enabled?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool parkingEnabled;
/// <summary>Format protection?.</summary>
[MarshalAs(UnmanagedType.U1)]
public readonly bool formatProtection;
/// <summary>Spare area for RAM disk values expansion.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] spareRamDisk;
/// <summary>List of bad blocks.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public readonly ushort[] badBlocks;
/// <summary>Array of partition BPBs.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly ApricotParameterBlock[] partitions;
/// <summary>Spare area.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 63)]
public readonly byte[] spare;
/// <summary>CP/M double side indicator?.</summary>
public readonly bool cpmDoubleSided;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct ApricotParameterBlock
{
/// <summary>Bytes per sector</summary>
public readonly ushort bps;
/// <summary>Sectors per cluster</summary>
public readonly byte spc;
/// <summary>Reserved sectors between BPB and FAT</summary>
public readonly ushort rsectors;
/// <summary>Number of FATs</summary>
public readonly byte fats_no;
/// <summary>Number of entries on root directory</summary>
public readonly ushort root_ent;
/// <summary>Sectors in volume</summary>
public ushort sectors;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Sectors per FAT</summary>
public readonly ushort spfat;
/// <summary>Disk type</summary>
public readonly byte diskType;
/// <summary>Volume starting sector</summary>
public readonly ushort startSector;
}
/// <summary>FAT32 FS Information Sector</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct FsInfoSector
{
/// <summary>Signature must be <see cref="FAT.FSINFO_SIGNATURE1" /></summary>
public readonly uint signature1;
/// <summary>Reserved</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 480)]
public readonly byte[] reserved1;
/// <summary>Signature must be <see cref="FAT.FSINFO_SIGNATURE2" /></summary>
public readonly uint signature2;
/// <summary>Free clusters</summary>
public readonly uint free_clusters;
/// <summary> cated cluster</summary>
public readonly uint last_cluster;
/// <summary>Reserved</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
public readonly byte[] reserved2;
/// <summary>Signature must be <see cref="FAT.FSINFO_SIGNATURE3" /></summary>
public readonly uint signature3;
}
/// <summary>Human68k Parameter Block, big endian, 512 bytes even on 256 bytes/sector.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct HumanParameterBlock
{
/// <summary>68k bra.S</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public readonly byte[] jump;
/// <summary>OEM Name, 16 bytes, space-padded</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] oem_name;
/// <summary>Bytes per cluster</summary>
public readonly ushort bpc;
/// <summary>Unknown, seen 1, 2 and 16</summary>
public readonly byte unknown1;
/// <summary>Unknown, always 512?</summary>
public readonly ushort unknown2;
/// <summary>Unknown, always 1?</summary>
public readonly byte unknown3;
/// <summary>Number of entries on root directory</summary>
public readonly ushort root_ent;
/// <summary>Clusters, set to 0 if more than 65536</summary>
public readonly ushort clusters;
/// <summary>Media descriptor</summary>
public readonly byte media;
/// <summary>Clusters per FAT, set to 0</summary>
public readonly byte cpfat;
/// <summary>Clustersin volume</summary>
public readonly uint big_clusters;
/// <summary>Boot code.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 478)]
public readonly byte[] boot_code;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct DirectoryEntry
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] filename;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] extension;
public readonly FatAttributes attributes;
public readonly byte caseinfo;
public readonly byte ctime_ms;
public readonly ushort ctime;
public readonly ushort cdate;
public readonly ushort adate;
public readonly ushort ea_handle;
public readonly ushort mtime;
public readonly ushort mdate;
public readonly ushort start_cluster;
public readonly uint size;
}
}
}

View File

@@ -0,0 +1,62 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Super.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Microsoft FAT filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Handles mounting and umounting the Microsoft FAT filesystem.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Interfaces;
using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.Filesystems.FAT
{
public partial class FAT
{
/// <summary>
/// Mounts an Apple Lisa filesystem
/// </summary>
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding,
Dictionary<string, string> options, string @namespace) =>
throw new NotImplementedException();
/// <summary>
/// Umounts this Lisa filesystem
/// </summary>
public Errno Unmount() => throw new NotImplementedException();
/// <summary>
/// Gets information about the mounted volume.
/// </summary>
/// <param name="stat">Information about the mounted volume.</param>
public Errno StatFs(out FileSystemInfo stat) => throw new NotImplementedException();
}
}

View File

@@ -0,0 +1,75 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Xattr.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Microsoft FAT filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Methods to handle Microsoft FAT extended attributes.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.Filesystems.FAT
{
public partial class FAT
{
/// <summary>
/// Lists all extended attributes, alternate data streams and forks of the given file.
/// </summary>
/// <returns>Error number.</returns>
/// <param name="path">Path.</param>
/// <param name="xattrs">List of extended attributes, alternate data streams and forks.</param>
public Errno ListXAttr(string path, out List<string> xattrs) => throw new NotImplementedException();
/// <summary>
/// Reads an extended attribute, alternate data stream or fork from the given file.
/// </summary>
/// <returns>Error number.</returns>
/// <param name="path">File path.</param>
/// <param name="xattr">Extendad attribute, alternate data stream or fork name.</param>
/// <param name="buf">Buffer.</param>
public Errno GetXattr(string path, string xattr, ref byte[] buf) => throw new NotImplementedException();
/// <summary>
/// Lists special Apple Lisa filesystem features as extended attributes
/// </summary>
/// <returns>Error number.</returns>
/// <param name="fileId">File identifier.</param>
/// <param name="xattrs">Extended attributes.</param>
Errno ListXAttr(short fileId, out List<string> xattrs) => throw new NotImplementedException();
/// <summary>
/// Lists special Apple Lisa filesystem features as extended attributes
/// </summary>
/// <returns>Error number.</returns>
/// <param name="fileId">File identifier.</param>
/// <param name="xattr">Extended attribute name.</param>
/// <param name="buf">Buffer where the extended attribute will be stored.</param>
Errno GetXattr(short fileId, string xattr, out byte[] buf) => throw new NotImplementedException();
}
}

View File

@@ -31,7 +31,7 @@ using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Interfaces;
using DiscImageChef.DiscImages;
using DiscImageChef.Filesystems;
using DiscImageChef.Filesystems.FAT;
using DiscImageChef.Filters;
using NUnit.Framework;

View File

@@ -31,7 +31,7 @@ using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Interfaces;
using DiscImageChef.DiscImages;
using DiscImageChef.Filesystems;
using DiscImageChef.Filesystems.FAT;
using DiscImageChef.Filters;
using NUnit.Framework;

View File

@@ -31,7 +31,7 @@ using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Interfaces;
using DiscImageChef.DiscImages;
using DiscImageChef.Filesystems;
using DiscImageChef.Filesystems.FAT;
using DiscImageChef.Filters;
using NUnit.Framework;