2017-07-19 16:31:08 +01:00
|
|
|
|
// /***************************************************************************
|
2020-02-27 12:31:25 +00:00
|
|
|
|
// Aaru Data Preservation Suite
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : ODS.cs
|
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
|
|
|
|
|
// Component : Files-11 On-Disk Structure plugin.
|
|
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Identifies the Files-11 On-Disk Structure 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/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2025-08-14 02:49:52 +01:00
|
|
|
|
// Copyright © 2011-2025 Natalia Portillo
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// ****************************************************************************/
|
2014-04-17 19:58:14 +00:00
|
|
|
|
|
2011-06-02 19:34:47 +00:00
|
|
|
|
using System;
|
2017-07-23 21:01:26 +01:00
|
|
|
|
using System.Runtime.InteropServices;
|
2017-07-19 16:31:08 +01:00
|
|
|
|
using System.Text;
|
2020-02-27 00:33:26 +00:00
|
|
|
|
using Aaru.CommonTypes;
|
|
|
|
|
|
using Aaru.CommonTypes.Enums;
|
|
|
|
|
|
using Aaru.CommonTypes.Interfaces;
|
|
|
|
|
|
using Aaru.Console;
|
2020-07-20 15:43:52 +01:00
|
|
|
|
using Aaru.Helpers;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
using Schemas;
|
2020-02-27 00:33:26 +00:00
|
|
|
|
using Marshal = Aaru.Helpers.Marshal;
|
2011-06-02 19:34:47 +00:00
|
|
|
|
|
2020-02-27 00:33:26 +00:00
|
|
|
|
namespace Aaru.Filesystems
|
2011-06-02 19:34:47 +00:00
|
|
|
|
{
|
2016-07-28 22:25:26 +01:00
|
|
|
|
// Information from VMS File System Internals by Kirby McCoy
|
|
|
|
|
|
// ISBN: 1-55558-056-4
|
|
|
|
|
|
// With some hints from http://www.decuslib.com/DECUS/vmslt97b/gnusoftware/gccaxp/7_1/vms/hm2def.h
|
|
|
|
|
|
// Expects the home block to be always in sector #1 (does not check deltas)
|
|
|
|
|
|
// Assumes a sector size of 512 bytes (VMS does on HDDs and optical drives, dunno about M.O.)
|
|
|
|
|
|
// Book only describes ODS-2. Need to test ODS-1 and ODS-5
|
|
|
|
|
|
// There is an ODS with signature "DECFILES11A", yet to be seen
|
|
|
|
|
|
// Time is a 64 bit unsigned integer, tenths of microseconds since 1858/11/17 00:00:00.
|
|
|
|
|
|
// TODO: Implement checksum
|
2021-08-17 14:25:12 +01:00
|
|
|
|
/// <inheritdoc />
|
2021-08-17 21:23:10 +01:00
|
|
|
|
/// <summary>Implements detection of DEC's On-Disk Structure, aka the ODS filesystem</summary>
|
2020-07-22 13:20:25 +01:00
|
|
|
|
public sealed class ODS : IFilesystem
|
2014-04-14 02:29:13 +00:00
|
|
|
|
{
|
2021-08-17 13:56:05 +01:00
|
|
|
|
/// <inheritdoc />
|
2017-12-26 08:01:40 +00:00
|
|
|
|
public FileSystemType XmlFsType { get; private set; }
|
2021-08-17 13:56:05 +01:00
|
|
|
|
/// <inheritdoc />
|
2021-08-17 21:23:10 +01:00
|
|
|
|
public Encoding Encoding { get; private set; }
|
2021-08-17 13:56:05 +01:00
|
|
|
|
/// <inheritdoc />
|
2021-08-17 21:23:10 +01:00
|
|
|
|
public string Name => "Files-11 On-Disk Structure";
|
2021-08-17 13:56:05 +01:00
|
|
|
|
/// <inheritdoc />
|
2021-08-17 21:23:10 +01:00
|
|
|
|
public Guid Id => new Guid("de20633c-8021-4384-aeb0-83b0df14491f");
|
2021-08-17 13:56:05 +01:00
|
|
|
|
/// <inheritdoc />
|
2021-08-17 21:23:10 +01:00
|
|
|
|
public string Author => "Natalia Portillo";
|
2017-10-12 23:54:02 +01:00
|
|
|
|
|
2021-08-17 13:56:05 +01:00
|
|
|
|
/// <inheritdoc />
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public bool Identify(IMediaImage imagePlugin, Partition partition)
|
2014-04-14 02:29:13 +00:00
|
|
|
|
{
|
2020-02-29 18:03:35 +00:00
|
|
|
|
if(2 + partition.Start >= partition.End)
|
|
|
|
|
|
return false;
|
2014-07-09 19:49:14 +01:00
|
|
|
|
|
2020-02-29 18:03:35 +00:00
|
|
|
|
if(imagePlugin.Info.SectorSize < 512)
|
|
|
|
|
|
return false;
|
2014-06-07 17:32:14 +01:00
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
byte[] magicB = new byte[12];
|
2017-12-22 08:43:22 +00:00
|
|
|
|
byte[] hbSector = imagePlugin.ReadSector(1 + partition.Start);
|
2014-04-14 01:14:20 +00:00
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
Array.Copy(hbSector, 0x1F0, magicB, 0, 12);
|
|
|
|
|
|
string magic = Encoding.ASCII.GetString(magicB);
|
2016-04-19 02:11:47 +01:00
|
|
|
|
|
2020-02-27 23:48:41 +00:00
|
|
|
|
AaruConsole.DebugWriteLine("Files-11 plugin", "magic: \"{0}\"", magic);
|
2017-09-13 17:52:54 +01:00
|
|
|
|
|
2020-02-29 18:03:35 +00:00
|
|
|
|
if(magic == "DECFILE11A " ||
|
|
|
|
|
|
magic == "DECFILE11B ")
|
|
|
|
|
|
return true;
|
2017-09-13 17:52:54 +01:00
|
|
|
|
|
|
|
|
|
|
// Optical disc
|
2020-02-29 18:03:35 +00:00
|
|
|
|
if(imagePlugin.Info.XmlMediaType != XmlMediaType.OpticalDisc)
|
|
|
|
|
|
return false;
|
2017-09-13 17:52:54 +01:00
|
|
|
|
|
2020-02-29 18:03:35 +00:00
|
|
|
|
if(hbSector.Length < 0x400)
|
|
|
|
|
|
return false;
|
2017-09-13 17:52:54 +01:00
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
hbSector = imagePlugin.ReadSector(partition.Start);
|
2017-09-13 17:52:54 +01:00
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
Array.Copy(hbSector, 0x3F0, magicB, 0, 12);
|
|
|
|
|
|
magic = Encoding.ASCII.GetString(magicB);
|
2017-12-21 06:06:19 +00:00
|
|
|
|
|
2020-02-27 23:48:41 +00:00
|
|
|
|
AaruConsole.DebugWriteLine("Files-11 plugin", "unaligned magic: \"{0}\"", magic);
|
2017-09-13 17:52:54 +01:00
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
return magic == "DECFILE11A " || magic == "DECFILE11B ";
|
2014-04-14 02:29:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-08-17 13:56:05 +01:00
|
|
|
|
/// <inheritdoc />
|
2017-12-26 08:01:40 +00:00
|
|
|
|
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
|
2020-02-29 18:03:35 +00:00
|
|
|
|
Encoding encoding)
|
2014-04-14 02:29:13 +00:00
|
|
|
|
{
|
2018-06-22 08:08:38 +01:00
|
|
|
|
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
|
2014-04-14 02:29:13 +00:00
|
|
|
|
information = "";
|
2016-04-19 02:11:47 +01:00
|
|
|
|
|
2020-02-29 18:03:35 +00:00
|
|
|
|
var sb = new StringBuilder();
|
2016-04-19 02:11:47 +01:00
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
byte[] hbSector = imagePlugin.ReadSector(1 + partition.Start);
|
2016-04-19 02:11:47 +01:00
|
|
|
|
|
2020-07-20 21:11:32 +01:00
|
|
|
|
HomeBlock homeblock = Marshal.ByteArrayToStructureLittleEndian<HomeBlock>(hbSector);
|
2016-04-19 02:11:47 +01:00
|
|
|
|
|
2017-09-13 17:52:54 +01:00
|
|
|
|
// Optical disc
|
2018-06-22 08:08:38 +01:00
|
|
|
|
if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc &&
|
|
|
|
|
|
StringHandlers.CToString(homeblock.format) != "DECFILE11A " &&
|
2017-12-19 20:33:03 +00:00
|
|
|
|
StringHandlers.CToString(homeblock.format) != "DECFILE11B ")
|
2017-09-13 17:52:54 +01:00
|
|
|
|
{
|
2020-02-29 18:03:35 +00:00
|
|
|
|
if(hbSector.Length < 0x400)
|
|
|
|
|
|
return;
|
2017-09-13 17:52:54 +01:00
|
|
|
|
|
|
|
|
|
|
byte[] tmp = imagePlugin.ReadSector(partition.Start);
|
2017-12-22 08:43:22 +00:00
|
|
|
|
hbSector = new byte[0x200];
|
|
|
|
|
|
Array.Copy(tmp, 0x200, hbSector, 0, 0x200);
|
2017-09-13 17:52:54 +01:00
|
|
|
|
|
2020-07-20 21:11:32 +01:00
|
|
|
|
homeblock = Marshal.ByteArrayToStructureLittleEndian<HomeBlock>(hbSector);
|
2017-09-13 17:52:54 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(StringHandlers.CToString(homeblock.format) != "DECFILE11A " &&
|
2020-02-29 18:03:35 +00:00
|
|
|
|
StringHandlers.CToString(homeblock.format) != "DECFILE11B ")
|
|
|
|
|
|
return;
|
2017-09-13 17:52:54 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-29 18:03:35 +00:00
|
|
|
|
if((homeblock.struclev & 0xFF00) != 0x0200 ||
|
|
|
|
|
|
(homeblock.struclev & 0xFF) != 1 ||
|
2017-12-19 20:33:03 +00:00
|
|
|
|
StringHandlers.CToString(homeblock.format) != "DECFILE11B ")
|
2014-04-14 02:29:13 +00:00
|
|
|
|
sb.AppendLine("The following information may be incorrect for this volume.");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2020-02-29 18:03:35 +00:00
|
|
|
|
if(homeblock.resfiles < 5 ||
|
|
|
|
|
|
homeblock.devtype != 0)
|
|
|
|
|
|
sb.AppendLine("This volume may be corrupted.");
|
|
|
|
|
|
|
|
|
|
|
|
sb.AppendFormat("Volume format is {0}", StringHandlers.SpacePaddedToString(homeblock.format, Encoding)).
|
|
|
|
|
|
AppendLine();
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
sb.AppendFormat("Volume is Level {0} revision {1}", (homeblock.struclev & 0xFF00) >> 8,
|
|
|
|
|
|
homeblock.struclev & 0xFF).AppendLine();
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
sb.AppendFormat("Lowest structure in the volume is Level {0}, revision {1}",
|
|
|
|
|
|
(homeblock.lowstruclev & 0xFF00) >> 8, homeblock.lowstruclev & 0xFF).AppendLine();
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
sb.AppendFormat("Highest structure in the volume is Level {0}, revision {1}",
|
|
|
|
|
|
(homeblock.highstruclev & 0xFF00) >> 8, homeblock.highstruclev & 0xFF).AppendLine();
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
|
|
|
|
|
sb.AppendFormat("{0} sectors per cluster ({1} bytes)", homeblock.cluster, homeblock.cluster * 512).
|
|
|
|
|
|
AppendLine();
|
|
|
|
|
|
|
|
|
|
|
|
sb.AppendFormat("This home block is on sector {0} (VBN {1})", homeblock.homelbn, homeblock.homevbn).
|
|
|
|
|
|
AppendLine();
|
|
|
|
|
|
|
|
|
|
|
|
sb.AppendFormat("Secondary home block is on sector {0} (VBN {1})", homeblock.alhomelbn,
|
|
|
|
|
|
homeblock.alhomevbn).AppendLine();
|
|
|
|
|
|
|
|
|
|
|
|
sb.AppendFormat("Volume bitmap starts in sector {0} (VBN {1})", homeblock.ibmaplbn, homeblock.ibmapvbn).
|
|
|
|
|
|
AppendLine();
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
sb.AppendFormat("Volume bitmap runs for {0} sectors ({1} bytes)", homeblock.ibmapsize,
|
|
|
|
|
|
homeblock.ibmapsize * 512).AppendLine();
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
|
|
|
|
|
sb.AppendFormat("Backup INDEXF.SYS;1 is in sector {0} (VBN {1})", homeblock.altidxlbn, homeblock.altidxvbn).
|
|
|
|
|
|
AppendLine();
|
|
|
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
|
sb.AppendFormat("{0} maximum files on the volume", homeblock.maxfiles).AppendLine();
|
|
|
|
|
|
sb.AppendFormat("{0} reserved files", homeblock.resfiles).AppendLine();
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
|
|
|
|
|
if(homeblock.rvn > 0 &&
|
|
|
|
|
|
homeblock.setcount > 0 &&
|
2017-12-19 20:33:03 +00:00
|
|
|
|
StringHandlers.CToString(homeblock.strucname) != " ")
|
|
|
|
|
|
sb.AppendFormat("Volume is {0} of {1} in set \"{2}\".", homeblock.rvn, homeblock.setcount,
|
2017-12-26 08:01:40 +00:00
|
|
|
|
StringHandlers.SpacePaddedToString(homeblock.strucname, Encoding)).AppendLine();
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
sb.AppendFormat("Volume owner is \"{0}\" (ID 0x{1:X8})",
|
2020-02-29 18:03:35 +00:00
|
|
|
|
StringHandlers.SpacePaddedToString(homeblock.ownername, Encoding), homeblock.volowner).
|
|
|
|
|
|
AppendLine();
|
|
|
|
|
|
|
|
|
|
|
|
sb.AppendFormat("Volume label: \"{0}\"", StringHandlers.SpacePaddedToString(homeblock.volname, Encoding)).
|
|
|
|
|
|
AppendLine();
|
|
|
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
|
sb.AppendFormat("Drive serial number: 0x{0:X8}", homeblock.serialnum).AppendLine();
|
2017-12-23 03:59:48 +00:00
|
|
|
|
sb.AppendFormat("Volume was created on {0}", DateHandlers.VmsToDateTime(homeblock.credate)).AppendLine();
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2016-04-19 02:11:47 +01:00
|
|
|
|
if(homeblock.revdate > 0)
|
2020-02-29 18:03:35 +00:00
|
|
|
|
sb.AppendFormat("Volume was last modified on {0}", DateHandlers.VmsToDateTime(homeblock.revdate)).
|
|
|
|
|
|
AppendLine();
|
|
|
|
|
|
|
2016-04-19 02:11:47 +01:00
|
|
|
|
if(homeblock.copydate > 0)
|
2017-12-23 03:59:48 +00:00
|
|
|
|
sb.AppendFormat("Volume copied on {0}", DateHandlers.VmsToDateTime(homeblock.copydate)).AppendLine();
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
|
sb.AppendFormat("Checksums: 0x{0:X4} and 0x{1:X4}", homeblock.checksum1, homeblock.checksum2).AppendLine();
|
|
|
|
|
|
sb.AppendLine("Flags:");
|
|
|
|
|
|
sb.AppendFormat("Window: {0}", homeblock.window).AppendLine();
|
|
|
|
|
|
sb.AppendFormat("Cached directores: {0}", homeblock.lru_lim).AppendLine();
|
|
|
|
|
|
sb.AppendFormat("Default allocation: {0} blocks", homeblock.extend).AppendLine();
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
|
|
|
|
|
if((homeblock.volchar & 0x01) == 0x01)
|
|
|
|
|
|
sb.AppendLine("Readings should be verified");
|
|
|
|
|
|
|
|
|
|
|
|
if((homeblock.volchar & 0x02) == 0x02)
|
|
|
|
|
|
sb.AppendLine("Writings should be verified");
|
|
|
|
|
|
|
|
|
|
|
|
if((homeblock.volchar & 0x04) == 0x04)
|
|
|
|
|
|
sb.AppendLine("Files should be erased or overwritten when deleted");
|
|
|
|
|
|
|
|
|
|
|
|
if((homeblock.volchar & 0x08) == 0x08)
|
|
|
|
|
|
sb.AppendLine("Highwater mark is to be disabled");
|
|
|
|
|
|
|
|
|
|
|
|
if((homeblock.volchar & 0x10) == 0x10)
|
|
|
|
|
|
sb.AppendLine("Classification checks are enabled");
|
|
|
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
|
sb.AppendLine("Volume permissions (r = read, w = write, c = create, d = delete)");
|
|
|
|
|
|
sb.AppendLine("System, owner, group, world");
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
|
// System
|
2017-12-22 08:43:22 +00:00
|
|
|
|
sb.Append((homeblock.protect & 0x1000) == 0x1000 ? "-" : "r");
|
|
|
|
|
|
sb.Append((homeblock.protect & 0x2000) == 0x2000 ? "-" : "w");
|
|
|
|
|
|
sb.Append((homeblock.protect & 0x4000) == 0x4000 ? "-" : "c");
|
|
|
|
|
|
sb.Append((homeblock.protect & 0x8000) == 0x8000 ? "-" : "d");
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
|
// Owner
|
2017-12-22 08:43:22 +00:00
|
|
|
|
sb.Append((homeblock.protect & 0x100) == 0x100 ? "-" : "r");
|
|
|
|
|
|
sb.Append((homeblock.protect & 0x200) == 0x200 ? "-" : "w");
|
|
|
|
|
|
sb.Append((homeblock.protect & 0x400) == 0x400 ? "-" : "c");
|
|
|
|
|
|
sb.Append((homeblock.protect & 0x800) == 0x800 ? "-" : "d");
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
|
// Group
|
2017-12-22 08:43:22 +00:00
|
|
|
|
sb.Append((homeblock.protect & 0x10) == 0x10 ? "-" : "r");
|
|
|
|
|
|
sb.Append((homeblock.protect & 0x20) == 0x20 ? "-" : "w");
|
|
|
|
|
|
sb.Append((homeblock.protect & 0x40) == 0x40 ? "-" : "c");
|
|
|
|
|
|
sb.Append((homeblock.protect & 0x80) == 0x80 ? "-" : "d");
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
|
// World (other)
|
2017-12-22 08:43:22 +00:00
|
|
|
|
sb.Append((homeblock.protect & 0x1) == 0x1 ? "-" : "r");
|
|
|
|
|
|
sb.Append((homeblock.protect & 0x2) == 0x2 ? "-" : "w");
|
|
|
|
|
|
sb.Append((homeblock.protect & 0x4) == 0x4 ? "-" : "c");
|
|
|
|
|
|
sb.Append((homeblock.protect & 0x8) == 0x8 ? "-" : "d");
|
2016-04-19 02:11:47 +01:00
|
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
|
sb.AppendLine();
|
2016-04-19 02:11:47 +01:00
|
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
|
sb.AppendLine("Unknown structures:");
|
|
|
|
|
|
sb.AppendFormat("Security mask: 0x{0:X8}", homeblock.sec_mask).AppendLine();
|
|
|
|
|
|
sb.AppendFormat("File protection: 0x{0:X4}", homeblock.fileprot).AppendLine();
|
|
|
|
|
|
sb.AppendFormat("Record protection: 0x{0:X4}", homeblock.recprot).AppendLine();
|
2016-04-19 02:11:47 +01:00
|
|
|
|
|
2017-12-26 08:01:40 +00:00
|
|
|
|
XmlFsType = new FileSystemType
|
2017-07-23 21:01:26 +01:00
|
|
|
|
{
|
2020-07-20 04:34:16 +01:00
|
|
|
|
Type = "FILES-11",
|
|
|
|
|
|
ClusterSize = (uint)(homeblock.cluster * 512),
|
2019-04-23 01:38:33 +01:00
|
|
|
|
Clusters = partition.Size / (ulong)(homeblock.cluster * 512),
|
2018-06-22 08:08:38 +01:00
|
|
|
|
VolumeName = StringHandlers.SpacePaddedToString(homeblock.volname, Encoding),
|
2017-12-21 17:58:51 +00:00
|
|
|
|
VolumeSerial = $"{homeblock.serialnum:X8}"
|
2017-07-23 21:01:26 +01:00
|
|
|
|
};
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2016-04-19 02:11:47 +01:00
|
|
|
|
if(homeblock.credate > 0)
|
2015-12-06 05:09:31 +00:00
|
|
|
|
{
|
2018-06-22 08:08:38 +01:00
|
|
|
|
XmlFsType.CreationDate = DateHandlers.VmsToDateTime(homeblock.credate);
|
2017-12-26 08:01:40 +00:00
|
|
|
|
XmlFsType.CreationDateSpecified = true;
|
2015-12-06 05:09:31 +00:00
|
|
|
|
}
|
2018-06-22 08:08:38 +01:00
|
|
|
|
|
2016-04-19 02:11:47 +01:00
|
|
|
|
if(homeblock.revdate > 0)
|
2015-12-06 05:09:31 +00:00
|
|
|
|
{
|
2018-06-22 08:08:38 +01:00
|
|
|
|
XmlFsType.ModificationDate = DateHandlers.VmsToDateTime(homeblock.revdate);
|
2017-12-26 08:01:40 +00:00
|
|
|
|
XmlFsType.ModificationDateSpecified = true;
|
2015-12-06 05:09:31 +00:00
|
|
|
|
}
|
2015-12-05 17:10:27 +00:00
|
|
|
|
|
2014-04-14 02:29:13 +00:00
|
|
|
|
information = sb.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-07-23 21:01:26 +01:00
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
2020-11-11 04:19:18 +00:00
|
|
|
|
readonly struct HomeBlock
|
2014-04-14 02:29:13 +00:00
|
|
|
|
{
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x000, LBN of THIS home block</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly uint homelbn;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x004, LBN of the secondary home block</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly uint alhomelbn;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x008, LBN of backup INDEXF.SYS;1</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly uint altidxlbn;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x00C, High byte contains filesystem version (1, 2 or 5), low byte contains revision (1)</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort struclev;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x00E, Number of blocks each bit of the volume bitmap represents</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort cluster;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x010, VBN of THIS home block</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort homevbn;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x012, VBN of the secondary home block</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort alhomevbn;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x014, VBN of backup INDEXF.SYS;1</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort altidxvbn;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x016, VBN of the bitmap</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort ibmapvbn;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x018, LBN of the bitmap</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly uint ibmaplbn;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x01C, Max files on volume</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly uint maxfiles;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x020, Bitmap size in sectors</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort ibmapsize;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x022, Reserved files, 5 at minimum</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort resfiles;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x024, Device type, ODS-2 defines it as always 0</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort devtype;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x026, Relative volume number (number of the volume in a set)</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort rvn;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x028, Total number of volumes in the set this volume is</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort setcount;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x02A, Flags</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort volchar;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x02C, User ID of the volume owner</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly uint volowner;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x030, Security mask (??)</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly uint sec_mask;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x034, Volume permissions (system, owner, group and other)</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort protect;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x036, Default file protection, unsupported in ODS-2</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort fileprot;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x038, Default file record protection</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort recprot;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x03A, Checksum of all preceding entries</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort checksum1;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x03C, Creation date</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ulong credate;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x044, Window size (pointers for the window)</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly byte window;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x045, Directories to be stored in cache</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly byte lru_lim;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x046, Default allocation size in blocks</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort extend;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x048, Minimum file retention period</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ulong retainmin;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x050, Maximum file retention period</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ulong retainmax;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x058, Last modification date</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ulong revdate;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x060, Minimum security class, 20 bytes</summary>
|
2018-06-22 08:08:38 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly byte[] min_class;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x074, Maximum security class, 20 bytes</summary>
|
2018-06-22 08:08:38 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly byte[] max_class;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x088, File lookup table FID</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort filetab_fid1;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x08A, File lookup table FID</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort filetab_fid2;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x08C, File lookup table FID</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort filetab_fid3;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x08E, Lowest structure level on the volume</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort lowstruclev;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x090, Highest structure level on the volume</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort highstruclev;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x092, Volume copy date (??)</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ulong copydate;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x09A, 302 bytes</summary>
|
2018-06-22 08:08:38 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 302)]
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly byte[] reserved1;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x1C8, Physical drive serial number</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly uint serialnum;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x1CC, Name of the volume set, 12 bytes</summary>
|
2018-06-22 08:08:38 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly byte[] strucname;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x1D8, Volume label, 12 bytes</summary>
|
2018-06-22 08:08:38 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly byte[] volname;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x1E4, Name of the volume owner, 12 bytes</summary>
|
2018-06-22 08:08:38 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly byte[] ownername;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x1F0, ODS-2 defines it as "DECFILE11B", 12 bytes</summary>
|
2018-06-22 08:08:38 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly byte[] format;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x1FC, Reserved</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort reserved2;
|
2015-12-06 07:18:36 +00:00
|
|
|
|
/// <summary>0x1FE, Checksum of preceding 255 words (16 bit units)</summary>
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly ushort checksum2;
|
2014-04-14 02:29:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-04-14 01:14:20 +00:00
|
|
|
|
}
|