// /*************************************************************************** // The Disc Image Chef // ---------------------------------------------------------------------------- // // Filename : Structs.cs // Author(s) : Natalia Portillo // // Component : Apple Macintosh File System plugin. // // --[ Description ] ---------------------------------------------------------- // // Apple Macintosh File System structures. // // --[ 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-2016 Natalia Portillo // ****************************************************************************/ using System; namespace DiscImageChef.Filesystems.AppleMFS { // Information from Inside Macintosh Volume II partial class AppleMFS : Filesystem { /// /// Master Directory Block, should be at offset 0x0400 bytes in volume /// struct MFS_MasterDirectoryBlock { /// 0x000, Signature, 0xD2D7 public ushort drSigWord; /// 0x002, Volume creation date public uint drCrDate; /// 0x006, Volume last backup date public uint drLsBkUp; /// 0x00A, Volume attributes public ushort drAtrb; /// 0x00C, Volume number of files public ushort drNmFls; /// 0x00E, First directory block public ushort drDirSt; /// 0x010, Length of directory in blocks public ushort drBlLen; /// 0x012, Volume allocation blocks public ushort drNmAlBlks; /// 0x014, Size of allocation blocks public uint drAlBlkSiz; /// 0x018, Number of bytes to allocate public uint drClpSiz; /// 0x01C, First allocation block in block map public ushort drAlBlSt; /// 0x01E. Next unused file number public uint drNxtFNum; /// 0x022, Number of unused allocation blocks public ushort drFreeBks; /// 0x024, Length of volume name public byte drVNSiz; /// 0x025, Characters of volume name public string drVN; } /// /// Should be at offset 0x0000 in volume, followed by boot code /// struct MFS_BootBlock { /// 0x000, Signature, 0x4C4B if bootable public ushort signature; /// 0x002, Branch public uint branch; /// 0x006, Boot block flags public byte boot_flags; /// 0x007, Boot block version public byte boot_version; /// 0x008, Allocate secondary buffers public short sec_sv_pages; /// 0x00A, System file name (16 bytes) public string system_name; /// 0x01A, Finder file name (16 bytes) public string finder_name; /// 0x02A, Debugger file name (16 bytes) public string debug_name; /// 0x03A, Disassembler file name (16 bytes) public string disasm_name; /// 0x04A, Startup screen file name (16 bytes) public string stupscr_name; /// 0x05A, First program to execute on boot (16 bytes) public string bootup_name; /// 0x06A, Clipboard file name (16 bytes) public string clipbrd_name; /// 0x07A, 1/4 of maximum opened at a time files public ushort max_files; /// 0x07C, Event queue size public ushort queue_size; /// 0x07E, Heap size on a Mac with 128KiB of RAM public uint heap_128k; /// 0x082, Heap size on a Mac with 256KiB of RAM public uint heap_256k; /// 0x086, Heap size on a Mac with 512KiB of RAM or more public uint heap_512k; } [Flags] enum MFS_FileFlags : byte { Locked = 0x01, Used = 0x80 } [Flags] enum MFS_FinderFlags : ushort { kIsOnDesk = 0x0001, kColor = 0x000E, kRequireSwitchLaunch = 0x0020, kIsShared = 0x0040, kHasNoINITs = 0x0080, kHasBeenInited = 0x0100, kHasCustomIcon = 0x0400, kLetter = 0x0200, kChanged = 0x0200, kIsStationery = 0x0800, kNameLocked = 0x1000, kHasBundle = 0x2000, kIsInvisible = 0x4000, kIsAlias = 0x8000 } struct MFS_Point { public short x; public short y; } struct MFS_FinderInfo { public uint fdType; public uint fdCreator; public MFS_FinderFlags fdFlags; public MFS_Point fdLocation; public short fdFldr; } struct MFS_FileEntry { /// 0x00, Entry flags public MFS_FileFlags flFlags; /// 0x01, Version number public byte flTyp; /// 0x02, FinderInfo public byte[] flUsrWds; /// 0x12, file ID public uint flFlNum; /// 0x16, first allocation block of data fork public ushort flStBlk; /// 0x18, logical end-of-file of data fork public uint flLgLen; /// 0x1C, physical end-of-file of data fork public uint flPyLen; /// 0x20, first allocation block of resource fork public ushort flRStBlk; /// 0x22, logical end-of-file of resource fork public uint flRLgLen; /// 0x26, physical end-of-file of resource fork public uint flRPyLen; /// 0x2A, date and time of creation public uint flCrDat; /// 0x2E, date and time of last modification public uint flMdDat; /// 0x32, file name prefixed with length public byte[] flNam; } } }