diff --git a/DiscImageChef.Filesystems/DiscImageChef.Filesystems.csproj b/DiscImageChef.Filesystems/DiscImageChef.Filesystems.csproj index 23e082e49..745e18fcc 100644 --- a/DiscImageChef.Filesystems/DiscImageChef.Filesystems.csproj +++ b/DiscImageChef.Filesystems/DiscImageChef.Filesystems.csproj @@ -140,11 +140,30 @@ - - + + + + + + + + + + + + + + + + + + + + + @@ -188,6 +207,8 @@ + + diff --git a/DiscImageChef.Filesystems/ISO9660/Consts.cs b/DiscImageChef.Filesystems/ISO9660/Consts.cs deleted file mode 100644 index f4f1fdfb8..000000000 --- a/DiscImageChef.Filesystems/ISO9660/Consts.cs +++ /dev/null @@ -1,279 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : Consts.cs -// Author(s) : Natalia Portillo -// -// Component : Component -// -// --[ Description ] ---------------------------------------------------------- -// -// Description -// -// --[ 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 . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2017 Natalia Portillo -// ****************************************************************************/ -using System; - -namespace DiscImageChef.Filesystems.ISO9660 -{ - public partial class ISO9660 : Filesystem - { - readonly string IsoMagic = "CD001"; - readonly string HighSierraMagic = "CDROM"; - const ushort ElToritoMagic = 0xAA55; - const int ElToritoEntrySize = 32; - const ushort XaMagic = 0x5841; // "XA" - const ushort AppleMagic = 0x4141; // "AA" - const ushort AppleMagicOld = 0x4241; // "BA" - const ushort SUSP_Continuation = 0x4345; // "CE" - const ushort SUSP_Padding = 0x5044; // "PD" - const ushort SUSP_Indicator = 0x5350; // "SP" - const ushort SUSP_Terminator = 0x5354; // "ST" - const ushort SUSP_Reference = 0x4552; // "ER" - const ushort SUSP_Selector = 0x4553; // "ES" - const ushort SUSP_Magic = 0xBEEF; - const ushort RRIP_Magic = 0x5252; // "RR" - const ushort RRIP_PosixAttributes = 0x5058; // "PX" - const ushort RRIP_PosixDevNo = 0x504E; // "PN" - const ushort RRIP_Symlink = 0x534C; // "SL" - const ushort RRIP_Name = 0x4E4D; // "NM" - const ushort RRIP_Childlink = 0x434C; // "CL" - const ushort RRIP_Parentlink = 0x504C; // "PL" - const ushort RRIP_RelocatedDir = 0x5245; // "RE" - const ushort RRIP_Timestamps = 0x5446; // "TF" - const ushort RRIP_Sparse = 0x5346; // "SF" - const ulong ziso_header_magic = 0x37E45396C9DBD607; - const ulong ziso_header_cigam = 0x07D6DBC99653E437; - const ushort ziso_Magic = 0x5A46; // "ZF" - const ushort ziso_PagedZlib = 0x707A; // "pz" - const ushort Amiga_Magic = 0x4153; // "AS" - const ushort AAIP_Magic = 0x414C; // "AL" - const ushort AAIP_OldMagic = 0x4141; // "AA" - - [Flags] - enum FileFlags : byte - { - Hidden = 0x01, - Directory = 0x02, - Associated = 0x04, - Record = 0x08, - Protected = 0x10, - MultiExtent = 0x80 - } - - [Flags] - enum Permissions : ushort - { - SystemRead = 0x01, - SystemExecute = 0x04, - OwnerRead = 0x10, - OwnerExecute = 0x40, - GroupRead = 0x100, - GroupExecute = 0x400, - OtherRead = 0x1000, - OtherExecute = 0x4000, - } - - [Flags] - enum XaAttributes : ushort - { - SystemRead = 0x01, - SystemExecute = 0x04, - OwnerRead = 0x10, - OwnerExecute = 0x40, - GroupRead = 0x100, - GroupExecute = 0x400, - Mode2Form1 = 0x800, - Mode2Form2 = 0x1000, - Interleaved = 0x2000, - Cdda = 0x4000, - Directory = 0x8000, - } - - enum RecordFormat : byte - { - Unspecified = 0, - FixedLength = 1, - VariableLength = 2, - VariableLengthAlternate = 3 - } - - enum RecordAttribute : byte - { - LFCR = 0, - ISO1539 = 1, - ControlContained = 2, - } - - enum ElToritoIndicator : byte - { - Header = 1, - Extension = 0x44, - Bootable = 0x88, - MoreHeaders = 0x90, - LastHeader = 0x91 - } - - enum ElToritoPlatform : byte - { - x86 = 0, - PowerPC = 1, - Macintosh = 2, - EFI = 0xef - } - - enum ElToritoEmulation : byte - { - None = 0, - Md2hd = 1, - Mf2hd = 2, - Mf2ed = 3, - Hdd = 4 - } - - [Flags] - enum ElToritoFlags : byte - { - Reserved = 0x10, - Continued = 0x20, - ATAPI = 0x40, - SCSI = 0x08 - } - - enum AppleId : byte - { - ProDOS = 1, - HFS = 2 - } - - enum AppleOldId : byte - { - ProDOS = 1, - TypeCreator = 2, - TypeCreatorBundle = 3, - TypeCreatorIcon = 4, - TypeCreatorIconBundle = 5, - HFS = 6 - } - - [Flags] - enum PosixMode : uint - { - OwnerRead = 0x100, - OwnerWrite = 0x80, - OwnerExecute = 0x40, - GroupRead = 0x20, - GroupWrite = 0x10, - GroupExecute = 0x8, - OtherRead = 0x4, - OtherWrite = 0x2, - OtherExecute = 0x1, - SetUID = 0x800, - SetGid = 0x400, - IsVTX = 0x200, - Socket = 0xC000, - Symlink = 0xA000, - Regular = 0x8000, - Block = 0x6000, - Character = 0x2000, - Directory = 0x4000, - Pipe = 0x1000 - } - - [Flags] - enum SymlinkFlags : byte - { - Continue = 1 - } - - [Flags] - enum SymlinkComponentFlags : byte - { - Continue = 1, - Current = 2, - Parent = 4, - Root = 8, - Mountpoint = 16, - Networkname = 32 - } - - [Flags] - enum AlternateNameFlags : byte - { - Continue = 1, - Current = 2, - Parent = 4, - Networkname = 32 - } - - [Flags] - enum TimestampFlags : byte - { - Creation = 1 << 0, - Modification = 1 << 1, - Access = 1 << 2, - AttributeChange = 1 << 3, - Backup = 1 << 4, - Expiration = 1 << 5, - Effective = 1 << 6, - LongFormat = 1 << 7, - } - - [Flags] - enum AmigaFlags : byte - { - Protection = 1 << 0, - Comment = 1 << 1, - CommentContinues = 1 << 2 - } - - [Flags] - enum AmigaMultiuser : byte - { - GroupDelete = 1 << 0, - GroupExec = 1 << 1, - GroupWrite = 1 << 2, - GroupRead = 1 << 3, - OtherDelete = 1 << 4, - OtherExec = 1 << 5, - OtherWrite = 1 << 6, - OtherRead = 1 << 7, - } - - [Flags] - enum AmigaAttributes : byte - { - OwnerDelete = 1 << 0, - OwnerExec = 1 << 1, - OwnerWrite = 1 << 2, - OwnerRead = 1 << 3, - Archive = 1 << 4, - Reentrant = 1 << 5, - Script = 1 << 6, - Reserved = 1 << 7, - } - - [Flags] - enum AAIPFlags : byte - { - Continue = 1 - } - } -} diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/AAIP.cs b/DiscImageChef.Filesystems/ISO9660/Consts/AAIP.cs new file mode 100644 index 000000000..5921a00af --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Consts/AAIP.cs @@ -0,0 +1,47 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : AAIP.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System; + +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + const ushort AAIP_Magic = 0x414C; // "AL" + const ushort AAIP_OldMagic = 0x4141; // "AA" + + [Flags] + enum AAIPFlags : byte + { + Continue = 1 + } + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/Amiga.cs b/DiscImageChef.Filesystems/ISO9660/Consts/Amiga.cs new file mode 100644 index 000000000..99ec33133 --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Consts/Amiga.cs @@ -0,0 +1,74 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : Amiga.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System; + +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + const ushort Amiga_Magic = 0x4153; // "AS" + + [Flags] + enum AmigaFlags : byte + { + Protection = 1 << 0, + Comment = 1 << 1, + CommentContinues = 1 << 2 + } + + [Flags] + enum AmigaMultiuser : byte + { + GroupDelete = 1 << 0, + GroupExec = 1 << 1, + GroupWrite = 1 << 2, + GroupRead = 1 << 3, + OtherDelete = 1 << 4, + OtherExec = 1 << 5, + OtherWrite = 1 << 6, + OtherRead = 1 << 7, + } + + [Flags] + enum AmigaAttributes : byte + { + OwnerDelete = 1 << 0, + OwnerExec = 1 << 1, + OwnerWrite = 1 << 2, + OwnerRead = 1 << 3, + Archive = 1 << 4, + Reentrant = 1 << 5, + Script = 1 << 6, + Reserved = 1 << 7, + } + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/Apple.cs b/DiscImageChef.Filesystems/ISO9660/Consts/Apple.cs new file mode 100644 index 000000000..007d39d5b --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Consts/Apple.cs @@ -0,0 +1,55 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : Apple.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + const ushort AppleMagic = 0x4141; // "AA" + const ushort AppleMagicOld = 0x4241; // "BA" + + enum AppleId : byte + { + ProDOS = 1, + HFS = 2 + } + + enum AppleOldId : byte + { + ProDOS = 1, + TypeCreator = 2, + TypeCreatorBundle = 3, + TypeCreatorIcon = 4, + TypeCreatorIconBundle = 5, + HFS = 6 + } + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/ElTorito.cs b/DiscImageChef.Filesystems/ISO9660/Consts/ElTorito.cs new file mode 100644 index 000000000..aef4f1166 --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Consts/ElTorito.cs @@ -0,0 +1,76 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : ElTorito.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System; + +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + const ushort ElToritoMagic = 0xAA55; + const int ElToritoEntrySize = 32; + + enum ElToritoIndicator : byte + { + Header = 1, + Extension = 0x44, + Bootable = 0x88, + MoreHeaders = 0x90, + LastHeader = 0x91 + } + + enum ElToritoPlatform : byte + { + x86 = 0, + PowerPC = 1, + Macintosh = 2, + EFI = 0xef + } + + enum ElToritoEmulation : byte + { + None = 0, + Md2hd = 1, + Mf2hd = 2, + Mf2ed = 3, + Hdd = 4 + } + + [Flags] + enum ElToritoFlags : byte + { + Reserved = 0x10, + Continued = 0x20, + ATAPI = 0x40, + SCSI = 0x08 + } + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/HighSierra.cs b/DiscImageChef.Filesystems/ISO9660/Consts/HighSierra.cs new file mode 100644 index 000000000..a7f4661b1 --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Consts/HighSierra.cs @@ -0,0 +1,38 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : HighSierra.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + readonly string HighSierraMagic = "CDROM"; + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/ISO.cs b/DiscImageChef.Filesystems/ISO9660/Consts/ISO.cs new file mode 100644 index 000000000..89318aea8 --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Consts/ISO.cs @@ -0,0 +1,79 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : ISO.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System; + +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + readonly string IsoMagic = "CD001"; + + [Flags] + enum FileFlags : byte + { + Hidden = 0x01, + Directory = 0x02, + Associated = 0x04, + Record = 0x08, + Protected = 0x10, + MultiExtent = 0x80 + } + + [Flags] + enum Permissions : ushort + { + SystemRead = 0x01, + SystemExecute = 0x04, + OwnerRead = 0x10, + OwnerExecute = 0x40, + GroupRead = 0x100, + GroupExecute = 0x400, + OtherRead = 0x1000, + OtherExecute = 0x4000, + } + + enum RecordFormat : byte + { + Unspecified = 0, + FixedLength = 1, + VariableLength = 2, + VariableLengthAlternate = 3 + } + + enum RecordAttribute : byte + { + LFCR = 0, + ISO1539 = 1, + ControlContained = 2, + } + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/RRIP.cs b/DiscImageChef.Filesystems/ISO9660/Consts/RRIP.cs new file mode 100644 index 000000000..5a9f066e5 --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Consts/RRIP.cs @@ -0,0 +1,112 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : RRIP.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System; + +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + const ushort RRIP_Magic = 0x5252; // "RR" + const ushort RRIP_PosixAttributes = 0x5058; // "PX" + const ushort RRIP_PosixDevNo = 0x504E; // "PN" + const ushort RRIP_Symlink = 0x534C; // "SL" + const ushort RRIP_Name = 0x4E4D; // "NM" + const ushort RRIP_Childlink = 0x434C; // "CL" + const ushort RRIP_Parentlink = 0x504C; // "PL" + const ushort RRIP_RelocatedDir = 0x5245; // "RE" + const ushort RRIP_Timestamps = 0x5446; // "TF" + const ushort RRIP_Sparse = 0x5346; // "SF" + + [Flags] + enum PosixMode : uint + { + OwnerRead = 0x100, + OwnerWrite = 0x80, + OwnerExecute = 0x40, + GroupRead = 0x20, + GroupWrite = 0x10, + GroupExecute = 0x8, + OtherRead = 0x4, + OtherWrite = 0x2, + OtherExecute = 0x1, + SetUID = 0x800, + SetGid = 0x400, + IsVTX = 0x200, + Socket = 0xC000, + Symlink = 0xA000, + Regular = 0x8000, + Block = 0x6000, + Character = 0x2000, + Directory = 0x4000, + Pipe = 0x1000 + } + + [Flags] + enum SymlinkFlags : byte + { + Continue = 1 + } + + [Flags] + enum SymlinkComponentFlags : byte + { + Continue = 1, + Current = 2, + Parent = 4, + Root = 8, + Mountpoint = 16, + Networkname = 32 + } + + [Flags] + enum AlternateNameFlags : byte + { + Continue = 1, + Current = 2, + Parent = 4, + Networkname = 32 + } + + [Flags] + enum TimestampFlags : byte + { + Creation = 1 << 0, + Modification = 1 << 1, + Access = 1 << 2, + AttributeChange = 1 << 3, + Backup = 1 << 4, + Expiration = 1 << 5, + Effective = 1 << 6, + LongFormat = 1 << 7, + } + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/SUSP.cs b/DiscImageChef.Filesystems/ISO9660/Consts/SUSP.cs new file mode 100644 index 000000000..ad22c975c --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Consts/SUSP.cs @@ -0,0 +1,44 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : SUSP.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + const ushort SUSP_Continuation = 0x4345; // "CE" + const ushort SUSP_Padding = 0x5044; // "PD" + const ushort SUSP_Indicator = 0x5350; // "SP" + const ushort SUSP_Terminator = 0x5354; // "ST" + const ushort SUSP_Reference = 0x4552; // "ER" + const ushort SUSP_Selector = 0x4553; // "ES" + const ushort SUSP_Magic = 0xBEEF; + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/XA.cs b/DiscImageChef.Filesystems/ISO9660/Consts/XA.cs new file mode 100644 index 000000000..6e6bff2e9 --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Consts/XA.cs @@ -0,0 +1,56 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : XA.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System; + +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + const ushort XaMagic = 0x5841; // "XA" + + [Flags] + enum XaAttributes : ushort + { + SystemRead = 0x01, + SystemExecute = 0x04, + OwnerRead = 0x10, + OwnerExecute = 0x40, + GroupRead = 0x100, + GroupExecute = 0x400, + Mode2Form1 = 0x800, + Mode2Form2 = 0x1000, + Interleaved = 0x2000, + Cdda = 0x4000, + Directory = 0x8000, + } + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Consts/Ziso.cs b/DiscImageChef.Filesystems/ISO9660/Consts/Ziso.cs new file mode 100644 index 000000000..fa73100e6 --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Consts/Ziso.cs @@ -0,0 +1,41 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : Ziso.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + const ulong ziso_header_magic = 0x37E45396C9DBD607; + const ulong ziso_header_cigam = 0x07D6DBC99653E437; + const ushort ziso_Magic = 0x5A46; // "ZF" + const ushort ziso_PagedZlib = 0x707A; // "pz" + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Structs.cs b/DiscImageChef.Filesystems/ISO9660/Structs.cs deleted file mode 100644 index 8537ce3f8..000000000 --- a/DiscImageChef.Filesystems/ISO9660/Structs.cs +++ /dev/null @@ -1,827 +0,0 @@ -// /*************************************************************************** -// The Disc Image Chef -// ---------------------------------------------------------------------------- -// -// Filename : Structs.cs -// Author(s) : Natalia Portillo -// -// Component : Component -// -// --[ Description ] ---------------------------------------------------------- -// -// Description -// -// --[ 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 . -// -// ---------------------------------------------------------------------------- -// Copyright © 2011-2017 Natalia Portillo -// ****************************************************************************/ -using System; -using System.Runtime.InteropServices; -using System.Text; - -namespace DiscImageChef.Filesystems.ISO9660 -{ - public partial class ISO9660 : Filesystem - { - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct PrimaryVolumeDescriptor - { - public byte type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] id; - public byte version; - // Only used in SVDs - public byte flags; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] system_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] volume_id; - public ulong reserved1; - public uint volume_space_size; - public uint volume_space_size_be; - // Only used in SVDs - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] escape_sequences; - public ushort volume_set_size; - public ushort volume_set_size_be; - public ushort volume_sequence_number; - public ushort volume_sequence_number_be; - public ushort logical_block_size; - public ushort logical_block_size_be; - public uint path_table_size; - public uint path_table_size_be; - public uint type_1_path_table; - public uint opt_type_1_path_table; - public uint type_m_path_table; - public uint opt_type_m_path_table; - public DirectoryRecord root_directory_record; - public byte root_directory_name; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] volume_set_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] publisher_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] preparer_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] application_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)] - public byte[] copyright_file_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)] - public byte[] abstract_file_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)] - public byte[] bibliographic_file_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public byte[] creation_date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public byte[] modification_date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public byte[] expiration_date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public byte[] effective_date; - public byte file_structure_version; - public byte reserved2; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] - public byte[] application_data; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 653)] - public byte[] reserved3; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct HighSierraPrimaryVolumeDescriptor - { - public uint volume_lbn; - public uint volume_lbn_be; - public byte type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] id; - public byte version; - // Only used in SVDs - public byte flags; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] system_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] volume_id; - public ulong reserved1; - public uint volume_space_size; - public uint volume_space_size_be; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] escape_sequences; - public ushort volume_set_size; - public ushort volume_set_size_be; - public ushort volume_sequence_number; - public ushort volume_sequence_number_be; - public ushort logical_block_size; - public ushort logical_block_size_be; - public uint path_table_size; - public uint path_table_size_be; - public uint manditory_path_table_lsb; - public uint opt_path_table_lsb_1; - public uint opt_path_table_lsb_2; - public uint opt_path_table_lsb_3; - public uint manditory_path_table_msb; - public uint opt_path_table_msb_1; - public uint opt_path_table_msb_2; - public uint opt_path_table_msb_3; - public HighSierraDirectoryRecord root_directory_record; - public byte root_directory_name; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] volume_set_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] publisher_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] preparer_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] application_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] copyright_file_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] abstract_file_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] creation_date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] modification_date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] expiration_date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] effective_date; - public byte file_structure_version; - public byte reserved2; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] - public byte[] application_data; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 680)] - public byte[] reserved3; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct BootRecord - { - public byte type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] id; - public byte version; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] system_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] boot_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1977)] - public byte[] boot_use; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct ElToritoBootRecord - { - public byte type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] id; - public byte version; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] system_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] boot_id; - public uint catalog_sector; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1974)] - public byte[] boot_use; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct PartitionDescriptor - { - public byte type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] id; - public byte version; - public byte reserved1; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] system_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] partition_id; - public uint partition_location; - public uint partition_location_be; - public uint partition_size; - public uint partition_size_be; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1960)] - public byte[] system_use; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct DirectoryRecord - { - public byte length; - public byte xattr_len; - public uint extent; - public uint extent_be; - public uint size; - public uint size_be; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] - public byte[] date; - public FileFlags flags; - public byte file_unit_size; - public byte interleave; - public ushort volume_sequence_number; - public ushort volume_sequence_number_be; - public byte name_len; - // Followed by name[name_len] and then system area until length arrives - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct HighSierraDirectoryRecord - { - public byte length; - public byte xattr_len; - public uint extent; - public uint extent_be; - public uint size; - public uint size_be; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] date; - public FileFlags flags; - public byte reserved; - public byte interleave_size; - public byte interleave; - public ushort volume_sequence_number; - public ushort volume_sequence_number_be; - public byte name_len; - // Followed by name[name_len] and then system area until length arrives - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct ExtendedAttributeRecord - { - public ushort owner; - public ushort owner_be; - public ushort group; - public ushort group_be; - public Permissions permissions; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public byte[] creation_date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public byte[] modification_date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public byte[] expiration_date; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public byte[] effective_date; - public RecordFormat record_format; - public RecordAttribute record_attributes; - public ushort record_length; - public ushort record_length_be; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] system_id; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] system_use; - public byte record_version; - public byte escape_len; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] reserved1; - public ushort app_use_len; - public ushort app_use_len_be; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct ElToritoValidationEntry - { - public ElToritoIndicator header_id; - public ElToritoPlatform platform_id; - public ushort reserved; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] - public byte[] developer_id; - public ushort checksum; - public ushort signature; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct ElToritoInitialEntry - { - public ElToritoIndicator bootable; - public ElToritoEmulation boot_type; - public ushort load_seg; - public byte system_type; - public byte reserved1; - public ushort sector_count; - public uint load_rba; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] reserved2; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct ElToritoSectionHeaderEntry - { - public ElToritoIndicator header_id; - public ElToritoPlatform platform_id; - public ushort entries; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] - public byte[] identifier; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct ElToritoSectionEntry - { - public ElToritoIndicator bootable; - public ElToritoEmulation boot_type; - public ushort load_seg; - public byte system_type; - public byte reserved1; - public ushort sector_count; - public uint load_rba; - public byte selection_criteria_type; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] - public byte[] selection_criterias; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct ElToritoSectionEntryExtension - { - public ElToritoIndicator extension_indicator; - public ElToritoFlags extension_flags; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 30)] - public byte[] selection_criterias; - } - - // Big-endian - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct CdromXa - { - public ushort group; - public ushort user; - public XaAttributes attributes; - public ushort signature; - public byte filenumber; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] reserved; - } - - // Little-endian - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct AppleProDOSSystemUse - { - public ushort signature; - public byte length; - public AppleId id; - public byte type; - public ushort aux_type; - } - - // Big-endian - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct AppleHFSSystemUse - { - public ushort signature; - public byte length; - public AppleId id; - public ushort type; - public ushort creator; - public ushort finder_flags; - } - - // Little-endian - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct AppleProDOSOldSystemUse - { - public ushort signature; - public AppleOldId id; - public byte type; - public ushort aux_type; - } - - // Big-endian - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct AppleHFSTypeCreatorSystemUse - { - public ushort signature; - public AppleOldId id; - public ushort type; - public ushort creator; - } - - // Big-endian - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct AppleHFSIconSystemUse - { - public ushort signature; - public AppleOldId id; - public ushort type; - public ushort creator; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] icon; - } - - // Big-endian - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct AppleHFSOldSystemUse - { - public ushort signature; - public AppleOldId id; - public ushort type; - public ushort creator; - public ushort finder_flags; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct ContinuationArea - { - public ushort signature; - public byte length; - public byte version; - public uint block; - public uint block_be; - public uint offset; - public uint offset_be; - public uint ca_length; - public uint ca_length_be; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct PaddingArea - { - public ushort signature; - public byte length; - public byte version; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct IndicatorArea - { - public ushort signature; - public byte length; - public byte version; - public ushort magic; - public byte skipped; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct TerminatorArea - { - public ushort signature; - public byte length; - public byte version; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct ReferenceArea - { - public ushort signature; - public byte length; - public byte version; - public byte id_len; - public byte des_len; - public byte src_len; - public byte ext_ver; - // Follows extension identifier for id_len bytes - // Follows extension descriptor for des_len bytes - // Follows extension source for src_len bytes - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct SelectorArea - { - public ushort signature; - public byte length; - public byte version; - public byte sequence; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct PosixAttributes - { - public ushort signature; - public byte length; - public byte version; - public PosixMode st_mode; - public PosixMode st_mode_be; - public uint st_nlink; - public uint st_nlink_be; - public uint st_uid; - public uint st_uid_be; - public uint st_gid; - public uint st_gid_be; - public uint st_ino; - public uint st_ino_be; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct PosixDeviceNumber - { - public ushort signature; - public byte length; - public byte version; - public uint dev_t_high; - public uint dev_t_high_be; - public uint dev_t_low; - public uint dev_t_low_be; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct SymbolicLink - { - public ushort signature; - public byte length; - public byte version; - public SymlinkFlags flags; - // Followed by SymbolicLinkComponent (link to /bar/foo uses at least two of these structs) - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct SymbolicLinkComponent - { - public SymlinkComponentFlags flags; - public byte length; - // Followed by component content - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct AlternateName - { - public ushort signature; - public byte length; - public byte version; - public AlternateNameFlags flags; - // Folowed by name, can be divided in pieces - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct ChildLink - { - public ushort signature; - public byte length; - public byte version; - public uint child_dir_lba; - public uint child_dir_lba_be; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct ParentLink - { - public ushort signature; - public byte length; - public byte version; - public uint parent_dir_lba; - public uint parent_dir_lba_be; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct RelocatedDirectory - { - public ushort signature; - public byte length; - public byte version; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct Timestamps - { - public ushort signature; - public byte length; - public byte version; - public TimestampFlags flags; - // If flags indicate long format, timestamps are 17 bytes, if not, 7 bytes - // Followed by creation time if present - // Followed by modification time if present - // Followed by access time if present - // Followed by attribute change time if present - // Followed by backup time if present - // Followed by expiration time if present - // Followed by effective time if present - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct SparseFile - { - public ushort signature; - public byte length; - public byte version; - public uint virtual_size_high; - public uint virtual_size_high_be; - public uint virtual_size_low; - public uint virtual_size_low_be; - public byte table_depth; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct ZisofsHeader - { - public ulong magic; - public uint uncomp_len; - public uint uncomp_len_be; - public byte header_size; // Shifted >> 2 - public byte block_size_log; // log2(block_size) - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct ZisofsEntry - { - public ushort signature; - public byte length; - public byte version; - public ushort alogirhtm; - public byte header_size; // Shifted >> 2 - public byte block_size_log; // log2(block_size) - public uint uncomp_len; - public uint uncomp_len_be; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct AmigaEntry - { - public ushort signature; - public byte length; - public byte version; - public AmigaFlags flags; - // Followed by AmigaProtection if present - // Followed by length-prefixed string for comment if present - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - struct AmigaProtection - { - public byte User; - public byte Reserved; - public AmigaMultiuser Multiuser; - public AmigaAttributes Protection; - } - - struct DecodedVolumeDescriptor - { - public string SystemIdentifier; - public string VolumeIdentifier; - public string VolumeSetIdentifier; - public string PublisherIdentifier; - public string DataPreparerIdentifier; - public string ApplicationIdentifier; - public DateTime CreationTime; - public bool HasModificationTime; - public DateTime ModificationTime; - public bool HasExpirationTime; - public DateTime ExpirationTime; - public bool HasEffectiveTime; - public DateTime EffectiveTime; - public ushort BlockSize; - public uint Blocks; - } - - static DecodedVolumeDescriptor DecodeJolietDescriptor(PrimaryVolumeDescriptor jolietvd) - { - DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor(); - - decodedVD.SystemIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.system_id).TrimEnd().Trim(new[] { '\u0000' }); - decodedVD.VolumeIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.volume_id).TrimEnd().Trim(new[] { '\u0000' }); - decodedVD.VolumeSetIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.volume_set_id).TrimEnd().Trim(new[] { '\u0000' }); - decodedVD.PublisherIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.publisher_id).TrimEnd().Trim(new[] { '\u0000' }); - decodedVD.DataPreparerIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.preparer_id).TrimEnd().Trim(new[] { '\u0000' }); - decodedVD.ApplicationIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.application_id).TrimEnd().Trim(new[] { '\u0000' }); - if(jolietvd.creation_date[0] < 0x31 || jolietvd.creation_date[0] > 0x39) - decodedVD.CreationTime = DateTime.MinValue; - else - decodedVD.CreationTime = DateHandlers.ISO9660ToDateTime(jolietvd.creation_date); - - if(jolietvd.modification_date[0] < 0x31 || jolietvd.modification_date[0] > 0x39) - { - decodedVD.HasModificationTime = false; - } - else - { - decodedVD.HasModificationTime = true; - decodedVD.ModificationTime = DateHandlers.ISO9660ToDateTime(jolietvd.modification_date); - } - - if(jolietvd.expiration_date[0] < 0x31 || jolietvd.expiration_date[0] > 0x39) - { - decodedVD.HasExpirationTime = false; - } - else - { - decodedVD.HasExpirationTime = true; - decodedVD.ExpirationTime = DateHandlers.ISO9660ToDateTime(jolietvd.expiration_date); - } - - if(jolietvd.effective_date[0] < 0x31 || jolietvd.effective_date[0] > 0x39) - { - decodedVD.HasEffectiveTime = false; - } - else - { - decodedVD.HasEffectiveTime = true; - decodedVD.EffectiveTime = DateHandlers.ISO9660ToDateTime(jolietvd.effective_date); - } - - decodedVD.Blocks = jolietvd.volume_space_size; - decodedVD.BlockSize = jolietvd.logical_block_size; - - return decodedVD; - } - - static DecodedVolumeDescriptor DecodeVolumeDescriptor(PrimaryVolumeDescriptor pvd) - { - DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor(); - - decodedVD.SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.ApplicationIdentifier = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim(new[] { '\0' }); - if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00) - decodedVD.CreationTime = DateTime.MinValue; - else - decodedVD.CreationTime = DateHandlers.ISO9660ToDateTime(pvd.creation_date); - - if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00) - { - decodedVD.HasModificationTime = false; - } - else - { - decodedVD.HasModificationTime = true; - decodedVD.ModificationTime = DateHandlers.ISO9660ToDateTime(pvd.modification_date); - } - - if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) - { - decodedVD.HasExpirationTime = false; - } - else - { - decodedVD.HasExpirationTime = true; - decodedVD.ExpirationTime = DateHandlers.ISO9660ToDateTime(pvd.expiration_date); - } - - if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) - { - decodedVD.HasEffectiveTime = false; - } - else - { - decodedVD.HasEffectiveTime = true; - decodedVD.EffectiveTime = DateHandlers.ISO9660ToDateTime(pvd.effective_date); - } - - decodedVD.Blocks = pvd.volume_space_size; - decodedVD.BlockSize = pvd.logical_block_size; - - return decodedVD; - } - - static DecodedVolumeDescriptor DecodeVolumeDescriptor(HighSierraPrimaryVolumeDescriptor pvd) - { - DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor(); - - decodedVD.SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim(new[] { '\0' }); - decodedVD.ApplicationIdentifier = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim(new[] { '\0' }); - if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00) - decodedVD.CreationTime = DateTime.MinValue; - else - decodedVD.CreationTime = DateHandlers.HighSierraToDateTime(pvd.creation_date); - - if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00) - { - decodedVD.HasModificationTime = false; - } - else - { - decodedVD.HasModificationTime = true; - decodedVD.ModificationTime = DateHandlers.HighSierraToDateTime(pvd.modification_date); - } - - if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) - { - decodedVD.HasExpirationTime = false; - } - else - { - decodedVD.HasExpirationTime = true; - decodedVD.ExpirationTime = DateHandlers.HighSierraToDateTime(pvd.expiration_date); - } - - if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) - { - decodedVD.HasEffectiveTime = false; - } - else - { - decodedVD.HasEffectiveTime = true; - decodedVD.EffectiveTime = DateHandlers.HighSierraToDateTime(pvd.effective_date); - } - - decodedVD.Blocks = pvd.volume_space_size; - decodedVD.BlockSize = pvd.logical_block_size; - - return decodedVD; - } - } -} diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/Amiga.cs b/DiscImageChef.Filesystems/ISO9660/Structs/Amiga.cs new file mode 100644 index 000000000..eeb6b755e --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Structs/Amiga.cs @@ -0,0 +1,58 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : Amiga.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System.Runtime.InteropServices; + +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct AmigaEntry + { + public ushort signature; + public byte length; + public byte version; + public AmigaFlags flags; + // Followed by AmigaProtection if present + // Followed by length-prefixed string for comment if present + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct AmigaProtection + { + public byte User; + public byte Reserved; + public AmigaMultiuser Multiuser; + public AmigaAttributes Protection; + } + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/Apple.cs b/DiscImageChef.Filesystems/ISO9660/Structs/Apple.cs new file mode 100644 index 000000000..4c87fafbe --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Structs/Apple.cs @@ -0,0 +1,104 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : Apple.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System.Runtime.InteropServices; + +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + // Little-endian + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct AppleProDOSSystemUse + { + public ushort signature; + public byte length; + public AppleId id; + public byte type; + public ushort aux_type; + } + + // Big-endian + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct AppleHFSSystemUse + { + public ushort signature; + public byte length; + public AppleId id; + public ushort type; + public ushort creator; + public ushort finder_flags; + } + + // Little-endian + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct AppleProDOSOldSystemUse + { + public ushort signature; + public AppleOldId id; + public byte type; + public ushort aux_type; + } + + // Big-endian + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct AppleHFSTypeCreatorSystemUse + { + public ushort signature; + public AppleOldId id; + public ushort type; + public ushort creator; + } + + // Big-endian + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct AppleHFSIconSystemUse + { + public ushort signature; + public AppleOldId id; + public ushort type; + public ushort creator; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] icon; + } + + // Big-endian + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct AppleHFSOldSystemUse + { + public ushort signature; + public AppleOldId id; + public ushort type; + public ushort creator; + public ushort finder_flags; + } + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/Common.cs b/DiscImageChef.Filesystems/ISO9660/Structs/Common.cs new file mode 100644 index 000000000..f820ba7a7 --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Structs/Common.cs @@ -0,0 +1,57 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : Common.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System; + +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + struct DecodedVolumeDescriptor + { + public string SystemIdentifier; + public string VolumeIdentifier; + public string VolumeSetIdentifier; + public string PublisherIdentifier; + public string DataPreparerIdentifier; + public string ApplicationIdentifier; + public DateTime CreationTime; + public bool HasModificationTime; + public DateTime ModificationTime; + public bool HasExpirationTime; + public DateTime ExpirationTime; + public bool HasEffectiveTime; + public DateTime EffectiveTime; + public ushort BlockSize; + public uint Blocks; + } + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/ElTorito.cs b/DiscImageChef.Filesystems/ISO9660/Structs/ElTorito.cs new file mode 100644 index 000000000..4d390b865 --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Structs/ElTorito.cs @@ -0,0 +1,114 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : ElTorito.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System.Runtime.InteropServices; + +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct ElToritoBootRecord + { + public byte type; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public byte[] id; + public byte version; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] system_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] boot_id; + public uint catalog_sector; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1974)] + public byte[] boot_use; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct ElToritoValidationEntry + { + public ElToritoIndicator header_id; + public ElToritoPlatform platform_id; + public ushort reserved; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] + public byte[] developer_id; + public ushort checksum; + public ushort signature; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct ElToritoInitialEntry + { + public ElToritoIndicator bootable; + public ElToritoEmulation boot_type; + public ushort load_seg; + public byte system_type; + public byte reserved1; + public ushort sector_count; + public uint load_rba; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] + public byte[] reserved2; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct ElToritoSectionHeaderEntry + { + public ElToritoIndicator header_id; + public ElToritoPlatform platform_id; + public ushort entries; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] + public byte[] identifier; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct ElToritoSectionEntry + { + public ElToritoIndicator bootable; + public ElToritoEmulation boot_type; + public ushort load_seg; + public byte system_type; + public byte reserved1; + public ushort sector_count; + public uint load_rba; + public byte selection_criteria_type; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] + public byte[] selection_criterias; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct ElToritoSectionEntryExtension + { + public ElToritoIndicator extension_indicator; + public ElToritoFlags extension_flags; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 30)] + public byte[] selection_criterias; + } + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/HighSierra.cs b/DiscImageChef.Filesystems/ISO9660/Structs/HighSierra.cs new file mode 100644 index 000000000..15c5f63a4 --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Structs/HighSierra.cs @@ -0,0 +1,177 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : HighSierra.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System.Runtime.InteropServices; +using System.Text; + +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct HighSierraPrimaryVolumeDescriptor + { + public uint volume_lbn; + public uint volume_lbn_be; + public byte type; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public byte[] id; + public byte version; + // Only used in SVDs + public byte flags; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] system_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] volume_id; + public ulong reserved1; + public uint volume_space_size; + public uint volume_space_size_be; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] escape_sequences; + public ushort volume_set_size; + public ushort volume_set_size_be; + public ushort volume_sequence_number; + public ushort volume_sequence_number_be; + public ushort logical_block_size; + public ushort logical_block_size_be; + public uint path_table_size; + public uint path_table_size_be; + public uint manditory_path_table_lsb; + public uint opt_path_table_lsb_1; + public uint opt_path_table_lsb_2; + public uint opt_path_table_lsb_3; + public uint manditory_path_table_msb; + public uint opt_path_table_msb_1; + public uint opt_path_table_msb_2; + public uint opt_path_table_msb_3; + public HighSierraDirectoryRecord root_directory_record; + public byte root_directory_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] volume_set_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] publisher_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] preparer_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] application_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] copyright_file_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] abstract_file_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] creation_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] modification_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] expiration_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] effective_date; + public byte file_structure_version; + public byte reserved2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] + public byte[] application_data; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 680)] + public byte[] reserved3; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct HighSierraDirectoryRecord + { + public byte length; + public byte xattr_len; + public uint extent; + public uint extent_be; + public uint size; + public uint size_be; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] + public byte[] date; + public FileFlags flags; + public byte reserved; + public byte interleave_size; + public byte interleave; + public ushort volume_sequence_number; + public ushort volume_sequence_number_be; + public byte name_len; + // Followed by name[name_len] and then system area until length arrives + } + + static DecodedVolumeDescriptor DecodeVolumeDescriptor(HighSierraPrimaryVolumeDescriptor pvd) + { + DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor(); + + decodedVD.SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim(new[] { '\0' }); + decodedVD.VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim(new[] { '\0' }); + decodedVD.VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim(new[] { '\0' }); + decodedVD.PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim(new[] { '\0' }); + decodedVD.DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim(new[] { '\0' }); + decodedVD.ApplicationIdentifier = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim(new[] { '\0' }); + if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00) + decodedVD.CreationTime = System.DateTime.MinValue; + else + decodedVD.CreationTime = DateHandlers.HighSierraToDateTime(pvd.creation_date); + + if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00) + { + decodedVD.HasModificationTime = false; + } + else + { + decodedVD.HasModificationTime = true; + decodedVD.ModificationTime = DateHandlers.HighSierraToDateTime(pvd.modification_date); + } + + if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) + { + decodedVD.HasExpirationTime = false; + } + else + { + decodedVD.HasExpirationTime = true; + decodedVD.ExpirationTime = DateHandlers.HighSierraToDateTime(pvd.expiration_date); + } + + if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) + { + decodedVD.HasEffectiveTime = false; + } + else + { + decodedVD.HasEffectiveTime = true; + decodedVD.EffectiveTime = DateHandlers.HighSierraToDateTime(pvd.effective_date); + } + + decodedVD.Blocks = pvd.volume_space_size; + decodedVD.BlockSize = pvd.logical_block_size; + + return decodedVD; + } + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/ISO.cs b/DiscImageChef.Filesystems/ISO9660/Structs/ISO.cs new file mode 100644 index 000000000..4e461e13d --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Structs/ISO.cs @@ -0,0 +1,240 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : ISO.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System.Runtime.InteropServices; +using System.Text; + +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct PrimaryVolumeDescriptor + { + public byte type; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public byte[] id; + public byte version; + // Only used in SVDs + public byte flags; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] system_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] volume_id; + public ulong reserved1; + public uint volume_space_size; + public uint volume_space_size_be; + // Only used in SVDs + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] escape_sequences; + public ushort volume_set_size; + public ushort volume_set_size_be; + public ushort volume_sequence_number; + public ushort volume_sequence_number_be; + public ushort logical_block_size; + public ushort logical_block_size_be; + public uint path_table_size; + public uint path_table_size_be; + public uint type_1_path_table; + public uint opt_type_1_path_table; + public uint type_m_path_table; + public uint opt_type_m_path_table; + public DirectoryRecord root_directory_record; + public byte root_directory_name; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] volume_set_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] publisher_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] preparer_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] application_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)] + public byte[] copyright_file_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)] + public byte[] abstract_file_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)] + public byte[] bibliographic_file_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] + public byte[] creation_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] + public byte[] modification_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] + public byte[] expiration_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] + public byte[] effective_date; + public byte file_structure_version; + public byte reserved2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] + public byte[] application_data; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 653)] + public byte[] reserved3; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct BootRecord + { + public byte type; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public byte[] id; + public byte version; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] system_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] boot_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1977)] + public byte[] boot_use; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct PartitionDescriptor + { + public byte type; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public byte[] id; + public byte version; + public byte reserved1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] system_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] partition_id; + public uint partition_location; + public uint partition_location_be; + public uint partition_size; + public uint partition_size_be; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1960)] + public byte[] system_use; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct DirectoryRecord + { + public byte length; + public byte xattr_len; + public uint extent; + public uint extent_be; + public uint size; + public uint size_be; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] + public byte[] date; + public FileFlags flags; + public byte file_unit_size; + public byte interleave; + public ushort volume_sequence_number; + public ushort volume_sequence_number_be; + public byte name_len; + // Followed by name[name_len] and then system area until length arrives + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct ExtendedAttributeRecord + { + public ushort owner; + public ushort owner_be; + public ushort group; + public ushort group_be; + public Permissions permissions; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] + public byte[] creation_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] + public byte[] modification_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] + public byte[] expiration_date; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] + public byte[] effective_date; + public RecordFormat record_format; + public RecordAttribute record_attributes; + public ushort record_length; + public ushort record_length_be; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] system_id; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] system_use; + public byte record_version; + public byte escape_len; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] reserved1; + public ushort app_use_len; + public ushort app_use_len_be; + } + + static DecodedVolumeDescriptor DecodeVolumeDescriptor(PrimaryVolumeDescriptor pvd) + { + DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor(); + + decodedVD.SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim(new[] { '\0' }); + decodedVD.VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim(new[] { '\0' }); + decodedVD.VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim(new[] { '\0' }); + decodedVD.PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim(new[] { '\0' }); + decodedVD.DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim(new[] { '\0' }); + decodedVD.ApplicationIdentifier = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim(new[] { '\0' }); + if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00) + decodedVD.CreationTime = System.DateTime.MinValue; + else + decodedVD.CreationTime = DateHandlers.ISO9660ToDateTime(pvd.creation_date); + + if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00) + { + decodedVD.HasModificationTime = false; + } + else + { + decodedVD.HasModificationTime = true; + decodedVD.ModificationTime = DateHandlers.ISO9660ToDateTime(pvd.modification_date); + } + + if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) + { + decodedVD.HasExpirationTime = false; + } + else + { + decodedVD.HasExpirationTime = true; + decodedVD.ExpirationTime = DateHandlers.ISO9660ToDateTime(pvd.expiration_date); + } + + if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) + { + decodedVD.HasEffectiveTime = false; + } + else + { + decodedVD.HasEffectiveTime = true; + decodedVD.EffectiveTime = DateHandlers.ISO9660ToDateTime(pvd.effective_date); + } + + decodedVD.Blocks = pvd.volume_space_size; + decodedVD.BlockSize = pvd.logical_block_size; + + return decodedVD; + } + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/Joliet.cs b/DiscImageChef.Filesystems/ISO9660/Structs/Joliet.cs new file mode 100644 index 000000000..d77977feb --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Structs/Joliet.cs @@ -0,0 +1,89 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : Joliet.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System.Text; + +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + static DecodedVolumeDescriptor DecodeJolietDescriptor(PrimaryVolumeDescriptor jolietvd) + { + DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor(); + + decodedVD.SystemIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.system_id).TrimEnd().Trim(new[] { '\u0000' }); + decodedVD.VolumeIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.volume_id).TrimEnd().Trim(new[] { '\u0000' }); + decodedVD.VolumeSetIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.volume_set_id).TrimEnd().Trim(new[] { '\u0000' }); + decodedVD.PublisherIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.publisher_id).TrimEnd().Trim(new[] { '\u0000' }); + decodedVD.DataPreparerIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.preparer_id).TrimEnd().Trim(new[] { '\u0000' }); + decodedVD.ApplicationIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.application_id).TrimEnd().Trim(new[] { '\u0000' }); + if(jolietvd.creation_date[0] < 0x31 || jolietvd.creation_date[0] > 0x39) + decodedVD.CreationTime = System.DateTime.MinValue; + else + decodedVD.CreationTime = DateHandlers.ISO9660ToDateTime(jolietvd.creation_date); + + if(jolietvd.modification_date[0] < 0x31 || jolietvd.modification_date[0] > 0x39) + { + decodedVD.HasModificationTime = false; + } + else + { + decodedVD.HasModificationTime = true; + decodedVD.ModificationTime = DateHandlers.ISO9660ToDateTime(jolietvd.modification_date); + } + + if(jolietvd.expiration_date[0] < 0x31 || jolietvd.expiration_date[0] > 0x39) + { + decodedVD.HasExpirationTime = false; + } + else + { + decodedVD.HasExpirationTime = true; + decodedVD.ExpirationTime = DateHandlers.ISO9660ToDateTime(jolietvd.expiration_date); + } + + if(jolietvd.effective_date[0] < 0x31 || jolietvd.effective_date[0] > 0x39) + { + decodedVD.HasEffectiveTime = false; + } + else + { + decodedVD.HasEffectiveTime = true; + decodedVD.EffectiveTime = DateHandlers.ISO9660ToDateTime(jolietvd.effective_date); + } + + decodedVD.Blocks = jolietvd.volume_space_size; + decodedVD.BlockSize = jolietvd.logical_block_size; + + return decodedVD; + } + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/RRIP.cs b/DiscImageChef.Filesystems/ISO9660/Structs/RRIP.cs new file mode 100644 index 000000000..374b6165c --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Structs/RRIP.cs @@ -0,0 +1,154 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : RRIP.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System.Runtime.InteropServices; + +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct PosixAttributes + { + public ushort signature; + public byte length; + public byte version; + public PosixMode st_mode; + public PosixMode st_mode_be; + public uint st_nlink; + public uint st_nlink_be; + public uint st_uid; + public uint st_uid_be; + public uint st_gid; + public uint st_gid_be; + public uint st_ino; + public uint st_ino_be; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct PosixDeviceNumber + { + public ushort signature; + public byte length; + public byte version; + public uint dev_t_high; + public uint dev_t_high_be; + public uint dev_t_low; + public uint dev_t_low_be; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct SymbolicLink + { + public ushort signature; + public byte length; + public byte version; + public SymlinkFlags flags; + // Followed by SymbolicLinkComponent (link to /bar/foo uses at least two of these structs) + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct SymbolicLinkComponent + { + public SymlinkComponentFlags flags; + public byte length; + // Followed by component content + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct AlternateName + { + public ushort signature; + public byte length; + public byte version; + public AlternateNameFlags flags; + // Folowed by name, can be divided in pieces + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct ChildLink + { + public ushort signature; + public byte length; + public byte version; + public uint child_dir_lba; + public uint child_dir_lba_be; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct ParentLink + { + public ushort signature; + public byte length; + public byte version; + public uint parent_dir_lba; + public uint parent_dir_lba_be; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct RelocatedDirectory + { + public ushort signature; + public byte length; + public byte version; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct Timestamps + { + public ushort signature; + public byte length; + public byte version; + public TimestampFlags flags; + // If flags indicate long format, timestamps are 17 bytes, if not, 7 bytes + // Followed by creation time if present + // Followed by modification time if present + // Followed by access time if present + // Followed by attribute change time if present + // Followed by backup time if present + // Followed by expiration time if present + // Followed by effective time if present + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct SparseFile + { + public ushort signature; + public byte length; + public byte version; + public uint virtual_size_high; + public uint virtual_size_high_be; + public uint virtual_size_low; + public uint virtual_size_low_be; + public byte table_depth; + } + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/SUSP.cs b/DiscImageChef.Filesystems/ISO9660/Structs/SUSP.cs new file mode 100644 index 000000000..2ba1baf86 --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Structs/SUSP.cs @@ -0,0 +1,102 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : SUSP.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System.Runtime.InteropServices; + +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct ContinuationArea + { + public ushort signature; + public byte length; + public byte version; + public uint block; + public uint block_be; + public uint offset; + public uint offset_be; + public uint ca_length; + public uint ca_length_be; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct PaddingArea + { + public ushort signature; + public byte length; + public byte version; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct IndicatorArea + { + public ushort signature; + public byte length; + public byte version; + public ushort magic; + public byte skipped; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct TerminatorArea + { + public ushort signature; + public byte length; + public byte version; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct ReferenceArea + { + public ushort signature; + public byte length; + public byte version; + public byte id_len; + public byte des_len; + public byte src_len; + public byte ext_ver; + // Follows extension identifier for id_len bytes + // Follows extension descriptor for des_len bytes + // Follows extension source for src_len bytes + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct SelectorArea + { + public ushort signature; + public byte length; + public byte version; + public byte sequence; + } + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/XA.cs b/DiscImageChef.Filesystems/ISO9660/Structs/XA.cs new file mode 100644 index 000000000..568151c67 --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Structs/XA.cs @@ -0,0 +1,51 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : XA.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System.Runtime.InteropServices; + +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + // Big-endian + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct CdromXa + { + public ushort group; + public ushort user; + public XaAttributes attributes; + public ushort signature; + public byte filenumber; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public byte[] reserved; + } + } +} diff --git a/DiscImageChef.Filesystems/ISO9660/Structs/Ziso.cs b/DiscImageChef.Filesystems/ISO9660/Structs/Ziso.cs new file mode 100644 index 000000000..f87d536c9 --- /dev/null +++ b/DiscImageChef.Filesystems/ISO9660/Structs/Ziso.cs @@ -0,0 +1,61 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : Ziso.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System.Runtime.InteropServices; + +namespace DiscImageChef.Filesystems.ISO9660 +{ + public partial class ISO9660 : Filesystem + { + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct ZisofsHeader + { + public ulong magic; + public uint uncomp_len; + public uint uncomp_len_be; + public byte header_size; // Shifted >> 2 + public byte block_size_log; // log2(block_size) + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct ZisofsEntry + { + public ushort signature; + public byte length; + public byte version; + public ushort alogirhtm; + public byte header_size; // Shifted >> 2 + public byte block_size_log; // log2(block_size) + public uint uncomp_len; + public uint uncomp_len_be; + } + } +}