From 1724edbcc6243ade1bf3a56b9f65b7c882ccf1a6 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 17 Apr 2014 03:45:02 +0000 Subject: [PATCH] * FileSystemIDandChk/Plugins/LisaFS.cs: * FileSystemIDandChk/FileSystemIDandChk.csproj: Added LisaFS skeleton with Lisa's MDDF and tag structs * FileSystemIDandChk/DateHandlers.cs: Added convert function from Lisa timestamp fields to C# DateTime git-svn-id: svn://claunia.com/FileSystemIDandChk@34 17725271-3d32-4980-a8cb-9ff532f270ba --- FileSystemIDandChk/ChangeLog | 10 ++ FileSystemIDandChk/DateHandlers.cs | 10 +- FileSystemIDandChk/FileSystemIDandChk.csproj | 1 + FileSystemIDandChk/Plugins/LisaFS.cs | 135 +++++++++++++++++++ 4 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 FileSystemIDandChk/Plugins/LisaFS.cs diff --git a/FileSystemIDandChk/ChangeLog b/FileSystemIDandChk/ChangeLog index 44904d9d4..ef1ebfa61 100644 --- a/FileSystemIDandChk/ChangeLog +++ b/FileSystemIDandChk/ChangeLog @@ -1,3 +1,13 @@ +2014-04-17 Natalia Portillo + + * Plugins/LisaFS.cs: + * FileSystemIDandChk.csproj: + Added LisaFS skeleton with Lisa's MDDF and tag structs + + * DateHandlers.cs: + Added convert function from Lisa timestamp fields to C# + DateTime + 2014-04-17 Natalia Portillo * ImagePlugins/DiskCopy42.cs: diff --git a/FileSystemIDandChk/DateHandlers.cs b/FileSystemIDandChk/DateHandlers.cs index 889fdb212..05a88d088 100644 --- a/FileSystemIDandChk/DateHandlers.cs +++ b/FileSystemIDandChk/DateHandlers.cs @@ -4,15 +4,22 @@ namespace FileSystemIDandChk { public static class DateHandlers { + static readonly DateTime LisaEpoch = new DateTime(1904, 1, 1, 0, 0, 0); static readonly DateTime MacEpoch = new DateTime(1904, 1, 1, 0, 0, 0); static readonly DateTime UNIXEpoch = new DateTime(1970, 1, 1, 0, 0, 0); - static readonly DateTime JulianEpoch = new DateTime(1858, 11, 17, 0, 0, 0); // Day 0 of Julian Date system + static readonly DateTime JulianEpoch = new DateTime(1858, 11, 17, 0, 0, 0); + public static DateTime MacToDateTime(ulong MacTimeStamp) { return MacEpoch.AddTicks((long)(MacTimeStamp * 10000000)); } + public static DateTime LisaToDateTime(Int32 LisaTimeStamp) + { + return LisaEpoch.AddSeconds(LisaTimeStamp); + } + public static DateTime UNIXToDateTime(Int32 UNIXTimeStamp) { return UNIXEpoch.AddSeconds(UNIXTimeStamp); @@ -93,6 +100,7 @@ namespace FileSystemIDandChk return decodedDT; } + // C# works in UTC, VMS on Julian Date, some displacement may occur on disks created outside UTC public static DateTime VMSToDateTime(UInt64 vmsDate) { diff --git a/FileSystemIDandChk/FileSystemIDandChk.csproj b/FileSystemIDandChk/FileSystemIDandChk.csproj index 10ce540d8..ff1dbd4ce 100644 --- a/FileSystemIDandChk/FileSystemIDandChk.csproj +++ b/FileSystemIDandChk/FileSystemIDandChk.csproj @@ -71,6 +71,7 @@ + diff --git a/FileSystemIDandChk/Plugins/LisaFS.cs b/FileSystemIDandChk/Plugins/LisaFS.cs new file mode 100644 index 000000000..173002423 --- /dev/null +++ b/FileSystemIDandChk/Plugins/LisaFS.cs @@ -0,0 +1,135 @@ +using System; +using System.Text; +using FileSystemIDandChk; + +// Information from Inside Macintosh +namespace FileSystemIDandChk.Plugins +{ + class LisaFS : Plugin + { + const byte LisaFSv1 = 0x0E; + const byte LisaFSv2 = 0x0F; + const byte LisaFSv3 = 0x11; + const uint E_NAME = 32; + // Maximum string size in LisaFS + const UInt16 FILEID_FREE = 0x0000; + const UInt16 FILEID_BOOT = 0xAAAA; + const UInt16 FILEID_LOADER = 0xBBBB; + const UInt16 FILEID_MDDF = 0x0001; + const UInt16 FILEID_BITMAP = 0x0002; + const UInt16 FILEID_SRECORD = 0x0003; + const UInt16 FILEID_DIRECTORY = 0x0004; + // "Catalog file" + const UInt16 FILEID_ERASED = 0x7FFF; + const UInt16 FILEID_MAX = FILEID_ERASED; + + public LisaFS(PluginBase Core) + { + Name = "Apple Lisa File System"; + PluginUUID = new Guid("7E6034D1-D823-4248-A54D-239742B28391"); + } + + public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionOffset) + { + return false; + } + + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionOffset, out string information) + { + information = ""; + + return; + + /* information = sb.ToString(); + + return; */ + } + + struct Lisa_MDDF + { + // Lisa serial number that init'ed this disk + public UInt32 machine_id; + // Return code of Scavenger + public UInt32 result_scavenge; + // Is password present? + public byte passwd_present; + // Filesystem size in blocks + public UInt32 fs_size; + // Volume size in blocks + public UInt32 vol_size; + // Opened files (memory-only?( + public UInt32 opencount; + // Pascal string, 32+1 bytes, volume name + public string volname; + // Pascal string, 32+1 bytes, password + public string password; + // Filesystem version + public UInt16 fsversion; + // Volume sequence number + public UInt16 volnum; + // Volume ID + public UInt64 volid; + // ID of volume where this volume was backed up + public UInt64 backup_volid; + // Total volumes in sequence + public UInt16 vol_sequence; + // Blocks size of underlying drive (data+tags) + public UInt16 blocksize; + // Data only block size + public UInt16 datasize; + // Size of filesystem clusters + public UInt16 clustersize; + // Files in volume + public UInt16 filecount; + // Size of LisaInfo label + public UInt16 label_size; + // Free blocks + public UInt32 freecount; + // Date of volume creation + public DateTime dtvc; + // Date... + public DateTime dtcc; + // Date of volume backup + public DateTime dtvb; + // Date of volume scavenging + public DateTime dtvs; + // Lisa serial number allowed to use this disk + public UInt32 master_copy_id; + // No idea + public UInt32 copy_thread; + // No idea + public UInt64 overmount_stamp; + // No idea + public UInt16 boot_code; + // No idea + public UInt16 boot_environ; + // Flags are boolean, but Pascal seems to use them as full unsigned 8 bit values + // No idea + public byte privileged; + // Read-only volume + public byte write_protected; + // Master disk + public byte master; + // Copy disk + public byte copy; + // No idea + public byte copy_flag; + // No idea + public byte scavenge_flag; + // Volume is dirty? + public byte vol_left_mounted; + } + + struct Lisa_Tag + { + public UInt32 unknown1; + // 0x00 Unknown + public UInt16 fileID; + // 0x04 File ID + public UInt16 unknown2; + // 0x06 Unknown + public UInt32 unknown3; + // 0x08 Unknown + } + } +}