// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Version : 1.0
// Author(s) : Natalia Portillo
//
// Component : Component
//
// Revision : $Revision$
// Last change by : $Author$
// Date : $Date$
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using System;
namespace DiscImageChef.Filesystems.LisaFS
{
partial class LisaFS : Filesystem
{
struct MDDF
{
/// 0x00, Filesystem version
public UInt16 fsversion;
/// 0x02, Volume ID
public UInt64 volid;
/// 0x0A, Volume sequence number
public UInt16 volnum;
/// 0x0C, Pascal string, 32+1 bytes, volume name
public string volname;
/// 0x2D, unknown, possible padding
public byte unknown1;
/// 0x2E, Pascal string, 32+1 bytes, password
public string password;
/// 0x4F, unknown, possible padding
public byte unknown2;
/// 0x50, Lisa serial number that init'ed this disk
public UInt32 machine_id;
/// 0x54, ID of the master copy ? no idea really
public UInt32 master_copy_id;
/// 0x58, Date of volume creation
public DateTime dtvc;
/// 0x5C, Date...
public DateTime dtcc;
/// 0x60, Date of volume backup
public DateTime dtvb;
/// 0x64, Date of volume scavenging
public DateTime dtvs;
/// 0x68, unknown
public UInt32 unknown3;
/// 0x6C, block the MDDF is residing on
public UInt32 mddf_block;
/// 0x70, volsize-1
public UInt32 volsize_minus_one;
/// 0x74, volsize-1-mddf_block
public UInt32 volsize_minus_mddf_minus_one;
/// 0x78, Volume size in blocks
public UInt32 vol_size;
/// 0x7C, Blocks size of underlying drive (data+tags)
public UInt16 blocksize;
/// 0x7E, Data only block size
public UInt16 datasize;
/// 0x80, unknown
public UInt16 unknown4;
/// 0x82, unknown
public UInt32 unknown5;
/// 0x86, unknown
public UInt32 unknown6;
/// 0x8A, Size in sectors of filesystem clusters
public UInt16 clustersize;
/// 0x8C, Filesystem size in blocks
public UInt32 fs_size;
/// 0x90, unknown
public UInt32 unknown7;
/// 0x94, unknown
public UInt32 unknown8;
/// 0x98, unknown
public UInt32 unknown9;
/// 0x9C, unknown
public UInt32 unknown10;
/// 0xA0, unknown
public UInt32 unknown11;
/// 0xA4, unknown
public UInt32 unknown12;
/// 0xA8, unknown
public UInt32 unknown13;
/// 0xAC, unknown
public UInt32 unknown14;
/// 0xB0, Files in volume
public UInt16 filecount;
/// 0xB2, unknown
public UInt32 unknown15;
/// 0xB6, unknown
public UInt32 unknown16;
/// 0xBA, Free blocks
public UInt32 freecount;
/// 0xBE, unknown
public UInt16 unknown17;
/// 0xC0, unknown
public UInt32 unknown18;
/// 0xC4, no idea
public UInt64 overmount_stamp;
/// 0xCC, serialization, lisa serial number authorized to use blocked software on this volume
public UInt32 serialization;
/// 0xD0, unknown
public UInt32 unknown19;
/// 0xD4, unknown, possible timestamp
public UInt32 unknown_timestamp;
/// 0xD8, unknown
public UInt32 unknown20;
/// 0xDC, unknown
public UInt32 unknown21;
/// 0xE0, unknown
public UInt32 unknown22;
/// 0xE4, unknown
public UInt32 unknown23;
/// 0xE8, unknown
public UInt32 unknown24;
/// 0xEC, unknown
public UInt32 unknown25;
/// 0xF0, unknown
public UInt32 unknown26;
/// 0xF4, unknown
public UInt32 unknown27;
/// 0xF8, unknown
public UInt32 unknown28;
/// 0xFC, unknown
public UInt32 unknown29;
/// 0x100, unknown
public UInt32 unknown30;
/// 0x104, unknown
public UInt32 unknown31;
/// 0x108, unknown
public UInt32 unknown32;
/// 0x10C, unknown
public UInt32 unknown33;
/// 0x110, unknown
public UInt32 unknown34;
/// 0x114, unknown
public UInt32 unknown35;
/// 0x118, ID of volume where this volume was backed up
public UInt64 backup_volid;
/// 0x120, Size of LisaInfo label
public UInt16 label_size;
/// 0x122, not clear
public UInt16 fs_overhead;
/// 0x124, Return code of Scavenger
public UInt16 result_scavenge;
/// 0x126, No idea
public UInt16 boot_code;
/// 0x128, No idea
public UInt16 boot_environ;
/// 0x12A, unknown
public UInt32 unknown36;
/// 0x12E, unknown
public UInt32 unknown37;
/// 0x132, unknown
public UInt32 unknown38;
/// 0x136, Total volumes in sequence
public UInt16 vol_sequence;
/// 0x138, Volume is dirty?
public byte vol_left_mounted;
/// Is password present? (On-disk position unknown)
public byte passwd_present;
/// Opened files (memory-only?) (On-disk position unknown)
public UInt32 opencount;
/// No idea (On-disk position unknown)
public UInt32 copy_thread;
// Flags are boolean, but Pascal seems to use them as full unsigned 8 bit values
/// No idea (On-disk position unknown)
public byte privileged;
/// Read-only volume (On-disk position unknown)
public byte write_protected;
/// Master disk (On-disk position unknown)
public byte master;
/// Copy disk (On-disk position unknown)
public byte copy;
/// No idea (On-disk position unknown)
public byte copy_flag;
/// No idea (On-disk position unknown)
public byte scavenge_flag;
}
struct Tag
{
/// 0x00 Unknown
public UInt16 unknown;
/// 0x02 File type
public byte fileType;
/// Seems to be always zero
public byte zero;
/// 0x04 File ID. Negative numbers are extents for the file with same absolute value number
public Int16 fileID;
/// 0x06 Relative block
public UInt16 relBlock;
/// 0x08 Next block for this file. 0x8000 bit seems always set, 0x07FF means this is last block
public UInt16 nextBlock;
/// 0x0A Previous block for this file. 0x07FF means this is first block.
public UInt16 prevBlock;
}
struct CatalogEntry
{
/// 0x00, seems to be 0x24 when the entry is valid
public byte marker;
/// 0x01, seems to be always zero
public ushort zero;
/// 0x03, filename, 32-bytes, null-padded
public byte[] filename;
/// 0x23, null-termination
public byte terminator;
///
/// At 0x24
/// 0x03 here for entries 64 bytes long
/// 0x08 here for entries 78 bytes long
/// 0x7C here for entries 50 bytes long
/// This is incomplete, may fail, mostly works...
///
public byte fileType;
/// 0x25, lot of values found here, unknown
public byte unknown;
/// 0x26, file ID, must be positive and bigger than 4
public Int16 fileID;
/// 0x28, creation date
public UInt32 dtc;
/// 0x2C, last modification date
public UInt32 dtm;
/// 0x30, file length in bytes
public Int32 length;
/// 0x34, file length in bytes, including wasted block space
public Int32 wasted;
/// 0x38, unknown
public byte[] tail;
}
struct Extent
{
public Int32 start;
public Int16 length;
}
struct ExtentFile
{
/// 0x00, filename length
public byte filenameLen;
/// 0x01, filename
public byte[] filename;
/// 0x20, unknown
public ushort unknown1;
/// 0x22, 8 bytes
public UInt64 file_uid;
/// 0x2A, unknown
public byte unknown2;
/// 0x2B, entry type? gets modified
public byte etype;
/// 0x2C, file type
public FileType ftype;
/// 0x2D, unknown
public byte unknown3;
/// 0x2E, creation time
public UInt32 dtc;
/// 0x32, last access time
public UInt32 dta;
/// 0x36, modification time
public UInt32 dtm;
/// 0x3A, backup time
public UInt32 dtb;
/// 0x3E, scavenge time
public UInt32 dts;
/// 0x42, machine serial number
public UInt32 serial;
/// 0x46, unknown
public byte unknown4;
/// 0x47, locked file
public byte locked;
/// 0x48, protected file
public byte protect;
/// 0x49, master file
public byte master;
/// 0x4A, scavenged file
public byte scavenged;
/// 0x4B, file closed by os
public byte closed;
/// 0x4C, file left open
public byte open;
/// 0x4D, 11 bytes, unknown
public byte[] unknown5;
/// 0x58, Release number
public UInt16 release;
/// 0x5A, Build number
public UInt16 build;
/// 0x5C, Compatibility level
public UInt16 compatibility;
/// 0x5E, Revision level
public UInt16 revision;
/// 0x60, unknown
public ushort unknown6;
/// 0x62, 0x08 set if password is valid
public byte password_valid;
/// 0x63, 8 bytes, scrambled password
public byte[] password;
/// 0x6B, 3 bytes, unknown
public byte[] unknown7;
/// 0x6E, filesystem overhead
public ushort overhead;
/// 0x70, 16 bytes, unknown
public byte[] unknown8;
/// 0x80, file length in blocks
public Int32 length;
/// 0x84, unknown
public Int32 unknown9;
/// 0x88, extents, can contain up to 41 extents, dunno LisaOS maximum (never seen more than 3)
public Extent[] extents;
/// 0x17E, unknown, empty, padding?
public short unknown10;
/// 0x180, 128 bytes
public byte[] LisaInfo;
}
}
}