2017-05-19 20:28:49 +01:00
|
|
|
// /***************************************************************************
|
2020-02-27 12:31:25 +00:00
|
|
|
// Aaru Data Preservation Suite
|
2016-08-01 00:41:02 +01:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Filename : Structs.cs
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
//
|
|
|
|
|
// Component : Apple Macintosh File System plugin.
|
|
|
|
|
//
|
|
|
|
|
// --[ 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/>.
|
|
|
|
|
//
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2022-12-03 16:07:10 +00:00
|
|
|
// Copyright © 2011-2023 Natalia Portillo
|
2016-08-01 00:41:02 +01:00
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Diagnostics.CodeAnalysis;
|
2022-12-19 00:26:55 +00:00
|
|
|
using Aaru.CommonTypes.Interfaces;
|
2022-11-15 15:58:43 +00:00
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
#pragma warning disable 169
|
2016-08-01 01:22:40 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
namespace Aaru.Filesystems;
|
|
|
|
|
|
|
|
|
|
// Information from Inside Macintosh Volume II
|
2023-10-03 23:22:08 +01:00
|
|
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
|
|
|
|
[SuppressMessage("ReSharper", "NotAccessedField.Local")]
|
2022-03-06 13:29:38 +00:00
|
|
|
public sealed partial class AppleMFS
|
2016-08-01 00:41:02 +01:00
|
|
|
{
|
2023-10-03 23:22:08 +01:00
|
|
|
#region Nested type: AppleMfsDirNode
|
|
|
|
|
|
|
|
|
|
sealed class AppleMfsDirNode : IDirNode
|
2016-08-01 00:41:02 +01:00
|
|
|
{
|
2023-10-03 23:22:08 +01:00
|
|
|
internal string[] _contents;
|
|
|
|
|
internal int _position;
|
|
|
|
|
|
|
|
|
|
#region IDirNode Members
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public string Path { get; init; }
|
|
|
|
|
|
|
|
|
|
#endregion
|
2022-03-06 13:29:38 +00:00
|
|
|
}
|
2016-08-01 00:41:02 +01:00
|
|
|
|
2023-10-03 23:22:08 +01:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Nested type: AppleMfsFileNode
|
|
|
|
|
|
|
|
|
|
sealed class AppleMfsFileNode : IFileNode
|
2022-03-06 13:29:38 +00:00
|
|
|
{
|
2023-10-03 23:22:08 +01:00
|
|
|
internal byte[] _cache;
|
|
|
|
|
|
|
|
|
|
#region IFileNode Members
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public string Path { get; init; }
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public long Length { get; init; }
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public long Offset { get; set; }
|
|
|
|
|
|
|
|
|
|
#endregion
|
2022-03-06 13:29:38 +00:00
|
|
|
}
|
2016-08-01 01:22:40 +01:00
|
|
|
|
2023-10-03 23:22:08 +01:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Nested type: FileEntry
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
struct FileEntry
|
|
|
|
|
{
|
|
|
|
|
/// <summary>0x00, Entry flags</summary>
|
|
|
|
|
public FileFlags flFlags;
|
|
|
|
|
/// <summary>0x01, Version number</summary>
|
|
|
|
|
public byte flTyp;
|
|
|
|
|
/// <summary>0x02, FinderInfo</summary>
|
|
|
|
|
public AppleCommon.FInfo flUsrWds;
|
|
|
|
|
/// <summary>0x12, file ID</summary>
|
|
|
|
|
public uint flFlNum;
|
|
|
|
|
/// <summary>0x16, first allocation block of data fork</summary>
|
|
|
|
|
public ushort flStBlk;
|
|
|
|
|
/// <summary>0x18, logical end-of-file of data fork</summary>
|
|
|
|
|
public uint flLgLen;
|
|
|
|
|
/// <summary>0x1C, physical end-of-file of data fork</summary>
|
|
|
|
|
public uint flPyLen;
|
|
|
|
|
/// <summary>0x20, first allocation block of resource fork</summary>
|
|
|
|
|
public ushort flRStBlk;
|
|
|
|
|
/// <summary>0x22, logical end-of-file of resource fork</summary>
|
|
|
|
|
public uint flRLgLen;
|
|
|
|
|
/// <summary>0x26, physical end-of-file of resource fork</summary>
|
|
|
|
|
public uint flRPyLen;
|
|
|
|
|
/// <summary>0x2A, date and time of creation</summary>
|
|
|
|
|
public uint flCrDat;
|
|
|
|
|
/// <summary>0x2E, date and time of last modification</summary>
|
|
|
|
|
public uint flMdDat;
|
|
|
|
|
/// <summary>0x32, file name prefixed with length</summary>
|
|
|
|
|
public byte[] flNam;
|
2016-08-01 00:41:02 +01:00
|
|
|
}
|
2022-12-19 00:26:55 +00:00
|
|
|
|
2023-10-03 23:22:08 +01:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Nested type: FileFlags
|
|
|
|
|
|
|
|
|
|
[Flags]
|
|
|
|
|
enum FileFlags : byte
|
2022-12-19 00:26:55 +00:00
|
|
|
{
|
2023-10-03 23:22:08 +01:00
|
|
|
Locked = 0x01,
|
|
|
|
|
Used = 0x80
|
2022-12-19 00:26:55 +00:00
|
|
|
}
|
2022-12-21 19:10:51 +00:00
|
|
|
|
2023-10-03 23:22:08 +01:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Nested type: MasterDirectoryBlock
|
|
|
|
|
|
|
|
|
|
/// <summary>Master Directory Block, should be at offset 0x0400 bytes in volume</summary>
|
|
|
|
|
struct MasterDirectoryBlock
|
2022-12-21 19:10:51 +00:00
|
|
|
{
|
2023-10-03 23:22:08 +01:00
|
|
|
/// <summary>0x000, Signature, 0xD2D7</summary>
|
|
|
|
|
public ushort drSigWord;
|
|
|
|
|
/// <summary>0x002, Volume creation date</summary>
|
|
|
|
|
public uint drCrDate;
|
|
|
|
|
/// <summary>0x006, Volume last backup date</summary>
|
|
|
|
|
public uint drLsBkUp;
|
|
|
|
|
/// <summary>0x00A, Volume attributes</summary>
|
|
|
|
|
public AppleCommon.VolumeAttributes drAtrb;
|
|
|
|
|
/// <summary>0x00C, Volume number of files</summary>
|
|
|
|
|
public ushort drNmFls;
|
|
|
|
|
/// <summary>0x00E, First directory sector</summary>
|
|
|
|
|
public ushort drDirSt;
|
|
|
|
|
/// <summary>0x010, Length of directory in sectors</summary>
|
|
|
|
|
public ushort drBlLen;
|
|
|
|
|
/// <summary>0x012, Volume allocation blocks</summary>
|
|
|
|
|
public ushort drNmAlBlks;
|
|
|
|
|
/// <summary>0x014, Size of allocation blocks</summary>
|
|
|
|
|
public uint drAlBlkSiz;
|
|
|
|
|
/// <summary>0x018, Number of bytes to allocate</summary>
|
|
|
|
|
public uint drClpSiz;
|
|
|
|
|
/// <summary>0x01C, First allocation block in block map</summary>
|
|
|
|
|
public ushort drAlBlSt;
|
|
|
|
|
/// <summary>0x01E. Next unused file number</summary>
|
|
|
|
|
public uint drNxtFNum;
|
|
|
|
|
/// <summary>0x022, Number of unused allocation blocks</summary>
|
|
|
|
|
public ushort drFreeBks;
|
|
|
|
|
/// <summary>0x024, Length of volume name</summary>
|
|
|
|
|
public byte drVNSiz;
|
|
|
|
|
/// <summary>0x025, Characters of volume name</summary>
|
|
|
|
|
public string drVN;
|
2022-12-21 19:10:51 +00:00
|
|
|
}
|
2023-10-03 23:22:08 +01:00
|
|
|
|
|
|
|
|
#endregion
|
2017-12-19 20:33:03 +00:00
|
|
|
}
|