// /*************************************************************************** // Aaru Data Preservation Suite // ---------------------------------------------------------------------------- // // 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-2025 Natalia Portillo // ****************************************************************************/ using System; using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; namespace Aaru.Images; [SuppressMessage("ReSharper", "UnusedType.Local")] public sealed partial class Ndif { #region Nested type: BlockChunk [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; } #endregion #region Nested type: ChunkHeader [StructLayout(LayoutKind.Sequential, Pack = 1)] readonly struct ChunkHeader { /// Version public readonly short version; /// Filesystem ID public readonly short driver; /// Disk image name, Str63 (Pascal string) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public readonly byte[] name; /// Sectors in image public readonly uint sectors; /// Maximum number of sectors per chunk public readonly uint maxSectorsPerChunk; /// Offset to add to every chunk offset public readonly uint dataOffset; /// CRC28 of whole image public readonly uint crc; /// Set to 1 if segmented public readonly uint segmented; /// Unknown public readonly uint p1; /// Unknown public readonly uint p2; /// Unknown, spare? [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public readonly uint[] unknown; /// Set to 1 by ShrinkWrap if image is encrypted public readonly uint encrypted; /// Set by ShrinkWrap if image is encrypted, value is the same for same password public readonly uint hash; /// How many chunks follow the header public readonly uint chunks; } #endregion #region Nested type: SegmentHeader [StructLayout(LayoutKind.Sequential, Pack = 1)] readonly struct SegmentHeader { /// Segment # public readonly ushort segment; /// How many segments public readonly ushort segments; /// Seems to be a Guid, changes with different images, same for all segments of same image public readonly Guid segmentId; /// Seems to be a CRC28 of this segment, unchecked public readonly uint crc; } #endregion }