mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Move common Apple boot block information and structs to its own class.
This commit is contained in:
5
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
5
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
@@ -1308,6 +1308,11 @@
|
|||||||
<e p="APFS.cs" t="Include" />
|
<e p="APFS.cs" t="Include" />
|
||||||
<e p="Acorn.cs" t="Include" />
|
<e p="Acorn.cs" t="Include" />
|
||||||
<e p="AmigaDOS.cs" t="Include" />
|
<e p="AmigaDOS.cs" t="Include" />
|
||||||
|
<e p="AppleCommon" t="Include">
|
||||||
|
<e p="Consts.cs" t="Include" />
|
||||||
|
<e p="Info.cs" t="Include" />
|
||||||
|
<e p="Structs.cs" t="Include" />
|
||||||
|
</e>
|
||||||
<e p="AppleDOS" t="Include">
|
<e p="AppleDOS" t="Include">
|
||||||
<e p="AppleDOS.cs" t="Include" />
|
<e p="AppleDOS.cs" t="Include" />
|
||||||
<e p="Dir.cs" t="Include" />
|
<e p="Dir.cs" t="Include" />
|
||||||
|
|||||||
42
DiscImageChef.Filesystems/AppleCommon/Consts.cs
Normal file
42
DiscImageChef.Filesystems/AppleCommon/Consts.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
// /***************************************************************************
|
||||||
|
// The Disc Image Chef
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : AppleHFS.cs
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2011-2020 Natalia Portillo
|
||||||
|
// ****************************************************************************/
|
||||||
|
|
||||||
|
namespace DiscImageChef.Filesystems
|
||||||
|
{
|
||||||
|
// Information from Inside Macintosh
|
||||||
|
// https://developer.apple.com/legacy/library/documentation/mac/pdf/Files/File_Manager.pdf
|
||||||
|
internal static partial class AppleCommon
|
||||||
|
{
|
||||||
|
/// <summary>"LK", HFS bootblock magic</summary>
|
||||||
|
internal const ushort BB_MAGIC = 0x4C4B;
|
||||||
|
}
|
||||||
|
}
|
||||||
99
DiscImageChef.Filesystems/AppleCommon/Info.cs
Normal file
99
DiscImageChef.Filesystems/AppleCommon/Info.cs
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
// /***************************************************************************
|
||||||
|
// The Disc Image Chef
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : AppleHFS.cs
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2011-2020 Natalia Portillo
|
||||||
|
// ****************************************************************************/
|
||||||
|
|
||||||
|
using System.Text;
|
||||||
|
using DiscImageChef.Helpers;
|
||||||
|
|
||||||
|
namespace DiscImageChef.Filesystems
|
||||||
|
{
|
||||||
|
// Information from Inside Macintosh
|
||||||
|
// https://developer.apple.com/legacy/library/documentation/mac/pdf/Files/File_Manager.pdf
|
||||||
|
internal static partial class AppleCommon
|
||||||
|
{
|
||||||
|
internal static string GetBootBlockInformation(byte[] bbSector, Encoding Encoding)
|
||||||
|
{
|
||||||
|
if(bbSector is null ||
|
||||||
|
bbSector.Length < 0x100)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
BootBlock bb = Marshal.ByteArrayToStructureBigEndian<BootBlock>(bbSector);
|
||||||
|
|
||||||
|
if(bb.bbID != BB_MAGIC)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
sb.AppendLine("Boot Block:");
|
||||||
|
|
||||||
|
if((bb.bbPageFlags & 0x40) == 0x40)
|
||||||
|
sb.AppendLine("Boot block should be executed.");
|
||||||
|
|
||||||
|
if((bb.bbPageFlags & 0x80) == 0x80)
|
||||||
|
sb.AppendLine("Boot block is in new unknown format.");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(bb.bbPageFlags > 0)
|
||||||
|
sb.AppendLine("Allocate secondary sound buffer at boot.");
|
||||||
|
else if(bb.bbPageFlags < 0)
|
||||||
|
sb.AppendLine("Allocate secondary sound and video buffers at boot.");
|
||||||
|
|
||||||
|
sb.AppendFormat("System filename: {0}", StringHandlers.PascalToString(bb.bbSysName, Encoding)).
|
||||||
|
AppendLine();
|
||||||
|
|
||||||
|
sb.AppendFormat("Finder filename: {0}", StringHandlers.PascalToString(bb.bbShellName, Encoding)).
|
||||||
|
AppendLine();
|
||||||
|
|
||||||
|
sb.AppendFormat("Debugger filename: {0}", StringHandlers.PascalToString(bb.bbDbg1Name, Encoding)).
|
||||||
|
AppendLine();
|
||||||
|
|
||||||
|
sb.AppendFormat("Disassembler filename: {0}", StringHandlers.PascalToString(bb.bbDbg2Name, Encoding)).
|
||||||
|
AppendLine();
|
||||||
|
|
||||||
|
sb.AppendFormat("Startup screen filename: {0}",
|
||||||
|
StringHandlers.PascalToString(bb.bbScreenName, Encoding)).AppendLine();
|
||||||
|
|
||||||
|
sb.AppendFormat("First program to execute at boot: {0}",
|
||||||
|
StringHandlers.PascalToString(bb.bbHelloName, Encoding)).AppendLine();
|
||||||
|
|
||||||
|
sb.AppendFormat("Clipboard filename: {0}", StringHandlers.PascalToString(bb.bbScrapName, Encoding)).
|
||||||
|
AppendLine();
|
||||||
|
|
||||||
|
sb.AppendFormat("Maximum opened files: {0}", bb.bbCntFCBs * 4).AppendLine();
|
||||||
|
sb.AppendFormat("Event queue size: {0}", bb.bbCntEvts).AppendLine();
|
||||||
|
sb.AppendFormat("Heap size with 128KiB of RAM: {0} bytes", bb.bb128KSHeap).AppendLine();
|
||||||
|
sb.AppendFormat("Heap size with 256KiB of RAM: {0} bytes", bb.bb256KSHeap).AppendLine();
|
||||||
|
sb.AppendFormat("Heap size with 512KiB of RAM or more: {0} bytes", bb.bbSysHeapSize).AppendLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
92
DiscImageChef.Filesystems/AppleCommon/Structs.cs
Normal file
92
DiscImageChef.Filesystems/AppleCommon/Structs.cs
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
// /***************************************************************************
|
||||||
|
// The Disc Image Chef
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : AppleHFS.cs
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2011-2020 Natalia Portillo
|
||||||
|
// ****************************************************************************/
|
||||||
|
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace DiscImageChef.Filesystems
|
||||||
|
{
|
||||||
|
// Information from Inside Macintosh
|
||||||
|
// https://developer.apple.com/legacy/library/documentation/mac/pdf/Files/File_Manager.pdf
|
||||||
|
internal static partial class AppleCommon
|
||||||
|
{
|
||||||
|
/// <summary>Should be sectors 0 and 1 in volume, followed by boot code</summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
struct BootBlock // Should be sectors 0 and 1 in volume
|
||||||
|
{
|
||||||
|
/// <summary>0x000, Signature, 0x4C4B if bootable</summary>
|
||||||
|
public readonly ushort bbID;
|
||||||
|
/// <summary>0x002, Branch</summary>
|
||||||
|
public readonly uint bbEntry;
|
||||||
|
/// <summary>0x007, Boot block version</summary>
|
||||||
|
public readonly ushort bbVersion;
|
||||||
|
/// <summary>0x006, Boot block flags</summary>
|
||||||
|
public readonly short bbPageFlags;
|
||||||
|
/// <summary>0x00A, System file name (16 bytes)</summary>
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||||
|
public readonly byte[] bbSysName;
|
||||||
|
/// <summary>0x01A, Finder file name (16 bytes)</summary>
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||||
|
public readonly byte[] bbShellName;
|
||||||
|
/// <summary>0x02A, Debugger file name (16 bytes)</summary>
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||||
|
public readonly byte[] bbDbg1Name;
|
||||||
|
/// <summary>0x03A, Disassembler file name (16 bytes)</summary>
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||||
|
public readonly byte[] bbDbg2Name;
|
||||||
|
/// <summary>0x04A, Startup screen file name (16 bytes)</summary>
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||||
|
public readonly byte[] bbScreenName;
|
||||||
|
/// <summary>0x05A, First program to execute on boot (16 bytes)</summary>
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||||
|
public readonly byte[] bbHelloName;
|
||||||
|
/// <summary>0x06A, Clipboard file name (16 bytes)</summary>
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||||
|
public readonly byte[] bbScrapName;
|
||||||
|
/// <summary>0x07A, 1/4 of maximum opened at a time files</summary>
|
||||||
|
public readonly ushort bbCntFCBs;
|
||||||
|
/// <summary>0x07C, Event queue size</summary>
|
||||||
|
public readonly ushort bbCntEvts;
|
||||||
|
/// <summary>0x07E, Heap size on a Mac with 128KiB of RAM</summary>
|
||||||
|
public readonly uint bb128KSHeap;
|
||||||
|
/// <summary>0x082, Heap size on a Mac with 256KiB of RAM</summary>
|
||||||
|
public readonly uint bb256KSHeap;
|
||||||
|
/// <summary>0x086, Heap size on a Mac with 512KiB of RAM or more</summary>
|
||||||
|
public readonly uint bbSysHeapSize;
|
||||||
|
/// <summary>0x08A, Padding</summary>
|
||||||
|
public readonly ushort filler;
|
||||||
|
/// <summary>0x08C, Additional system heap space</summary>
|
||||||
|
public readonly uint bbSysHeapExtra;
|
||||||
|
/// <summary>0x090, Fraction of RAM for system heap</summary>
|
||||||
|
public readonly uint bbSysHeapFract;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,7 +40,5 @@ namespace DiscImageChef.Filesystems
|
|||||||
const ushort HFS_MAGIC = 0x4244;
|
const ushort HFS_MAGIC = 0x4244;
|
||||||
/// <summary>"H+", HFS+ magic</summary>
|
/// <summary>"H+", HFS+ magic</summary>
|
||||||
const ushort HFSP_MAGIC = 0x482B;
|
const ushort HFSP_MAGIC = 0x482B;
|
||||||
/// <summary>"LK", HFS bootblock magic</summary>
|
|
||||||
const ushort HFSBB_MAGIC = 0x4C4B;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,6 @@ namespace DiscImageChef.Filesystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
HfsMasterDirectoryBlock mdb = Marshal.ByteArrayToStructureBigEndian<HfsMasterDirectoryBlock>(mdbSector);
|
HfsMasterDirectoryBlock mdb = Marshal.ByteArrayToStructureBigEndian<HfsMasterDirectoryBlock>(mdbSector);
|
||||||
HfsBootBlock bb = Marshal.ByteArrayToStructureBigEndian<HfsBootBlock>(bbSector);
|
|
||||||
|
|
||||||
sb.AppendLine("Apple Hierarchical File System");
|
sb.AppendLine("Apple Hierarchical File System");
|
||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
@@ -238,51 +237,13 @@ namespace DiscImageChef.Filesystems
|
|||||||
sb.AppendFormat("{0} blocks in volume common cache", mdb.drCtlCSize).AppendLine();
|
sb.AppendFormat("{0} blocks in volume common cache", mdb.drCtlCSize).AppendLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bb.bbID == HFSBB_MAGIC)
|
string bootBlockInfo = AppleCommon.GetBootBlockInformation(bbSector, Encoding);
|
||||||
|
|
||||||
|
if(bootBlockInfo != null)
|
||||||
{
|
{
|
||||||
sb.AppendLine("Volume is bootable.");
|
sb.AppendLine("Volume is bootable.");
|
||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
sb.AppendLine("Boot Block:");
|
sb.AppendLine(bootBlockInfo);
|
||||||
|
|
||||||
if((bb.bbPageFlags & 0x40) == 0x40)
|
|
||||||
sb.AppendLine("Boot block should be executed.");
|
|
||||||
|
|
||||||
if((bb.bbPageFlags & 0x80) == 0x80)
|
|
||||||
sb.AppendLine("Boot block is in new unknown format.");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(bb.bbPageFlags > 0)
|
|
||||||
sb.AppendLine("Allocate secondary sound buffer at boot.");
|
|
||||||
else if(bb.bbPageFlags < 0)
|
|
||||||
sb.AppendLine("Allocate secondary sound and video buffers at boot.");
|
|
||||||
|
|
||||||
sb.AppendFormat("System filename: {0}", StringHandlers.PascalToString(bb.bbSysName, Encoding)).
|
|
||||||
AppendLine();
|
|
||||||
|
|
||||||
sb.AppendFormat("Finder filename: {0}", StringHandlers.PascalToString(bb.bbShellName, Encoding)).
|
|
||||||
AppendLine();
|
|
||||||
|
|
||||||
sb.AppendFormat("Debugger filename: {0}", StringHandlers.PascalToString(bb.bbDbg1Name, Encoding)).
|
|
||||||
AppendLine();
|
|
||||||
|
|
||||||
sb.AppendFormat("Disassembler filename: {0}",
|
|
||||||
StringHandlers.PascalToString(bb.bbDbg2Name, Encoding)).AppendLine();
|
|
||||||
|
|
||||||
sb.AppendFormat("Startup screen filename: {0}",
|
|
||||||
StringHandlers.PascalToString(bb.bbScreenName, Encoding)).AppendLine();
|
|
||||||
|
|
||||||
sb.AppendFormat("First program to execute at boot: {0}",
|
|
||||||
StringHandlers.PascalToString(bb.bbHelloName, Encoding)).AppendLine();
|
|
||||||
|
|
||||||
sb.AppendFormat("Clipboard filename: {0}", StringHandlers.PascalToString(bb.bbScrapName, Encoding)).
|
|
||||||
AppendLine();
|
|
||||||
|
|
||||||
sb.AppendFormat("Maximum opened files: {0}", bb.bbCntFCBs * 4).AppendLine();
|
|
||||||
sb.AppendFormat("Event queue size: {0}", bb.bbCntEvts).AppendLine();
|
|
||||||
sb.AppendFormat("Heap size with 128KiB of RAM: {0} bytes", bb.bb128KSHeap).AppendLine();
|
|
||||||
sb.AppendFormat("Heap size with 256KiB of RAM: {0} bytes", bb.bb256KSHeap).AppendLine();
|
|
||||||
sb.AppendFormat("Heap size with 512KiB of RAM or more: {0} bytes", bb.bbSysHeapSize).AppendLine();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(mdb.drFndrInfo0 != 0 ||
|
else if(mdb.drFndrInfo0 != 0 ||
|
||||||
mdb.drFndrInfo3 != 0 ||
|
mdb.drFndrInfo3 != 0 ||
|
||||||
@@ -301,7 +262,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
XmlFsType.BackupDateSpecified = true;
|
XmlFsType.BackupDateSpecified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlFsType.Bootable = bb.bbID == HFSBB_MAGIC || mdb.drFndrInfo0 != 0 || mdb.drFndrInfo3 != 0 ||
|
XmlFsType.Bootable = bootBlockInfo != null || mdb.drFndrInfo0 != 0 || mdb.drFndrInfo3 != 0 ||
|
||||||
mdb.drFndrInfo5 != 0;
|
mdb.drFndrInfo5 != 0;
|
||||||
|
|
||||||
XmlFsType.Clusters = mdb.drNmAlBlks;
|
XmlFsType.Clusters = mdb.drNmAlBlks;
|
||||||
|
|||||||
@@ -38,57 +38,6 @@ namespace DiscImageChef.Filesystems
|
|||||||
// https://developer.apple.com/legacy/library/documentation/mac/pdf/Files/File_Manager.pdf
|
// https://developer.apple.com/legacy/library/documentation/mac/pdf/Files/File_Manager.pdf
|
||||||
public partial class AppleHFS
|
public partial class AppleHFS
|
||||||
{
|
{
|
||||||
/// <summary>Should be sectors 0 and 1 in volume, followed by boot code</summary>
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
||||||
struct HfsBootBlock // Should be sectors 0 and 1 in volume
|
|
||||||
{
|
|
||||||
/// <summary>0x000, Signature, 0x4C4B if bootable</summary>
|
|
||||||
public readonly ushort bbID;
|
|
||||||
/// <summary>0x002, Branch</summary>
|
|
||||||
public readonly uint bbEntry;
|
|
||||||
/// <summary>0x007, Boot block version</summary>
|
|
||||||
public readonly ushort bbVersion;
|
|
||||||
/// <summary>0x006, Boot block flags</summary>
|
|
||||||
public readonly short bbPageFlags;
|
|
||||||
/// <summary>0x00A, System file name (16 bytes)</summary>
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
|
||||||
public readonly byte[] bbSysName;
|
|
||||||
/// <summary>0x01A, Finder file name (16 bytes)</summary>
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
|
||||||
public readonly byte[] bbShellName;
|
|
||||||
/// <summary>0x02A, Debugger file name (16 bytes)</summary>
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
|
||||||
public readonly byte[] bbDbg1Name;
|
|
||||||
/// <summary>0x03A, Disassembler file name (16 bytes)</summary>
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
|
||||||
public readonly byte[] bbDbg2Name;
|
|
||||||
/// <summary>0x04A, Startup screen file name (16 bytes)</summary>
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
|
||||||
public readonly byte[] bbScreenName;
|
|
||||||
/// <summary>0x05A, First program to execute on boot (16 bytes)</summary>
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
|
||||||
public readonly byte[] bbHelloName;
|
|
||||||
/// <summary>0x06A, Clipboard file name (16 bytes)</summary>
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
|
||||||
public readonly byte[] bbScrapName;
|
|
||||||
/// <summary>0x07A, 1/4 of maximum opened at a time files</summary>
|
|
||||||
public readonly ushort bbCntFCBs;
|
|
||||||
/// <summary>0x07C, Event queue size</summary>
|
|
||||||
public readonly ushort bbCntEvts;
|
|
||||||
/// <summary>0x07E, Heap size on a Mac with 128KiB of RAM</summary>
|
|
||||||
public readonly uint bb128KSHeap;
|
|
||||||
/// <summary>0x082, Heap size on a Mac with 256KiB of RAM</summary>
|
|
||||||
public readonly uint bb256KSHeap;
|
|
||||||
/// <summary>0x086, Heap size on a Mac with 512KiB of RAM or more</summary>
|
|
||||||
public readonly uint bbSysHeapSize;
|
|
||||||
/// <summary>Padding</summary>
|
|
||||||
public readonly ushort filler;
|
|
||||||
/// <summary>Additional system heap space</summary>
|
|
||||||
public readonly uint bbSysHeapExtra;
|
|
||||||
/// <summary>Fraction of RAM for system heap</summary>
|
|
||||||
public readonly uint bbSysHeapFract;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Master Directory Block, should be sector 2 in volume</summary>
|
/// <summary>Master Directory Block, should be sector 2 in volume</summary>
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
struct HfsMasterDirectoryBlock // Should be sector 2 in volume
|
struct HfsMasterDirectoryBlock // Should be sector 2 in volume
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
|||||||
public partial class AppleMFS
|
public partial class AppleMFS
|
||||||
{
|
{
|
||||||
const ushort MFS_MAGIC = 0xD2D7;
|
const ushort MFS_MAGIC = 0xD2D7;
|
||||||
// "LK"
|
|
||||||
const ushort MFSBB_MAGIC = 0x4C4B;
|
|
||||||
|
|
||||||
const short DIRID_TRASH = -3;
|
const short DIRID_TRASH = -3;
|
||||||
const short DIRID_DESKTOP = -2;
|
const short DIRID_DESKTOP = -2;
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
|
|
||||||
var mdb = new MFS_MasterDirectoryBlock();
|
var mdb = new MFS_MasterDirectoryBlock();
|
||||||
var bb = new MFS_BootBlock();
|
|
||||||
|
|
||||||
byte[] pString = new byte[16];
|
byte[] pString = new byte[16];
|
||||||
|
|
||||||
@@ -93,40 +92,6 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
|||||||
Array.Copy(mdbSector, 0x024, variableSize, 0, mdb.drVNSiz + 1);
|
Array.Copy(mdbSector, 0x024, variableSize, 0, mdb.drVNSiz + 1);
|
||||||
mdb.drVN = StringHandlers.PascalToString(variableSize, Encoding);
|
mdb.drVN = StringHandlers.PascalToString(variableSize, Encoding);
|
||||||
|
|
||||||
bb.bbID = BigEndianBitConverter.ToUInt16(bbSector, 0x000);
|
|
||||||
|
|
||||||
if(bb.bbID == MFSBB_MAGIC)
|
|
||||||
{
|
|
||||||
bb.bbEntry = BigEndianBitConverter.ToUInt32(bbSector, 0x002);
|
|
||||||
bb.boot_flags = bbSector[0x006];
|
|
||||||
bb.bbVersion = bbSector[0x007];
|
|
||||||
|
|
||||||
bb.bbPageFlags = BigEndianBitConverter.ToInt16(bbSector, 0x008);
|
|
||||||
|
|
||||||
Array.Copy(mdbSector, 0x00A, pString, 0, 16);
|
|
||||||
bb.bbSysName = StringHandlers.PascalToString(pString, Encoding);
|
|
||||||
Array.Copy(mdbSector, 0x01A, pString, 0, 16);
|
|
||||||
bb.bbShellName = StringHandlers.PascalToString(pString, Encoding);
|
|
||||||
Array.Copy(mdbSector, 0x02A, pString, 0, 16);
|
|
||||||
bb.bbDbg1Name = StringHandlers.PascalToString(pString, Encoding);
|
|
||||||
Array.Copy(mdbSector, 0x03A, pString, 0, 16);
|
|
||||||
bb.bbDbg2Name = StringHandlers.PascalToString(pString, Encoding);
|
|
||||||
Array.Copy(mdbSector, 0x04A, pString, 0, 16);
|
|
||||||
bb.bbScreenName = StringHandlers.PascalToString(pString, Encoding);
|
|
||||||
Array.Copy(mdbSector, 0x05A, pString, 0, 16);
|
|
||||||
bb.bbHelloName = StringHandlers.PascalToString(pString, Encoding);
|
|
||||||
Array.Copy(mdbSector, 0x06A, pString, 0, 16);
|
|
||||||
bb.bbScrapName = StringHandlers.PascalToString(pString, Encoding);
|
|
||||||
|
|
||||||
bb.bbCntFCBs = BigEndianBitConverter.ToUInt16(bbSector, 0x07A);
|
|
||||||
bb.bbCntEvts = BigEndianBitConverter.ToUInt16(bbSector, 0x07C);
|
|
||||||
bb.bb128KSHeap = BigEndianBitConverter.ToUInt32(bbSector, 0x07E);
|
|
||||||
bb.bb256KSHeap = BigEndianBitConverter.ToUInt32(bbSector, 0x082);
|
|
||||||
bb.bbSysHeapSize = BigEndianBitConverter.ToUInt32(bbSector, 0x086);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
bb.bbID = 0x0000;
|
|
||||||
|
|
||||||
sb.AppendLine("Apple Macintosh File System");
|
sb.AppendLine("Apple Macintosh File System");
|
||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
sb.AppendLine("Master Directory Block:");
|
sb.AppendLine("Master Directory Block:");
|
||||||
@@ -150,37 +115,13 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
|||||||
sb.AppendFormat("{0} unused allocation blocks.", mdb.drFreeBks).AppendLine();
|
sb.AppendFormat("{0} unused allocation blocks.", mdb.drFreeBks).AppendLine();
|
||||||
sb.AppendFormat("Volume name: {0}", mdb.drVN).AppendLine();
|
sb.AppendFormat("Volume name: {0}", mdb.drVN).AppendLine();
|
||||||
|
|
||||||
if(bb.bbID == MFSBB_MAGIC)
|
string bootBlockInfo = AppleCommon.GetBootBlockInformation(bbSector, Encoding);
|
||||||
|
|
||||||
|
if(bootBlockInfo != null)
|
||||||
{
|
{
|
||||||
sb.AppendLine("Volume is bootable.");
|
sb.AppendLine("Volume is bootable.");
|
||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
sb.AppendLine("Boot Block:");
|
sb.AppendLine(bootBlockInfo);
|
||||||
|
|
||||||
if((bb.boot_flags & 0x40) == 0x40)
|
|
||||||
sb.AppendLine("Boot block should be executed.");
|
|
||||||
|
|
||||||
if((bb.boot_flags & 0x80) == 0x80)
|
|
||||||
sb.AppendLine("Boot block is in new unknown format.");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(bb.bbPageFlags > 0)
|
|
||||||
sb.AppendLine("Allocate secondary sound buffer at boot.");
|
|
||||||
else if(bb.bbPageFlags < 0)
|
|
||||||
sb.AppendLine("Allocate secondary sound and video buffers at boot.");
|
|
||||||
|
|
||||||
sb.AppendFormat("System filename: {0}", bb.bbSysName).AppendLine();
|
|
||||||
sb.AppendFormat("Finder filename: {0}", bb.bbShellName).AppendLine();
|
|
||||||
sb.AppendFormat("Debugger filename: {0}", bb.bbDbg1Name).AppendLine();
|
|
||||||
sb.AppendFormat("Disassembler filename: {0}", bb.bbDbg2Name).AppendLine();
|
|
||||||
sb.AppendFormat("Startup screen filename: {0}", bb.bbScreenName).AppendLine();
|
|
||||||
sb.AppendFormat("First program to execute at boot: {0}", bb.bbHelloName).AppendLine();
|
|
||||||
sb.AppendFormat("Clipboard filename: {0}", bb.bbScrapName).AppendLine();
|
|
||||||
sb.AppendFormat("Maximum opened files: {0}", bb.bbCntFCBs * 4).AppendLine();
|
|
||||||
sb.AppendFormat("Event queue size: {0}", bb.bbCntEvts).AppendLine();
|
|
||||||
sb.AppendFormat("Heap size with 128KiB of RAM: {0} bytes", bb.bb128KSHeap).AppendLine();
|
|
||||||
sb.AppendFormat("Heap size with 256KiB of RAM: {0} bytes", bb.bb256KSHeap).AppendLine();
|
|
||||||
sb.AppendFormat("Heap size with 512KiB of RAM or more: {0} bytes", bb.bbSysHeapSize).AppendLine();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sb.AppendLine("Volume is not bootable.");
|
sb.AppendLine("Volume is not bootable.");
|
||||||
@@ -195,7 +136,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
|||||||
XmlFsType.BackupDateSpecified = true;
|
XmlFsType.BackupDateSpecified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlFsType.Bootable = bb.bbID == MFSBB_MAGIC;
|
XmlFsType.Bootable = bootBlockInfo != null;
|
||||||
XmlFsType.Clusters = mdb.drNmAlBlks;
|
XmlFsType.Clusters = mdb.drNmAlBlks;
|
||||||
XmlFsType.ClusterSize = mdb.drAlBlkSiz;
|
XmlFsType.ClusterSize = mdb.drAlBlkSiz;
|
||||||
|
|
||||||
|
|||||||
@@ -76,45 +76,6 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
|||||||
public string drVN;
|
public string drVN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Should be at offset 0x0000 in volume, followed by boot code</summary>
|
|
||||||
struct MFS_BootBlock
|
|
||||||
{
|
|
||||||
/// <summary>0x000, Signature, 0x4C4B if bootable</summary>
|
|
||||||
public ushort bbID;
|
|
||||||
/// <summary>0x002, Branch</summary>
|
|
||||||
public uint bbEntry;
|
|
||||||
/// <summary>0x006, Boot block flags</summary>
|
|
||||||
public byte boot_flags;
|
|
||||||
/// <summary>0x007, Boot block version</summary>
|
|
||||||
public byte bbVersion;
|
|
||||||
/// <summary>0x008, Allocate secondary buffers</summary>
|
|
||||||
public short bbPageFlags;
|
|
||||||
/// <summary>0x00A, System file name (16 bytes)</summary>
|
|
||||||
public string bbSysName;
|
|
||||||
/// <summary>0x01A, Finder file name (16 bytes)</summary>
|
|
||||||
public string bbShellName;
|
|
||||||
/// <summary>0x02A, Debugger file name (16 bytes)</summary>
|
|
||||||
public string bbDbg1Name;
|
|
||||||
/// <summary>0x03A, Disassembler file name (16 bytes)</summary>
|
|
||||||
public string bbDbg2Name;
|
|
||||||
/// <summary>0x04A, Startup screen file name (16 bytes)</summary>
|
|
||||||
public string bbScreenName;
|
|
||||||
/// <summary>0x05A, First program to execute on boot (16 bytes)</summary>
|
|
||||||
public string bbHelloName;
|
|
||||||
/// <summary>0x06A, Clipboard file name (16 bytes)</summary>
|
|
||||||
public string bbScrapName;
|
|
||||||
/// <summary>0x07A, 1/4 of maximum opened at a time files</summary>
|
|
||||||
public ushort bbCntFCBs;
|
|
||||||
/// <summary>0x07C, Event queue size</summary>
|
|
||||||
public ushort bbCntEvts;
|
|
||||||
/// <summary>0x07E, Heap size on a Mac with 128KiB of RAM</summary>
|
|
||||||
public uint bb128KSHeap;
|
|
||||||
/// <summary>0x082, Heap size on a Mac with 256KiB of RAM</summary>
|
|
||||||
public uint bb256KSHeap;
|
|
||||||
/// <summary>0x086, Heap size on a Mac with 512KiB of RAM or more</summary>
|
|
||||||
public uint bbSysHeapSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
enum MFS_FileFlags : byte
|
enum MFS_FileFlags : byte
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,21 +44,28 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
|||||||
// Information from Inside Macintosh Volume II
|
// Information from Inside Macintosh Volume II
|
||||||
public partial class AppleMFS
|
public partial class AppleMFS
|
||||||
{
|
{
|
||||||
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding,
|
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding,
|
||||||
Dictionary<string, string> options, string @namespace)
|
Dictionary<string, string> options, string @namespace)
|
||||||
{
|
{
|
||||||
device = imagePlugin;
|
device = imagePlugin;
|
||||||
partitionStart = partition.Start;
|
partitionStart = partition.Start;
|
||||||
Encoding = encoding ?? Encoding.GetEncoding("macintosh");
|
Encoding = encoding ?? Encoding.GetEncoding("macintosh");
|
||||||
if(options == null) options = GetDefaultOptions();
|
|
||||||
if(options.TryGetValue("debug", out string debugString)) bool.TryParse(debugString, out debug);
|
if(options == null)
|
||||||
|
options = GetDefaultOptions();
|
||||||
|
|
||||||
|
if(options.TryGetValue("debug", out string debugString))
|
||||||
|
bool.TryParse(debugString, out debug);
|
||||||
|
|
||||||
volMDB = new MFS_MasterDirectoryBlock();
|
volMDB = new MFS_MasterDirectoryBlock();
|
||||||
|
|
||||||
mdbBlocks = device.ReadSector(2 + partitionStart);
|
mdbBlocks = device.ReadSector(2 + partitionStart);
|
||||||
bootBlocks = device.ReadSector(0 + partitionStart);
|
bootBlocks = device.ReadSector(0 + partitionStart);
|
||||||
|
|
||||||
volMDB.drSigWord = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x000);
|
volMDB.drSigWord = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x000);
|
||||||
if(volMDB.drSigWord != MFS_MAGIC) return Errno.InvalidArgument;
|
|
||||||
|
if(volMDB.drSigWord != MFS_MAGIC)
|
||||||
|
return Errno.InvalidArgument;
|
||||||
|
|
||||||
volMDB.drCrDate = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x002);
|
volMDB.drCrDate = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x002);
|
||||||
volMDB.drLsBkUp = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x006);
|
volMDB.drLsBkUp = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x006);
|
||||||
@@ -78,37 +85,58 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
|||||||
volMDB.drVN = StringHandlers.PascalToString(variableSize, Encoding);
|
volMDB.drVN = StringHandlers.PascalToString(variableSize, Encoding);
|
||||||
|
|
||||||
directoryBlocks = device.ReadSectors(volMDB.drDirSt + partitionStart, volMDB.drBlLen);
|
directoryBlocks = device.ReadSectors(volMDB.drDirSt + partitionStart, volMDB.drBlLen);
|
||||||
int bytesInBlockMap = volMDB.drNmAlBlks * 12 / 8 + volMDB.drNmAlBlks * 12 % 8;
|
int bytesInBlockMap = ((volMDB.drNmAlBlks * 12) / 8) + ((volMDB.drNmAlBlks * 12) % 8);
|
||||||
const int BYTES_BEFORE_BLOCK_MAP = 64;
|
const int BYTES_BEFORE_BLOCK_MAP = 64;
|
||||||
int bytesInWholeMdb = bytesInBlockMap + BYTES_BEFORE_BLOCK_MAP;
|
int bytesInWholeMdb = bytesInBlockMap + BYTES_BEFORE_BLOCK_MAP;
|
||||||
int sectorsInWholeMdb = bytesInWholeMdb / (int)device.Info.SectorSize +
|
|
||||||
bytesInWholeMdb % (int)device.Info.SectorSize;
|
int sectorsInWholeMdb = (bytesInWholeMdb / (int)device.Info.SectorSize) +
|
||||||
|
(bytesInWholeMdb % (int)device.Info.SectorSize);
|
||||||
|
|
||||||
byte[] wholeMdb = device.ReadSectors(partitionStart + 2, (uint)sectorsInWholeMdb);
|
byte[] wholeMdb = device.ReadSectors(partitionStart + 2, (uint)sectorsInWholeMdb);
|
||||||
blockMapBytes = new byte[bytesInBlockMap];
|
blockMapBytes = new byte[bytesInBlockMap];
|
||||||
Array.Copy(wholeMdb, BYTES_BEFORE_BLOCK_MAP, blockMapBytes, 0, blockMapBytes.Length);
|
Array.Copy(wholeMdb, BYTES_BEFORE_BLOCK_MAP, blockMapBytes, 0, blockMapBytes.Length);
|
||||||
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
blockMap = new uint[volMDB.drNmAlBlks + 2 + 1];
|
blockMap = new uint[volMDB.drNmAlBlks + 2 + 1];
|
||||||
|
|
||||||
for(int i = 2; i < volMDB.drNmAlBlks + 2; i += 8)
|
for(int i = 2; i < volMDB.drNmAlBlks + 2; i += 8)
|
||||||
{
|
{
|
||||||
uint tmp1 = 0;
|
uint tmp1 = 0;
|
||||||
uint tmp2 = 0;
|
uint tmp2 = 0;
|
||||||
uint tmp3 = 0;
|
uint tmp3 = 0;
|
||||||
|
|
||||||
if(offset + 4 <= blockMapBytes.Length) tmp1 = BigEndianBitConverter.ToUInt32(blockMapBytes, offset);
|
if(offset + 4 <= blockMapBytes.Length)
|
||||||
|
tmp1 = BigEndianBitConverter.ToUInt32(blockMapBytes, offset);
|
||||||
|
|
||||||
if(offset + 4 + 4 <= blockMapBytes.Length)
|
if(offset + 4 + 4 <= blockMapBytes.Length)
|
||||||
tmp2 = BigEndianBitConverter.ToUInt32(blockMapBytes, offset + 4);
|
tmp2 = BigEndianBitConverter.ToUInt32(blockMapBytes, offset + 4);
|
||||||
|
|
||||||
if(offset + 8 + 4 <= blockMapBytes.Length)
|
if(offset + 8 + 4 <= blockMapBytes.Length)
|
||||||
tmp3 = BigEndianBitConverter.ToUInt32(blockMapBytes, offset + 8);
|
tmp3 = BigEndianBitConverter.ToUInt32(blockMapBytes, offset + 8);
|
||||||
|
|
||||||
if(i < blockMap.Length) blockMap[i] = (tmp1 & 0xFFF00000) >> 20;
|
if(i < blockMap.Length)
|
||||||
if(i + 2 < blockMap.Length) blockMap[i + 1] = (tmp1 & 0xFFF00) >> 8;
|
blockMap[i] = (tmp1 & 0xFFF00000) >> 20;
|
||||||
if(i + 3 < blockMap.Length) blockMap[i + 2] = ((tmp1 & 0xFF) << 4) + ((tmp2 & 0xF0000000) >> 28);
|
|
||||||
if(i + 4 < blockMap.Length) blockMap[i + 3] = (tmp2 & 0xFFF0000) >> 16;
|
if(i + 2 < blockMap.Length)
|
||||||
if(i + 5 < blockMap.Length) blockMap[i + 4] = (tmp2 & 0xFFF0) >> 4;
|
blockMap[i + 1] = (tmp1 & 0xFFF00) >> 8;
|
||||||
if(i + 6 < blockMap.Length) blockMap[i + 5] = ((tmp2 & 0xF) << 8) + ((tmp3 & 0xFF000000) >> 24);
|
|
||||||
if(i + 7 < blockMap.Length) blockMap[i + 6] = (tmp3 & 0xFFF000) >> 12;
|
if(i + 3 < blockMap.Length)
|
||||||
if(i + 8 < blockMap.Length) blockMap[i + 7] = tmp3 & 0xFFF;
|
blockMap[i + 2] = ((tmp1 & 0xFF) << 4) + ((tmp2 & 0xF0000000) >> 28);
|
||||||
|
|
||||||
|
if(i + 4 < blockMap.Length)
|
||||||
|
blockMap[i + 3] = (tmp2 & 0xFFF0000) >> 16;
|
||||||
|
|
||||||
|
if(i + 5 < blockMap.Length)
|
||||||
|
blockMap[i + 4] = (tmp2 & 0xFFF0) >> 4;
|
||||||
|
|
||||||
|
if(i + 6 < blockMap.Length)
|
||||||
|
blockMap[i + 5] = ((tmp2 & 0xF) << 8) + ((tmp3 & 0xFF000000) >> 24);
|
||||||
|
|
||||||
|
if(i + 7 < blockMap.Length)
|
||||||
|
blockMap[i + 6] = (tmp3 & 0xFFF000) >> 12;
|
||||||
|
|
||||||
|
if(i + 8 < blockMap.Length)
|
||||||
|
blockMap[i + 7] = tmp3 & 0xFFF;
|
||||||
|
|
||||||
offset += 12;
|
offset += 12;
|
||||||
}
|
}
|
||||||
@@ -117,32 +145,38 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
|||||||
{
|
{
|
||||||
mdbTags = device.ReadSectorTag(2 + partitionStart, SectorTagType.AppleSectorTag);
|
mdbTags = device.ReadSectorTag(2 + partitionStart, SectorTagType.AppleSectorTag);
|
||||||
bootTags = device.ReadSectorTag(0 + partitionStart, SectorTagType.AppleSectorTag);
|
bootTags = device.ReadSectorTag(0 + partitionStart, SectorTagType.AppleSectorTag);
|
||||||
|
|
||||||
directoryTags = device.ReadSectorsTag(volMDB.drDirSt + partitionStart, volMDB.drBlLen,
|
directoryTags = device.ReadSectorsTag(volMDB.drDirSt + partitionStart, volMDB.drBlLen,
|
||||||
SectorTagType.AppleSectorTag);
|
SectorTagType.AppleSectorTag);
|
||||||
|
|
||||||
bitmapTags = device.ReadSectorsTag(partitionStart + 2, (uint)sectorsInWholeMdb,
|
bitmapTags = device.ReadSectorsTag(partitionStart + 2, (uint)sectorsInWholeMdb,
|
||||||
SectorTagType.AppleSectorTag);
|
SectorTagType.AppleSectorTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
sectorsPerBlock = (int)(volMDB.drAlBlkSiz / device.Info.SectorSize);
|
sectorsPerBlock = (int)(volMDB.drAlBlkSiz / device.Info.SectorSize);
|
||||||
|
|
||||||
if(!FillDirectory()) return Errno.InvalidArgument;
|
if(!FillDirectory())
|
||||||
|
return Errno.InvalidArgument;
|
||||||
|
|
||||||
mounted = true;
|
mounted = true;
|
||||||
|
|
||||||
ushort bbSig = BigEndianBitConverter.ToUInt16(bootBlocks, 0x000);
|
ushort bbSig = BigEndianBitConverter.ToUInt16(bootBlocks, 0x000);
|
||||||
|
|
||||||
if(bbSig != MFSBB_MAGIC) bootBlocks = null;
|
if(bbSig != AppleCommon.BB_MAGIC)
|
||||||
|
bootBlocks = null;
|
||||||
|
|
||||||
XmlFsType = new FileSystemType();
|
XmlFsType = new FileSystemType();
|
||||||
|
|
||||||
if(volMDB.drLsBkUp > 0)
|
if(volMDB.drLsBkUp > 0)
|
||||||
{
|
{
|
||||||
XmlFsType.BackupDate = DateHandlers.MacToDateTime(volMDB.drLsBkUp);
|
XmlFsType.BackupDate = DateHandlers.MacToDateTime(volMDB.drLsBkUp);
|
||||||
XmlFsType.BackupDateSpecified = true;
|
XmlFsType.BackupDateSpecified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlFsType.Bootable = bbSig == MFSBB_MAGIC;
|
XmlFsType.Bootable = bbSig == AppleCommon.BB_MAGIC;
|
||||||
XmlFsType.Clusters = volMDB.drNmAlBlks;
|
XmlFsType.Clusters = volMDB.drNmAlBlks;
|
||||||
XmlFsType.ClusterSize = volMDB.drAlBlkSiz;
|
XmlFsType.ClusterSize = volMDB.drAlBlkSiz;
|
||||||
|
|
||||||
if(volMDB.drCrDate > 0)
|
if(volMDB.drCrDate > 0)
|
||||||
{
|
{
|
||||||
XmlFsType.CreationDate = DateHandlers.MacToDateTime(volMDB.drCrDate);
|
XmlFsType.CreationDate = DateHandlers.MacToDateTime(volMDB.drCrDate);
|
||||||
@@ -174,13 +208,11 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
|||||||
{
|
{
|
||||||
stat = new FileSystemInfo
|
stat = new FileSystemInfo
|
||||||
{
|
{
|
||||||
Blocks = volMDB.drNmAlBlks,
|
Blocks = volMDB.drNmAlBlks, FilenameLength = 255, Files = volMDB.drNmFls,
|
||||||
FilenameLength = 255,
|
FreeBlocks = volMDB.drFreeBks,
|
||||||
Files = volMDB.drNmFls,
|
PluginId = Id, Type = "Apple MFS"
|
||||||
FreeBlocks = volMDB.drFreeBks,
|
|
||||||
PluginId = Id,
|
|
||||||
Type = "Apple MFS"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
stat.FreeFiles = uint.MaxValue - stat.Files;
|
stat.FreeFiles = uint.MaxValue - stat.Files;
|
||||||
|
|
||||||
return Errno.NoError;
|
return Errno.NoError;
|
||||||
|
|||||||
@@ -54,6 +54,9 @@
|
|||||||
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.3.0" />
|
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.3.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="AppleCommon\Consts.cs" />
|
||||||
|
<Compile Include="AppleCommon\Info.cs" />
|
||||||
|
<Compile Include="AppleCommon\Structs.cs" />
|
||||||
<Compile Include="AppleHFS\AppleHFS.cs" />
|
<Compile Include="AppleHFS\AppleHFS.cs" />
|
||||||
<Compile Include="AppleHFS\Consts.cs" />
|
<Compile Include="AppleHFS\Consts.cs" />
|
||||||
<Compile Include="AppleHFS\Info.cs" />
|
<Compile Include="AppleHFS\Info.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user