2018-07-23 23:25:43 +01:00
|
|
|
|
// /***************************************************************************
|
2020-02-27 12:31:25 +00:00
|
|
|
|
// Aaru Data Preservation Suite
|
2018-07-23 23:25:43 +01:00
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : Structs.cs
|
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
|
|
|
|
|
// 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 <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2024-05-01 04:17:32 +01:00
|
|
|
|
// Copyright © 2011-2024 Natalia Portillo
|
2018-07-23 23:25:43 +01:00
|
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
2020-07-20 07:47:12 +01:00
|
|
|
|
using System.Diagnostics.CodeAnalysis;
|
2018-07-23 23:25:43 +01:00
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
2023-10-06 01:16:28 +01:00
|
|
|
|
namespace Aaru.Images;
|
2022-11-15 15:58:43 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
[SuppressMessage("ReSharper", "UnusedType.Local")]
|
|
|
|
|
|
public sealed partial class Ndif
|
2018-07-23 23:25:43 +01:00
|
|
|
|
{
|
2023-10-03 23:34:59 +01:00
|
|
|
|
#region Nested type: BlockChunk
|
|
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
|
|
|
|
struct BlockChunk
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>Starting sector, 3 bytes</summary>
|
|
|
|
|
|
public uint sector;
|
|
|
|
|
|
/// <summary>Chunk type</summary>
|
|
|
|
|
|
public byte type;
|
|
|
|
|
|
/// <summary>Offset in start of chunk</summary>
|
|
|
|
|
|
public uint offset;
|
|
|
|
|
|
/// <summary>Length in bytes of chunk</summary>
|
|
|
|
|
|
public uint length;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Nested type: ChunkHeader
|
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
|
|
|
|
readonly struct ChunkHeader
|
2018-07-23 23:25:43 +01:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
/// <summary>Version</summary>
|
|
|
|
|
|
public readonly short version;
|
|
|
|
|
|
/// <summary>Filesystem ID</summary>
|
|
|
|
|
|
public readonly short driver;
|
|
|
|
|
|
/// <summary>Disk image name, Str63 (Pascal string)</summary>
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
|
|
|
|
|
|
public readonly byte[] name;
|
|
|
|
|
|
/// <summary>Sectors in image</summary>
|
|
|
|
|
|
public readonly uint sectors;
|
|
|
|
|
|
/// <summary>Maximum number of sectors per chunk</summary>
|
|
|
|
|
|
public readonly uint maxSectorsPerChunk;
|
|
|
|
|
|
/// <summary>Offset to add to every chunk offset</summary>
|
|
|
|
|
|
public readonly uint dataOffset;
|
|
|
|
|
|
/// <summary>CRC28 of whole image</summary>
|
|
|
|
|
|
public readonly uint crc;
|
|
|
|
|
|
/// <summary>Set to 1 if segmented</summary>
|
|
|
|
|
|
public readonly uint segmented;
|
|
|
|
|
|
/// <summary>Unknown</summary>
|
|
|
|
|
|
public readonly uint p1;
|
|
|
|
|
|
/// <summary>Unknown</summary>
|
|
|
|
|
|
public readonly uint p2;
|
|
|
|
|
|
/// <summary>Unknown, spare?</summary>
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
|
|
|
|
|
|
public readonly uint[] unknown;
|
|
|
|
|
|
/// <summary>Set to 1 by ShrinkWrap if image is encrypted</summary>
|
|
|
|
|
|
public readonly uint encrypted;
|
|
|
|
|
|
/// <summary>Set by ShrinkWrap if image is encrypted, value is the same for same password</summary>
|
|
|
|
|
|
public readonly uint hash;
|
|
|
|
|
|
/// <summary>How many chunks follow the header</summary>
|
|
|
|
|
|
public readonly uint chunks;
|
|
|
|
|
|
}
|
2018-07-23 23:25:43 +01:00
|
|
|
|
|
2023-10-03 23:34:59 +01:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Nested type: SegmentHeader
|
2018-07-23 23:25:43 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
|
|
|
|
readonly struct SegmentHeader
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>Segment #</summary>
|
|
|
|
|
|
public readonly ushort segment;
|
|
|
|
|
|
/// <summary>How many segments</summary>
|
|
|
|
|
|
public readonly ushort segments;
|
|
|
|
|
|
/// <summary>Seems to be a Guid, changes with different images, same for all segments of same image</summary>
|
|
|
|
|
|
public readonly Guid segmentId;
|
|
|
|
|
|
/// <summary>Seems to be a CRC28 of this segment, unchecked</summary>
|
|
|
|
|
|
public readonly uint crc;
|
2018-07-23 23:25:43 +01:00
|
|
|
|
}
|
2023-10-03 23:34:59 +01:00
|
|
|
|
|
|
|
|
|
|
#endregion
|
2018-07-23 23:25:43 +01:00
|
|
|
|
}
|