// /*************************************************************************** // The Disc Image Chef // ---------------------------------------------------------------------------- // // Filename : Structs.cs // Author(s) : Natalia Portillo // // Component : Disk image plugins. // // --[ Description ] ---------------------------------------------------------- // // Contains structures for Apple New Disk Image Format. // // --[ 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-2018 Natalia Portillo // ****************************************************************************/ using System; using System.Runtime.InteropServices; namespace DiscImageChef.DiscImages { public partial class Ndif { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ChunkHeader { /// /// Version /// public short version; /// /// Filesystem ID /// public short driver; /// /// Disk image name, Str63 (Pascal string) /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] name; /// /// Sectors in image /// public uint sectors; /// /// Maximum number of sectors per chunk /// public uint maxSectorsPerChunk; /// /// Offset to add to every chunk offset /// public uint dataOffset; /// /// CRC28 of whole image /// public uint crc; /// /// Set to 1 if segmented /// public uint segmented; /// /// Unknown /// public uint p1; /// /// Unknown /// public uint p2; /// /// Unknown, spare? /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public uint[] unknown; /// /// Set to 1 by ShrinkWrap if image is encrypted /// public uint encrypted; /// /// Set by ShrinkWrap if image is encrypted, value is the same for same password /// public uint hash; /// /// How many chunks follow the header /// public uint chunks; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct BlockChunk { /// /// Starting sector, 3 bytes /// public uint sector; /// /// Chunk type /// public byte type; /// /// Offset in start of chunk /// public uint offset; /// /// Length in bytes of chunk /// public uint length; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SegmentHeader { /// /// Segment # /// public ushort segment; /// /// How many segments /// public ushort segments; /// /// Seems to be a Guid, changes with different images, same for all segments of same image /// public Guid segmentId; /// /// Seems to be a CRC28 of this segment, unchecked /// public uint crc; } } }