// /*************************************************************************** // The Disc Image Chef // ---------------------------------------------------------------------------- // // Filename : AppleHFS.cs // Author(s) : Natalia Portillo // // Component : Apple Hierarchical File System plugin. // // --[ Description ] ---------------------------------------------------------- // // Identifies the Apple Hierarchical File System and shows information. // // --[ 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-2020 Natalia Portillo // ****************************************************************************/ using System.Runtime.InteropServices; namespace Aaru.Filesystems { // Information from Inside Macintosh // https://developer.apple.com/legacy/library/documentation/mac/pdf/Files/File_Manager.pdf internal static partial class AppleCommon { /// Should be sectors 0 and 1 in volume, followed by boot code [StructLayout(LayoutKind.Sequential, Pack = 1)] struct BootBlock // Should be sectors 0 and 1 in volume { /// 0x000, Signature, 0x4C4B if bootable public readonly ushort bbID; /// 0x002, Branch public readonly uint bbEntry; /// 0x007, Boot block version and flags public readonly ushort bbVersion; /// 0x006, Boot block page flags public readonly short bbPageFlags; /// 0x00A, System file name (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public readonly byte[] bbSysName; /// 0x01A, Finder file name (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public readonly byte[] bbShellName; /// 0x02A, Debugger file name (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public readonly byte[] bbDbg1Name; /// 0x03A, Disassembler file name (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public readonly byte[] bbDbg2Name; /// 0x04A, Startup screen file name (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public readonly byte[] bbScreenName; /// 0x05A, First program to execute on boot (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public readonly byte[] bbHelloName; /// 0x06A, Clipboard file name (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public readonly byte[] bbScrapName; /// 0x07A, 1/4 of maximum opened at a time files public readonly ushort bbCntFCBs; /// 0x07C, Event queue size public readonly ushort bbCntEvts; /// 0x07E, Heap size on a Mac with 128KiB of RAM public readonly uint bb128KSHeap; /// 0x082, Heap size on a Mac with 256KiB of RAM public readonly uint bb256KSHeap; /// 0x086, Heap size on a Mac with 512KiB of RAM or more public readonly uint bbSysHeapSize; /// 0x08A, Padding public readonly ushort filler; /// 0x08C, Additional system heap space public readonly uint bbSysHeapExtra; /// 0x090, Fraction of RAM for system heap public readonly uint bbSysHeapFract; } internal struct Rect { public ushort top; public ushort left; public ushort bottom; public ushort right; } internal struct Point { public ushort v; public ushort h; } internal struct FInfo { /// The type of the file. public uint fdType; /// The file's creator. public uint fdCreator; /// Flags. public FinderFlags fdFlags; /// File's location in the folder. public Point fdLocation; /// Folder file belongs to (used only in flat filesystems like MFS). public FinderFolder fdFldr; } internal struct FXInfo { /// Resource fork ID of file icon. public ushort fdIconID; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] fdUnused; /// Extended flags. If high-bit is set, most significant byte is script code and least significant byte are flags. public ExtendedFinderFlags fdXFlags; /// Resource fork ID of directory comment if high bit is clear. public ushort fdComment; /// Put away folder ID. public uint fdPutAway; } internal struct DInfo { /// Position and dimensions of the folder's window. public Rect frRect; /// Flags. public FinderFlags frFlags; /// Folder's location in the parent folder. public Point frLocation; /// Finder view selected for folder. public ushort frView; } internal struct DXInfo { /// Scroll position for icon views. public Point frScroll; /// Directory ID chain of open folders. public uint frOpenChain; /// Extended flags. If high-bit is set, most significant byte is script code and least significant byte are flags. public ExtendedFinderFlags frXFlags; /// Resource fork ID of directory comment if high bit is clear. public ushort frComment; /// Put away folder ID. public uint frPutAway; } } }