2017-07-19 16:31:08 +01:00
|
|
|
|
// /***************************************************************************
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// The Disc Image Chef
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
2017-10-08 20:41:54 +01:00
|
|
|
|
// Filename : Info.cs
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Component : ISO9660 filesystem plugin.
|
2016-07-28 18:13:49 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Identifies the ISO9660 filesystem and shows information.
|
2016-07-28 18:13:49 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ 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/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2018-12-29 17:34:38 +00:00
|
|
|
|
// Copyright © 2011-2019 Natalia Portillo
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// ****************************************************************************/
|
2017-12-19 19:33:46 +00:00
|
|
|
|
|
2011-03-03 18:34:33 +00:00
|
|
|
|
using System;
|
2017-10-09 11:25:47 +01:00
|
|
|
|
using System.Collections.Generic;
|
2017-10-08 20:28:56 +01:00
|
|
|
|
using System.Runtime.InteropServices;
|
2014-04-14 02:29:13 +00:00
|
|
|
|
using System.Text;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
using DiscImageChef.Checksums;
|
2017-07-19 16:31:08 +01:00
|
|
|
|
using DiscImageChef.CommonTypes;
|
2018-06-25 19:08:16 +01:00
|
|
|
|
using DiscImageChef.CommonTypes.Interfaces;
|
2015-10-18 22:04:03 +01:00
|
|
|
|
using DiscImageChef.Console;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
using DiscImageChef.Decoders.Sega;
|
|
|
|
|
|
using Schemas;
|
2015-10-18 22:04:03 +01:00
|
|
|
|
|
2017-10-08 20:41:54 +01:00
|
|
|
|
namespace DiscImageChef.Filesystems.ISO9660
|
2011-03-03 18:34:33 +00:00
|
|
|
|
{
|
2017-12-21 16:27:09 +00:00
|
|
|
|
public partial class ISO9660
|
2011-03-03 18:34:33 +00:00
|
|
|
|
{
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public bool Identify(IMediaImage imagePlugin, Partition partition)
|
2011-03-03 18:34:33 +00:00
|
|
|
|
{
|
2014-04-14 01:14:20 +00:00
|
|
|
|
// ISO9660 is designed for 2048 bytes/sector devices
|
2017-12-26 06:05:12 +00:00
|
|
|
|
if(imagePlugin.Info.SectorSize < 2048) return false;
|
2014-04-14 01:14:20 +00:00
|
|
|
|
|
|
|
|
|
|
// ISO9660 Primary Volume Descriptor starts at sector 16, so that's minimal size.
|
2017-12-20 17:26:28 +00:00
|
|
|
|
if(partition.End <= 16 + partition.Start) return false;
|
2011-03-03 18:34:33 +00:00
|
|
|
|
|
2014-04-14 01:14:20 +00:00
|
|
|
|
// Read to Volume Descriptor
|
2017-12-22 07:28:54 +00:00
|
|
|
|
byte[] vdSector = imagePlugin.ReadSector(16 + partition.Start);
|
2014-04-14 01:14:20 +00:00
|
|
|
|
|
2017-12-30 01:22:23 +00:00
|
|
|
|
int xaOff = 0;
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(vdSector.Length == 2336) xaOff = 8;
|
2015-12-06 07:51:46 +00:00
|
|
|
|
|
2017-12-30 01:22:23 +00:00
|
|
|
|
byte vdType = vdSector[0 + xaOff];
|
2017-12-22 07:28:54 +00:00
|
|
|
|
byte[] vdMagic = new byte[5];
|
|
|
|
|
|
byte[] hsMagic = new byte[5];
|
2011-03-03 18:34:33 +00:00
|
|
|
|
|
2017-10-08 22:47:09 +01:00
|
|
|
|
// This indicates the end of a volume descriptor. HighSierra here would have 16 so no problem
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(vdType == 255) return false;
|
2011-03-03 18:34:33 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
Array.Copy(vdSector, 0x001 + xaOff, vdMagic, 0, 5);
|
|
|
|
|
|
Array.Copy(vdSector, 0x009 + xaOff, hsMagic, 0, 5);
|
2015-12-06 07:51:46 +00:00
|
|
|
|
|
2017-12-26 06:36:15 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ISO9660 plugin", "VDMagic = {0}", Encoding.ASCII.GetString(vdMagic));
|
|
|
|
|
|
DicConsole.DebugWriteLine("ISO9660 plugin", "HSMagic = {0}", Encoding.ASCII.GetString(hsMagic));
|
2011-03-03 18:34:33 +00:00
|
|
|
|
|
2017-12-30 01:22:23 +00:00
|
|
|
|
return Encoding.ASCII.GetString(vdMagic) == ISO_MAGIC ||
|
2017-12-26 06:36:15 +00:00
|
|
|
|
Encoding.ASCII.GetString(hsMagic) == HIGH_SIERRA_MAGIC ||
|
|
|
|
|
|
Encoding.ASCII.GetString(vdMagic) == CDI_MAGIC;
|
2014-04-14 02:29:13 +00:00
|
|
|
|
}
|
2016-04-19 02:11:47 +01:00
|
|
|
|
|
2017-12-26 08:01:40 +00:00
|
|
|
|
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
|
2017-12-30 01:22:23 +00:00
|
|
|
|
Encoding encoding)
|
2016-04-19 02:11:47 +01:00
|
|
|
|
{
|
2018-06-22 08:08:38 +01:00
|
|
|
|
Encoding = encoding ?? Encoding.ASCII;
|
|
|
|
|
|
information = "";
|
2017-12-22 07:28:54 +00:00
|
|
|
|
StringBuilder isoMetadata = new StringBuilder();
|
2017-12-30 01:22:23 +00:00
|
|
|
|
byte[] vdMagic = new byte[5]; // Volume Descriptor magic "CD001"
|
|
|
|
|
|
byte[] hsMagic = new byte[5]; // Volume Descriptor magic "CDROM"
|
2011-03-03 18:34:33 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
string bootSpec = "";
|
2011-03-03 18:34:33 +00:00
|
|
|
|
|
2017-12-30 01:22:23 +00:00
|
|
|
|
PrimaryVolumeDescriptor? pvd = null;
|
|
|
|
|
|
PrimaryVolumeDescriptor? jolietvd = null;
|
|
|
|
|
|
BootRecord? bvd = null;
|
|
|
|
|
|
HighSierraPrimaryVolumeDescriptor? hsvd = null;
|
|
|
|
|
|
FileStructureVolumeDescriptor? fsvd = null;
|
|
|
|
|
|
ElToritoBootRecord? torito = null;
|
2017-10-08 20:28:56 +01:00
|
|
|
|
|
2014-04-14 01:14:20 +00:00
|
|
|
|
// ISO9660 is designed for 2048 bytes/sector devices
|
2017-12-26 06:05:12 +00:00
|
|
|
|
if(imagePlugin.Info.SectorSize < 2048) return;
|
2011-03-03 18:34:33 +00:00
|
|
|
|
|
2014-04-14 01:14:20 +00:00
|
|
|
|
// ISO9660 Primary Volume Descriptor starts at sector 16, so that's minimal size.
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(partition.End < 16) return;
|
2011-03-03 18:34:33 +00:00
|
|
|
|
|
2014-04-14 01:14:20 +00:00
|
|
|
|
ulong counter = 0;
|
2011-03-03 18:34:33 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
byte[] vdSector = imagePlugin.ReadSector(16 + counter + partition.Start);
|
2017-12-30 01:22:23 +00:00
|
|
|
|
int xaOff = vdSector.Length == 2336 ? 8 : 0;
|
2017-12-22 07:28:54 +00:00
|
|
|
|
Array.Copy(vdSector, 0x009 + xaOff, hsMagic, 0, 5);
|
2017-12-30 01:22:23 +00:00
|
|
|
|
bool highSierra = Encoding.GetString(hsMagic) == HIGH_SIERRA_MAGIC;
|
|
|
|
|
|
int hsOff = 0;
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(highSierra) hsOff = 8;
|
2017-12-30 01:22:23 +00:00
|
|
|
|
bool cdi = false;
|
2017-10-08 22:47:09 +01:00
|
|
|
|
|
2016-04-19 02:11:47 +01:00
|
|
|
|
while(true)
|
2011-03-03 18:34:33 +00:00
|
|
|
|
{
|
2015-10-18 22:04:03 +01:00
|
|
|
|
DicConsole.DebugWriteLine("ISO9660 plugin", "Processing VD loop no. {0}", counter);
|
2011-03-03 18:34:33 +00:00
|
|
|
|
// Seek to Volume Descriptor
|
2017-07-19 16:37:11 +01:00
|
|
|
|
DicConsole.DebugWriteLine("ISO9660 plugin", "Reading sector {0}", 16 + counter + partition.Start);
|
2018-06-22 08:08:38 +01:00
|
|
|
|
byte[] vdSectorTmp = imagePlugin.ReadSector(16 + counter + partition.Start);
|
|
|
|
|
|
vdSector = new byte[vdSectorTmp.Length - xaOff];
|
2017-12-22 07:28:54 +00:00
|
|
|
|
Array.Copy(vdSectorTmp, xaOff, vdSector, 0, vdSector.Length);
|
2011-03-03 18:34:33 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
byte vdType = vdSector[0 + hsOff]; // Volume Descriptor Type, should be 1 or 2.
|
|
|
|
|
|
DicConsole.DebugWriteLine("ISO9660 plugin", "VDType = {0}", vdType);
|
2011-03-03 18:34:33 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(vdType == 255) // Supposedly we are in the PVD.
|
2011-03-03 18:34:33 +00:00
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(counter == 0) return;
|
|
|
|
|
|
|
2011-03-03 18:34:33 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
Array.Copy(vdSector, 0x001, vdMagic, 0, 5);
|
|
|
|
|
|
Array.Copy(vdSector, 0x009, hsMagic, 0, 5);
|
2011-03-03 18:34:33 +00:00
|
|
|
|
|
2017-12-26 08:01:40 +00:00
|
|
|
|
if(Encoding.GetString(vdMagic) != ISO_MAGIC && Encoding.GetString(hsMagic) != HIGH_SIERRA_MAGIC &&
|
|
|
|
|
|
Encoding.GetString(vdMagic) != CDI_MAGIC
|
2017-12-19 20:33:03 +00:00
|
|
|
|
) // Recognized, it is an ISO9660, now check for rest of data.
|
2011-03-03 18:34:33 +00:00
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(counter == 0) return;
|
|
|
|
|
|
|
2011-03-03 18:34:33 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 08:01:40 +00:00
|
|
|
|
cdi |= Encoding.GetString(vdMagic) == CDI_MAGIC;
|
2017-10-13 21:50:10 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
switch(vdType)
|
2011-03-03 18:34:33 +00:00
|
|
|
|
{
|
2017-10-09 00:32:17 +01:00
|
|
|
|
case 0:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
IntPtr ptr = Marshal.AllocHGlobal(2048);
|
2017-12-22 07:28:54 +00:00
|
|
|
|
Marshal.Copy(vdSector, hsOff, ptr, 2048 - hsOff);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
bvd = (BootRecord)Marshal.PtrToStructure(ptr, typeof(BootRecord));
|
|
|
|
|
|
Marshal.FreeHGlobal(ptr);
|
|
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
bootSpec = "Unknown";
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-12-26 08:01:40 +00:00
|
|
|
|
if(Encoding.GetString(bvd.Value.system_id).Substring(0, 23) == "EL TORITO SPECIFICATION")
|
2011-03-03 18:34:33 +00:00
|
|
|
|
{
|
2017-12-22 07:28:54 +00:00
|
|
|
|
bootSpec = "El Torito";
|
2017-12-30 01:22:23 +00:00
|
|
|
|
ptr = Marshal.AllocHGlobal(2048);
|
2017-12-22 07:28:54 +00:00
|
|
|
|
Marshal.Copy(vdSector, hsOff, ptr, 2048 - hsOff);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
torito = (ElToritoBootRecord)Marshal.PtrToStructure(ptr, typeof(ElToritoBootRecord));
|
2017-10-08 20:28:56 +01:00
|
|
|
|
Marshal.FreeHGlobal(ptr);
|
2011-03-03 18:34:33 +00:00
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2011-03-03 18:34:33 +00:00
|
|
|
|
case 1:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(highSierra)
|
2011-03-03 18:34:33 +00:00
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
IntPtr ptr = Marshal.AllocHGlobal(2048);
|
2017-12-22 07:28:54 +00:00
|
|
|
|
Marshal.Copy(vdSector, 0, ptr, 2048);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
hsvd =
|
|
|
|
|
|
(HighSierraPrimaryVolumeDescriptor)
|
|
|
|
|
|
Marshal.PtrToStructure(ptr, typeof(HighSierraPrimaryVolumeDescriptor));
|
|
|
|
|
|
Marshal.FreeHGlobal(ptr);
|
2011-03-03 18:34:33 +00:00
|
|
|
|
}
|
2017-12-22 07:28:54 +00:00
|
|
|
|
else if(cdi)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
fsvd =
|
2019-02-27 08:49:42 +00:00
|
|
|
|
Helpers.Marshal.ByteArrayToStructureBigEndian<FileStructureVolumeDescriptor>(vdSector);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else
|
2011-03-03 18:34:33 +00:00
|
|
|
|
{
|
2017-10-08 20:28:56 +01:00
|
|
|
|
IntPtr ptr = Marshal.AllocHGlobal(2048);
|
2017-12-22 07:28:54 +00:00
|
|
|
|
Marshal.Copy(vdSector, 0, ptr, 2048);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
pvd = (PrimaryVolumeDescriptor)Marshal.PtrToStructure(ptr, typeof(PrimaryVolumeDescriptor));
|
2017-10-08 20:28:56 +01:00
|
|
|
|
Marshal.FreeHGlobal(ptr);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
2017-12-30 01:22:23 +00:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
{
|
|
|
|
|
|
IntPtr ptr = Marshal.AllocHGlobal(2048);
|
2017-12-22 07:28:54 +00:00
|
|
|
|
Marshal.Copy(vdSector, 0, ptr, 2048);
|
2017-12-24 02:37:41 +00:00
|
|
|
|
PrimaryVolumeDescriptor svd =
|
|
|
|
|
|
(PrimaryVolumeDescriptor)Marshal.PtrToStructure(ptr, typeof(PrimaryVolumeDescriptor));
|
2017-12-19 20:33:03 +00:00
|
|
|
|
Marshal.FreeHGlobal(ptr);
|
2017-10-08 20:28:56 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
// Check if this is Joliet
|
2018-06-22 08:08:38 +01:00
|
|
|
|
if(svd.escape_sequences[0] == '%' && svd.escape_sequences[1] == '/')
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(svd.escape_sequences[2] == '@' || svd.escape_sequences[2] == 'C' ||
|
2017-12-30 01:22:23 +00:00
|
|
|
|
svd.escape_sequences[2] == 'E')
|
|
|
|
|
|
jolietvd = svd;
|
2017-12-24 02:37:41 +00:00
|
|
|
|
else
|
|
|
|
|
|
DicConsole.WriteLine("ISO9660 plugin", "Found unknown supplementary volume descriptor");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2011-03-03 18:34:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
counter++;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
DecodedVolumeDescriptor decodedVd;
|
|
|
|
|
|
DecodedVolumeDescriptor decodedJolietVd = new DecodedVolumeDescriptor();
|
2012-08-03 05:43:58 +00:00
|
|
|
|
|
2017-12-26 08:01:40 +00:00
|
|
|
|
XmlFsType = new FileSystemType();
|
2017-10-08 20:28:56 +01:00
|
|
|
|
|
2017-10-13 21:50:10 +01:00
|
|
|
|
if(pvd == null && hsvd == null && fsvd == null)
|
2017-10-08 20:28:56 +01:00
|
|
|
|
{
|
|
|
|
|
|
information = "ERROR: Could not find primary volume descriptor";
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(highSierra) decodedVd = DecodeVolumeDescriptor(hsvd.Value);
|
2018-06-22 08:08:38 +01:00
|
|
|
|
else if(cdi) decodedVd = DecodeVolumeDescriptor(fsvd.Value);
|
|
|
|
|
|
else decodedVd = DecodeVolumeDescriptor(pvd.Value);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(jolietvd != null) decodedJolietVd = DecodeJolietDescriptor(jolietvd.Value);
|
2012-08-03 05:43:58 +00:00
|
|
|
|
|
2017-10-13 22:15:44 +01:00
|
|
|
|
uint rootLocation = 0;
|
2017-12-30 01:22:23 +00:00
|
|
|
|
uint rootSize = 0;
|
2017-10-09 09:21:30 +01:00
|
|
|
|
|
2017-10-13 22:15:44 +01:00
|
|
|
|
// No need to read root on CD-i, as extensions are not supported...
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(!cdi)
|
2017-10-09 09:21:30 +01:00
|
|
|
|
{
|
2017-12-22 07:28:54 +00:00
|
|
|
|
rootLocation = highSierra
|
2017-12-19 20:33:03 +00:00
|
|
|
|
? hsvd.Value.root_directory_record.extent
|
|
|
|
|
|
: pvd.Value.root_directory_record.extent;
|
2017-10-13 22:15:44 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(highSierra)
|
2017-10-13 22:15:44 +01:00
|
|
|
|
{
|
|
|
|
|
|
rootSize = hsvd.Value.root_directory_record.size / hsvd.Value.logical_block_size;
|
2017-12-30 01:22:23 +00:00
|
|
|
|
if(hsvd.Value.root_directory_record.size % hsvd.Value.logical_block_size > 0) rootSize++;
|
2017-10-13 22:15:44 +01:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
rootSize = pvd.Value.root_directory_record.size / pvd.Value.logical_block_size;
|
2017-12-30 01:22:23 +00:00
|
|
|
|
if(pvd.Value.root_directory_record.size % pvd.Value.logical_block_size > 0) rootSize++;
|
2017-10-13 22:15:44 +01:00
|
|
|
|
}
|
2017-10-09 09:21:30 +01:00
|
|
|
|
}
|
2017-10-09 02:26:45 +01:00
|
|
|
|
|
2018-02-08 02:59:42 +00:00
|
|
|
|
byte[] rootDir = new byte[0];
|
2017-12-30 01:22:23 +00:00
|
|
|
|
int rootOff = 0;
|
|
|
|
|
|
bool xaExtensions = false;
|
|
|
|
|
|
bool apple = false;
|
|
|
|
|
|
bool susp = false;
|
|
|
|
|
|
bool rrip = false;
|
|
|
|
|
|
bool ziso = false;
|
|
|
|
|
|
bool amiga = false;
|
|
|
|
|
|
bool aaip = false;
|
|
|
|
|
|
List<ContinuationArea> contareas = new List<ContinuationArea>();
|
|
|
|
|
|
List<byte[]> refareas = new List<byte[]>();
|
|
|
|
|
|
StringBuilder suspInformation = new StringBuilder();
|
2017-10-09 09:48:28 +01:00
|
|
|
|
|
2018-02-08 02:59:42 +00:00
|
|
|
|
if(rootLocation + rootSize < imagePlugin.Info.Sectors)
|
|
|
|
|
|
rootDir = imagePlugin.ReadSectors(rootLocation, rootSize);
|
|
|
|
|
|
|
2017-10-09 09:48:28 +01:00
|
|
|
|
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
2017-10-09 02:26:45 +01:00
|
|
|
|
|
|
|
|
|
|
// Walk thru root directory to see system area extensions in use
|
2017-12-22 07:28:54 +00:00
|
|
|
|
while(rootOff + Marshal.SizeOf(typeof(DirectoryRecord)) < rootDir.Length && !cdi)
|
2017-10-09 02:26:45 +01:00
|
|
|
|
{
|
|
|
|
|
|
DirectoryRecord record = new DirectoryRecord();
|
2017-12-30 01:22:23 +00:00
|
|
|
|
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(record));
|
2017-12-22 07:28:54 +00:00
|
|
|
|
Marshal.Copy(rootDir, rootOff, ptr, Marshal.SizeOf(record));
|
2017-10-09 02:26:45 +01:00
|
|
|
|
record = (DirectoryRecord)Marshal.PtrToStructure(ptr, typeof(DirectoryRecord));
|
|
|
|
|
|
Marshal.FreeHGlobal(ptr);
|
|
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
int saOff = Marshal.SizeOf(record) + record.name_len;
|
2018-06-22 08:08:38 +01:00
|
|
|
|
saOff += saOff % 2;
|
2017-12-22 07:28:54 +00:00
|
|
|
|
int saLen = record.length - saOff;
|
2017-10-09 02:26:45 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(saLen > 0 && rootOff + saOff + saLen <= rootDir.Length)
|
2017-10-09 02:26:45 +01:00
|
|
|
|
{
|
2017-12-22 07:28:54 +00:00
|
|
|
|
byte[] sa = new byte[saLen];
|
|
|
|
|
|
Array.Copy(rootDir, rootOff + saOff, sa, 0, saLen);
|
|
|
|
|
|
saOff = 0;
|
2017-10-09 02:26:45 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
while(saOff < saLen)
|
2017-10-09 02:26:45 +01:00
|
|
|
|
{
|
2017-10-09 09:48:28 +01:00
|
|
|
|
bool noneFound = true;
|
|
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(Marshal.SizeOf(typeof(CdromXa)) + saOff <= saLen)
|
2017-10-09 09:48:28 +01:00
|
|
|
|
{
|
2019-02-27 08:49:42 +00:00
|
|
|
|
CdromXa xa = Helpers.Marshal.ByteArrayToStructureBigEndian<CdromXa>(sa);
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(xa.signature == XA_MAGIC)
|
2017-10-09 09:48:28 +01:00
|
|
|
|
{
|
2017-12-30 01:22:23 +00:00
|
|
|
|
xaExtensions = true;
|
|
|
|
|
|
saOff += Marshal.SizeOf(typeof(CdromXa));
|
|
|
|
|
|
noneFound = false;
|
2017-10-09 09:48:28 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(saOff + 2 >= saLen) break;
|
2017-10-09 09:48:28 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
ushort nextSignature = BigEndianBitConverter.ToUInt16(sa, saOff);
|
2017-10-09 09:48:28 +01:00
|
|
|
|
|
2017-12-24 02:37:41 +00:00
|
|
|
|
switch(nextSignature)
|
|
|
|
|
|
{
|
2017-12-21 04:43:29 +00:00
|
|
|
|
// Easy, contains size field
|
2017-12-22 07:28:54 +00:00
|
|
|
|
case APPLE_MAGIC:
|
2017-12-30 01:22:23 +00:00
|
|
|
|
apple = true;
|
|
|
|
|
|
saOff += sa[saOff + 2];
|
|
|
|
|
|
noneFound = false;
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
|
|
|
|
|
// Not easy, contains size field
|
2017-12-22 07:28:54 +00:00
|
|
|
|
case APPLE_MAGIC_OLD:
|
2018-06-22 08:08:38 +01:00
|
|
|
|
apple = true;
|
2017-12-22 07:28:54 +00:00
|
|
|
|
AppleOldId appleId = (AppleOldId)sa[saOff + 2];
|
2018-06-22 08:08:38 +01:00
|
|
|
|
noneFound = false;
|
2017-10-09 11:25:47 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
switch(appleId)
|
2017-10-09 11:25:47 +01:00
|
|
|
|
{
|
2017-12-21 04:43:29 +00:00
|
|
|
|
case AppleOldId.ProDOS:
|
2017-12-22 07:28:54 +00:00
|
|
|
|
saOff += Marshal.SizeOf(typeof(AppleProDOSOldSystemUse));
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case AppleOldId.TypeCreator:
|
|
|
|
|
|
case AppleOldId.TypeCreatorBundle:
|
2017-12-22 07:28:54 +00:00
|
|
|
|
saOff += Marshal.SizeOf(typeof(AppleHFSTypeCreatorSystemUse));
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case AppleOldId.TypeCreatorIcon:
|
|
|
|
|
|
case AppleOldId.TypeCreatorIconBundle:
|
2017-12-22 07:28:54 +00:00
|
|
|
|
saOff += Marshal.SizeOf(typeof(AppleHFSIconSystemUse));
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case AppleOldId.HFS:
|
2017-12-22 07:28:54 +00:00
|
|
|
|
saOff += Marshal.SizeOf(typeof(AppleHFSOldSystemUse));
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
2017-10-09 11:25:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
|
|
|
|
|
// IEEE-P1281 aka SUSP 1.12
|
2017-12-22 07:28:54 +00:00
|
|
|
|
case SUSP_INDICATOR:
|
2017-12-30 01:22:23 +00:00
|
|
|
|
susp = true;
|
|
|
|
|
|
saOff += sa[saOff + 2];
|
|
|
|
|
|
noneFound = false;
|
2017-12-21 04:43:29 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
while(saOff + 2 < saLen)
|
2017-10-09 11:25:47 +01:00
|
|
|
|
{
|
2017-12-22 07:28:54 +00:00
|
|
|
|
nextSignature = BigEndianBitConverter.ToUInt16(sa, saOff);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
|
2017-12-24 02:37:41 +00:00
|
|
|
|
switch(nextSignature)
|
|
|
|
|
|
{
|
2017-12-22 07:28:54 +00:00
|
|
|
|
case APPLE_MAGIC:
|
2017-12-30 01:22:23 +00:00
|
|
|
|
if(sa[saOff + 3] == 1 && sa[saOff + 2] == 7) apple = true;
|
|
|
|
|
|
else apple |= sa[saOff + 3] != 1;
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
2017-12-22 07:28:54 +00:00
|
|
|
|
case SUSP_CONTINUATION when saOff + sa[saOff + 2] <= saLen:
|
|
|
|
|
|
byte[] ce = new byte[sa[saOff + 2]];
|
|
|
|
|
|
Array.Copy(sa, saOff, ce, 0, ce.Length);
|
2019-02-27 08:49:42 +00:00
|
|
|
|
ContinuationArea ca =
|
|
|
|
|
|
Helpers.Marshal.ByteArrayToStructureBigEndian<ContinuationArea>(ce);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
contareas.Add(ca);
|
|
|
|
|
|
break;
|
2018-06-22 08:08:38 +01:00
|
|
|
|
case SUSP_REFERENCE when saOff + sa[saOff + 2] <= saLen:
|
2017-12-22 07:28:54 +00:00
|
|
|
|
byte[] er = new byte[sa[saOff + 2]];
|
|
|
|
|
|
Array.Copy(sa, saOff, er, 0, er.Length);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
refareas.Add(er);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-30 01:22:23 +00:00
|
|
|
|
rrip |= nextSignature == RRIP_MAGIC ||
|
|
|
|
|
|
nextSignature == RRIP_POSIX_ATTRIBUTES ||
|
|
|
|
|
|
nextSignature == RRIP_POSIX_DEV_NO ||
|
|
|
|
|
|
nextSignature == RRIP_SYMLINK ||
|
|
|
|
|
|
nextSignature == RRIP_NAME ||
|
|
|
|
|
|
nextSignature == RRIP_CHILDLINK ||
|
|
|
|
|
|
nextSignature == RRIP_PARENTLINK ||
|
|
|
|
|
|
nextSignature == RRIP_RELOCATED_DIR ||
|
|
|
|
|
|
nextSignature == RRIP_TIMESTAMPS || nextSignature == RRIP_SPARSE;
|
|
|
|
|
|
|
|
|
|
|
|
ziso |= nextSignature == ZISO_MAGIC;
|
2017-12-22 07:28:54 +00:00
|
|
|
|
amiga |= nextSignature == AMIGA_MAGIC;
|
2018-06-22 08:08:38 +01:00
|
|
|
|
aaip |= nextSignature == AAIP_MAGIC || nextSignature == AAIP_MAGIC_OLD &&
|
|
|
|
|
|
sa[saOff + 3] == 1 &&
|
|
|
|
|
|
sa[saOff + 2] >= 9;
|
2017-12-21 04:43:29 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
saOff += sa[saOff + 2];
|
2017-12-21 04:43:29 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(nextSignature == SUSP_TERMINATOR) break;
|
2017-10-09 11:25:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
2017-10-09 11:25:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(noneFound) break;
|
2017-10-09 02:26:45 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rootOff += record.length;
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(record.length == 0) break;
|
2017-10-09 02:26:45 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-10-09 11:25:47 +01:00
|
|
|
|
foreach(ContinuationArea ca in contareas)
|
|
|
|
|
|
{
|
2017-12-22 07:28:54 +00:00
|
|
|
|
uint caLen = (ca.ca_length_be + ca.offset_be) /
|
2017-12-24 02:37:41 +00:00
|
|
|
|
(highSierra ? hsvd.Value.logical_block_size : pvd.Value.logical_block_size);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if((ca.ca_length_be + ca.offset_be) %
|
2017-12-22 07:28:54 +00:00
|
|
|
|
(highSierra ? hsvd.Value.logical_block_size : pvd.Value.logical_block_size) > 0) caLen++;
|
2017-10-09 11:25:47 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
byte[] caSectors = imagePlugin.ReadSectors(ca.block_be, caLen);
|
2017-12-30 01:22:23 +00:00
|
|
|
|
byte[] caData = new byte[ca.ca_length_be];
|
2017-12-22 07:28:54 +00:00
|
|
|
|
Array.Copy(caSectors, ca.offset_be, caData, 0, ca.ca_length_be);
|
|
|
|
|
|
int caOff = 0;
|
2017-10-09 11:25:47 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
while(caOff < ca.ca_length_be)
|
2017-10-09 11:25:47 +01:00
|
|
|
|
{
|
2017-12-22 07:28:54 +00:00
|
|
|
|
ushort nextSignature = BigEndianBitConverter.ToUInt16(caData, caOff);
|
2017-10-09 11:25:47 +01:00
|
|
|
|
|
2017-12-24 02:37:41 +00:00
|
|
|
|
switch(nextSignature)
|
|
|
|
|
|
{
|
2017-12-21 04:43:29 +00:00
|
|
|
|
// Apple never said to include its extensions inside a continuation area, but just in case
|
2017-12-22 07:28:54 +00:00
|
|
|
|
case APPLE_MAGIC:
|
2017-12-30 01:22:23 +00:00
|
|
|
|
if(caData[caOff + 3] == 1 && caData[caOff + 2] == 7) apple = true;
|
|
|
|
|
|
else apple |= caData[caOff + 3] != 1;
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
2018-06-22 08:08:38 +01:00
|
|
|
|
case SUSP_REFERENCE when caOff + caData[caOff + 2] <= ca.ca_length_be:
|
2017-12-22 07:28:54 +00:00
|
|
|
|
byte[] er = new byte[caData[caOff + 2]];
|
|
|
|
|
|
Array.Copy(caData, caOff, er, 0, er.Length);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
refareas.Add(er);
|
|
|
|
|
|
break;
|
2017-10-09 11:25:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-30 01:22:23 +00:00
|
|
|
|
rrip |= nextSignature == RRIP_MAGIC || nextSignature == RRIP_POSIX_ATTRIBUTES ||
|
|
|
|
|
|
nextSignature == RRIP_POSIX_DEV_NO || nextSignature == RRIP_SYMLINK ||
|
|
|
|
|
|
nextSignature == RRIP_NAME || nextSignature == RRIP_CHILDLINK ||
|
|
|
|
|
|
nextSignature == RRIP_PARENTLINK || nextSignature == RRIP_RELOCATED_DIR ||
|
|
|
|
|
|
nextSignature == RRIP_TIMESTAMPS || nextSignature == RRIP_SPARSE;
|
2017-10-09 12:07:48 +01:00
|
|
|
|
|
2017-12-30 01:22:23 +00:00
|
|
|
|
ziso |= nextSignature == ZISO_MAGIC;
|
2017-12-22 07:28:54 +00:00
|
|
|
|
amiga |= nextSignature == AMIGA_MAGIC;
|
2018-06-22 08:08:38 +01:00
|
|
|
|
aaip |= nextSignature == AAIP_MAGIC || nextSignature == AAIP_MAGIC_OLD && caData[caOff + 3] == 1 &&
|
|
|
|
|
|
caData[caOff + 2] >= 9;
|
2017-10-09 12:21:38 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
caOff += caData[caOff + 2];
|
2017-10-09 11:25:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(refareas.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
suspInformation.AppendLine("----------------------------------------");
|
|
|
|
|
|
suspInformation.AppendLine("SYSTEM USE SHARING PROTOCOL INFORMATION:");
|
|
|
|
|
|
suspInformation.AppendLine("----------------------------------------");
|
|
|
|
|
|
|
|
|
|
|
|
counter = 1;
|
|
|
|
|
|
foreach(byte[] erb in refareas)
|
|
|
|
|
|
{
|
2019-02-27 08:49:42 +00:00
|
|
|
|
ReferenceArea er = Helpers.Marshal.ByteArrayToStructureBigEndian<ReferenceArea>(erb);
|
2018-06-22 08:08:38 +01:00
|
|
|
|
string extId =
|
2017-12-30 01:22:23 +00:00
|
|
|
|
Encoding.GetString(erb, Marshal.SizeOf(er), er.id_len);
|
|
|
|
|
|
string extDes =
|
|
|
|
|
|
Encoding.GetString(erb, Marshal.SizeOf(er) + er.id_len, er.des_len);
|
|
|
|
|
|
string extSrc =
|
|
|
|
|
|
Encoding.GetString(erb, Marshal.SizeOf(er) + er.id_len + er.des_len, er.src_len);
|
2018-06-22 08:08:38 +01:00
|
|
|
|
suspInformation.AppendFormat("Extension: {0}", counter).AppendLine();
|
2017-12-22 07:28:54 +00:00
|
|
|
|
suspInformation.AppendFormat("\tID: {0}, version {1}", extId, er.ext_ver).AppendLine();
|
2018-06-22 08:08:38 +01:00
|
|
|
|
suspInformation.AppendFormat("\tDescription: {0}", extDes).AppendLine();
|
|
|
|
|
|
suspInformation.AppendFormat("\tSource: {0}", extSrc).AppendLine();
|
2017-10-09 11:25:47 +01:00
|
|
|
|
counter++;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2011-03-03 18:34:33 +00:00
|
|
|
|
|
2017-12-30 01:22:23 +00:00
|
|
|
|
byte[] ipbinSector = imagePlugin.ReadSector(0 + partition.Start);
|
|
|
|
|
|
CD.IPBin? segaCd = CD.DecodeIPBin(ipbinSector);
|
|
|
|
|
|
Saturn.IPBin? saturn = Saturn.DecodeIPBin(ipbinSector);
|
|
|
|
|
|
Dreamcast.IPBin? dreamcast = Dreamcast.DecodeIPBin(ipbinSector);
|
2011-03-03 18:34:33 +00:00
|
|
|
|
|
2017-10-13 21:50:10 +01:00
|
|
|
|
string fsFormat;
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(highSierra) fsFormat = "High Sierra Format";
|
2018-06-22 08:08:38 +01:00
|
|
|
|
else if(cdi) fsFormat = "CD-i";
|
|
|
|
|
|
else fsFormat = "ISO9660";
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("{0} file system", fsFormat).AppendLine();
|
|
|
|
|
|
if(xaExtensions) isoMetadata.AppendLine("CD-ROM XA extensions present.");
|
|
|
|
|
|
if(amiga) isoMetadata.AppendLine("Amiga extensions present.");
|
|
|
|
|
|
if(apple) isoMetadata.AppendLine("Apple extensions present.");
|
|
|
|
|
|
if(jolietvd != null) isoMetadata.AppendLine("Joliet extensions present.");
|
|
|
|
|
|
if(susp) isoMetadata.AppendLine("System Use Sharing Protocol present.");
|
|
|
|
|
|
if(rrip) isoMetadata.AppendLine("Rock Ridge Interchange Protocol present.");
|
|
|
|
|
|
if(aaip) isoMetadata.AppendLine("Arbitrary Attribute Interchange Protocol present.");
|
|
|
|
|
|
if(ziso) isoMetadata.AppendLine("zisofs compression present.");
|
2017-10-08 20:28:56 +01:00
|
|
|
|
if(bvd != null)
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("Disc bootable following {0} specifications.", bootSpec).AppendLine();
|
|
|
|
|
|
if(segaCd != null)
|
2011-03-03 18:34:33 +00:00
|
|
|
|
{
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendLine("This is a SegaCD / MegaCD disc.");
|
|
|
|
|
|
isoMetadata.AppendLine(CD.Prettify(segaCd));
|
2011-03-03 18:34:33 +00:00
|
|
|
|
}
|
2017-12-30 01:22:23 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(saturn != null)
|
2011-03-03 18:34:33 +00:00
|
|
|
|
{
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendLine("This is a Sega Saturn disc.");
|
|
|
|
|
|
isoMetadata.AppendLine(Saturn.Prettify(saturn));
|
2011-03-03 18:34:33 +00:00
|
|
|
|
}
|
2017-12-30 01:22:23 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(dreamcast != null)
|
2011-03-03 18:34:33 +00:00
|
|
|
|
{
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendLine("This is a Sega Dreamcast disc.");
|
|
|
|
|
|
isoMetadata.AppendLine(Dreamcast.Prettify(dreamcast));
|
2011-03-03 18:34:33 +00:00
|
|
|
|
}
|
2017-12-30 01:22:23 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("{0}------------------------------", cdi ? "---------------" : "").AppendLine();
|
|
|
|
|
|
isoMetadata.AppendFormat("{0}VOLUME DESCRIPTOR INFORMATION:", cdi ? "FILE STRUCTURE " : "").AppendLine();
|
|
|
|
|
|
isoMetadata.AppendFormat("{0}------------------------------", cdi ? "---------------" : "").AppendLine();
|
2018-06-22 08:08:38 +01:00
|
|
|
|
isoMetadata.AppendFormat("System identifier: {0}", decodedVd.SystemIdentifier).AppendLine();
|
|
|
|
|
|
isoMetadata.AppendFormat("Volume identifier: {0}", decodedVd.VolumeIdentifier).AppendLine();
|
|
|
|
|
|
isoMetadata.AppendFormat("Volume set identifier: {0}", decodedVd.VolumeSetIdentifier).AppendLine();
|
|
|
|
|
|
isoMetadata.AppendFormat("Publisher identifier: {0}", decodedVd.PublisherIdentifier).AppendLine();
|
|
|
|
|
|
isoMetadata.AppendFormat("Data preparer identifier: {0}", decodedVd.DataPreparerIdentifier).AppendLine();
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("Application identifier: {0}", decodedVd.ApplicationIdentifier).AppendLine();
|
2018-06-22 08:08:38 +01:00
|
|
|
|
isoMetadata.AppendFormat("Volume creation date: {0}", decodedVd.CreationTime).AppendLine();
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(decodedVd.HasModificationTime)
|
|
|
|
|
|
isoMetadata.AppendFormat("Volume modification date: {0}", decodedVd.ModificationTime).AppendLine();
|
|
|
|
|
|
else isoMetadata.AppendFormat("Volume has not been modified.").AppendLine();
|
|
|
|
|
|
if(decodedVd.HasExpirationTime)
|
|
|
|
|
|
isoMetadata.AppendFormat("Volume expiration date: {0}", decodedVd.ExpirationTime).AppendLine();
|
|
|
|
|
|
else isoMetadata.AppendFormat("Volume does not expire.").AppendLine();
|
|
|
|
|
|
if(decodedVd.HasEffectiveTime)
|
|
|
|
|
|
isoMetadata.AppendFormat("Volume effective date: {0}", decodedVd.EffectiveTime).AppendLine();
|
|
|
|
|
|
else isoMetadata.AppendFormat("Volume has always been effective.").AppendLine();
|
|
|
|
|
|
isoMetadata.AppendFormat("Volume has {0} blocks of {1} bytes each", decodedVd.Blocks, decodedVd.BlockSize)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
.AppendLine();
|
2011-03-03 18:34:33 +00:00
|
|
|
|
|
2017-10-08 20:28:56 +01:00
|
|
|
|
if(jolietvd != null)
|
2016-04-19 02:11:47 +01:00
|
|
|
|
{
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendLine("-------------------------------------");
|
|
|
|
|
|
isoMetadata.AppendLine("JOLIET VOLUME DESCRIPTOR INFORMATION:");
|
|
|
|
|
|
isoMetadata.AppendLine("-------------------------------------");
|
2018-06-22 08:08:38 +01:00
|
|
|
|
isoMetadata.AppendFormat("System identifier: {0}", decodedJolietVd.SystemIdentifier).AppendLine();
|
|
|
|
|
|
isoMetadata.AppendFormat("Volume identifier: {0}", decodedJolietVd.VolumeIdentifier).AppendLine();
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("Volume set identifier: {0}", decodedJolietVd.VolumeSetIdentifier)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
.AppendLine();
|
2018-06-22 08:08:38 +01:00
|
|
|
|
isoMetadata.AppendFormat("Publisher identifier: {0}", decodedJolietVd.PublisherIdentifier).AppendLine();
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("Data preparer identifier: {0}", decodedJolietVd.DataPreparerIdentifier)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
.AppendLine();
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("Application identifier: {0}", decodedJolietVd.ApplicationIdentifier)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
.AppendLine();
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("Volume creation date: {0}", decodedJolietVd.CreationTime).AppendLine();
|
|
|
|
|
|
if(decodedJolietVd.HasModificationTime)
|
|
|
|
|
|
isoMetadata.AppendFormat("Volume modification date: {0}", decodedJolietVd.ModificationTime)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
.AppendLine();
|
2017-12-22 07:28:54 +00:00
|
|
|
|
else isoMetadata.AppendFormat("Volume has not been modified.").AppendLine();
|
|
|
|
|
|
if(decodedJolietVd.HasExpirationTime)
|
|
|
|
|
|
isoMetadata.AppendFormat("Volume expiration date: {0}", decodedJolietVd.ExpirationTime)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
.AppendLine();
|
2017-12-22 07:28:54 +00:00
|
|
|
|
else isoMetadata.AppendFormat("Volume does not expire.").AppendLine();
|
|
|
|
|
|
if(decodedJolietVd.HasEffectiveTime)
|
|
|
|
|
|
isoMetadata.AppendFormat("Volume effective date: {0}", decodedJolietVd.EffectiveTime).AppendLine();
|
|
|
|
|
|
else isoMetadata.AppendFormat("Volume has always been effective.").AppendLine();
|
2016-04-19 02:11:47 +01:00
|
|
|
|
}
|
2012-08-03 05:43:58 +00:00
|
|
|
|
|
2017-10-09 00:32:17 +01:00
|
|
|
|
if(torito != null)
|
|
|
|
|
|
{
|
2018-02-03 19:11:41 +00:00
|
|
|
|
vdSector = imagePlugin.ReadSector(torito.Value.catalog_sector + partition.Start);
|
2017-10-09 00:32:17 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
int toritoOff = 0;
|
2017-10-09 00:32:17 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(vdSector[toritoOff] != 1) goto exit_torito;
|
2017-10-09 00:32:17 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
IntPtr ptr = Marshal.AllocHGlobal(EL_TORITO_ENTRY_SIZE);
|
|
|
|
|
|
Marshal.Copy(vdSector, toritoOff, ptr, EL_TORITO_ENTRY_SIZE);
|
2017-12-24 02:37:41 +00:00
|
|
|
|
ElToritoValidationEntry valentry =
|
|
|
|
|
|
(ElToritoValidationEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoValidationEntry));
|
2017-10-09 00:32:17 +01:00
|
|
|
|
Marshal.FreeHGlobal(ptr);
|
|
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(valentry.signature != EL_TORITO_MAGIC) goto exit_torito;
|
2017-10-09 00:32:17 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
toritoOff += EL_TORITO_ENTRY_SIZE;
|
2017-10-09 00:32:17 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
ptr = Marshal.AllocHGlobal(EL_TORITO_ENTRY_SIZE);
|
|
|
|
|
|
Marshal.Copy(vdSector, toritoOff, ptr, EL_TORITO_ENTRY_SIZE);
|
2017-12-24 02:37:41 +00:00
|
|
|
|
ElToritoInitialEntry initialEntry =
|
|
|
|
|
|
(ElToritoInitialEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoInitialEntry));
|
2017-10-09 00:32:17 +01:00
|
|
|
|
Marshal.FreeHGlobal(ptr);
|
2017-12-22 07:28:54 +00:00
|
|
|
|
initialEntry.boot_type = (ElToritoEmulation)((byte)initialEntry.boot_type & 0xF);
|
2017-10-09 00:32:17 +01:00
|
|
|
|
|
2017-12-30 01:22:23 +00:00
|
|
|
|
DicConsole.DebugWriteLine("DEBUG (ISO9660 plugin)", "initialEntry.load_rba = {0}",
|
|
|
|
|
|
initialEntry.load_rba);
|
|
|
|
|
|
DicConsole.DebugWriteLine("DEBUG (ISO9660 plugin)", "initialEntry.sector_count = {0}",
|
|
|
|
|
|
initialEntry.sector_count);
|
|
|
|
|
|
|
2017-12-24 02:37:41 +00:00
|
|
|
|
byte[] bootImage =
|
2018-06-22 08:08:38 +01:00
|
|
|
|
initialEntry.load_rba + partition.Start + initialEntry.sector_count - 1 <= partition.End
|
2017-12-30 01:22:23 +00:00
|
|
|
|
? imagePlugin.ReadSectors(initialEntry.load_rba + partition.Start, initialEntry.sector_count)
|
|
|
|
|
|
: null;
|
2017-10-09 00:32:17 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendLine("----------------------");
|
|
|
|
|
|
isoMetadata.AppendLine("EL TORITO INFORMATION:");
|
|
|
|
|
|
isoMetadata.AppendLine("----------------------");
|
2017-10-09 00:32:17 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendLine("Initial entry:");
|
2017-12-26 08:01:40 +00:00
|
|
|
|
isoMetadata.AppendFormat("\tDeveloper ID: {0}", Encoding.GetString(valentry.developer_id)).AppendLine();
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(initialEntry.bootable == ElToritoIndicator.Bootable)
|
2017-10-09 00:32:17 +01:00
|
|
|
|
{
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("\tBootable on {0}", valentry.platform_id).AppendLine();
|
|
|
|
|
|
isoMetadata.AppendFormat("\tBootable image starts at sector {0} and runs for {1} sectors",
|
|
|
|
|
|
initialEntry.load_rba, initialEntry.sector_count).AppendLine();
|
2017-10-09 00:32:17 +01:00
|
|
|
|
if(valentry.platform_id == ElToritoPlatform.x86)
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("\tBootable image will be loaded at segment {0:X4}h",
|
|
|
|
|
|
initialEntry.load_seg == 0 ? 0x7C0 : initialEntry.load_seg)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
.AppendLine();
|
2017-10-09 00:32:17 +01:00
|
|
|
|
else
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("\tBootable image will be loaded at 0x{0:X8}",
|
|
|
|
|
|
(uint)initialEntry.load_seg * 10).AppendLine();
|
|
|
|
|
|
switch(initialEntry.boot_type)
|
2017-10-09 00:32:17 +01:00
|
|
|
|
{
|
|
|
|
|
|
case ElToritoEmulation.None:
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendLine("\tImage uses no emulation");
|
2017-10-09 00:32:17 +01:00
|
|
|
|
break;
|
|
|
|
|
|
case ElToritoEmulation.Md2hd:
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendLine("\tImage emulates a 5.25\" high-density (MD2HD, 1.2Mb) floppy");
|
2017-10-09 00:32:17 +01:00
|
|
|
|
break;
|
|
|
|
|
|
case ElToritoEmulation.Mf2hd:
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendLine("\tImage emulates a 3.5\" high-density (MF2HD, 1.44Mb) floppy");
|
2017-10-09 00:32:17 +01:00
|
|
|
|
break;
|
|
|
|
|
|
case ElToritoEmulation.Mf2ed:
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendLine("\tImage emulates a 3.5\" extra-density (MF2ED, 2.88Mb) floppy");
|
2017-10-09 00:32:17 +01:00
|
|
|
|
break;
|
|
|
|
|
|
default:
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("\tImage uses unknown emulation type {0}",
|
|
|
|
|
|
(byte)initialEntry.boot_type).AppendLine();
|
2017-10-09 00:32:17 +01:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("\tSystem type: 0x{0:X2}", initialEntry.system_type).AppendLine();
|
2017-12-30 01:22:23 +00:00
|
|
|
|
if(bootImage != null)
|
2018-02-03 19:11:41 +00:00
|
|
|
|
isoMetadata.AppendFormat("\tBootable image's SHA1: {0}", Sha1Context.Data(bootImage, out _))
|
2017-12-30 01:22:23 +00:00
|
|
|
|
.AppendLine();
|
2017-10-09 00:32:17 +01:00
|
|
|
|
}
|
2017-12-22 07:28:54 +00:00
|
|
|
|
else isoMetadata.AppendLine("\tNot bootable");
|
2017-10-09 00:32:17 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
toritoOff += EL_TORITO_ENTRY_SIZE;
|
2017-10-09 00:32:17 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
const int SECTION_COUNTER = 2;
|
2017-10-09 00:32:17 +01:00
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
while(toritoOff < vdSector.Length && (vdSector[toritoOff] == (byte)ElToritoIndicator.Header ||
|
|
|
|
|
|
vdSector[toritoOff] == (byte)ElToritoIndicator.LastHeader))
|
2017-10-09 00:32:17 +01:00
|
|
|
|
{
|
2017-12-22 07:28:54 +00:00
|
|
|
|
ptr = Marshal.AllocHGlobal(EL_TORITO_ENTRY_SIZE);
|
|
|
|
|
|
Marshal.Copy(vdSector, toritoOff, ptr, EL_TORITO_ENTRY_SIZE);
|
2017-12-24 02:37:41 +00:00
|
|
|
|
ElToritoSectionHeaderEntry sectionHeader =
|
|
|
|
|
|
(ElToritoSectionHeaderEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoSectionHeaderEntry));
|
2017-10-09 00:32:17 +01:00
|
|
|
|
Marshal.FreeHGlobal(ptr);
|
2017-12-22 07:28:54 +00:00
|
|
|
|
toritoOff += EL_TORITO_ENTRY_SIZE;
|
2017-10-09 00:32:17 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("Boot section {0}:", SECTION_COUNTER);
|
2017-12-26 08:01:40 +00:00
|
|
|
|
isoMetadata.AppendFormat("\tSection ID: {0}", Encoding.GetString(sectionHeader.identifier))
|
2017-12-19 20:33:03 +00:00
|
|
|
|
.AppendLine();
|
2017-10-09 00:32:17 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
for(int entryCounter = 1; entryCounter <= sectionHeader.entries && toritoOff < vdSector.Length;
|
|
|
|
|
|
entryCounter++)
|
2017-10-09 00:32:17 +01:00
|
|
|
|
{
|
2017-12-22 07:28:54 +00:00
|
|
|
|
ptr = Marshal.AllocHGlobal(EL_TORITO_ENTRY_SIZE);
|
|
|
|
|
|
Marshal.Copy(vdSector, toritoOff, ptr, EL_TORITO_ENTRY_SIZE);
|
2017-12-24 02:37:41 +00:00
|
|
|
|
ElToritoSectionEntry sectionEntry =
|
|
|
|
|
|
(ElToritoSectionEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoSectionEntry));
|
2017-10-09 00:32:17 +01:00
|
|
|
|
Marshal.FreeHGlobal(ptr);
|
2017-12-22 07:28:54 +00:00
|
|
|
|
toritoOff += EL_TORITO_ENTRY_SIZE;
|
2017-10-09 00:32:17 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("\tEntry {0}:", entryCounter);
|
|
|
|
|
|
if(sectionEntry.bootable == ElToritoIndicator.Bootable)
|
2017-10-09 00:32:17 +01:00
|
|
|
|
{
|
2017-12-30 01:22:23 +00:00
|
|
|
|
bootImage =
|
2018-06-22 08:08:38 +01:00
|
|
|
|
sectionEntry.load_rba + partition.Start + sectionEntry.sector_count - 1 <= partition.End
|
2017-12-30 01:22:23 +00:00
|
|
|
|
? imagePlugin.ReadSectors(sectionEntry.load_rba + partition.Start,
|
|
|
|
|
|
sectionEntry.sector_count)
|
|
|
|
|
|
: null;
|
|
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("\t\tBootable on {0}", sectionHeader.platform_id).AppendLine();
|
|
|
|
|
|
isoMetadata.AppendFormat("\t\tBootable image starts at sector {0} and runs for {1} sectors",
|
|
|
|
|
|
sectionEntry.load_rba, sectionEntry.sector_count).AppendLine();
|
2017-10-09 00:32:17 +01:00
|
|
|
|
if(valentry.platform_id == ElToritoPlatform.x86)
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("\t\tBootable image will be loaded at segment {0:X4}h",
|
|
|
|
|
|
sectionEntry.load_seg == 0 ? 0x7C0 : sectionEntry.load_seg)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
.AppendLine();
|
2017-10-09 00:32:17 +01:00
|
|
|
|
else
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("\t\tBootable image will be loaded at 0x{0:X8}",
|
|
|
|
|
|
(uint)sectionEntry.load_seg * 10).AppendLine();
|
|
|
|
|
|
switch((ElToritoEmulation)((byte)sectionEntry.boot_type & 0xF))
|
2017-10-09 00:32:17 +01:00
|
|
|
|
{
|
|
|
|
|
|
case ElToritoEmulation.None:
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendLine("\t\tImage uses no emulation");
|
2017-10-09 00:32:17 +01:00
|
|
|
|
break;
|
|
|
|
|
|
case ElToritoEmulation.Md2hd:
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata
|
2017-12-30 01:22:23 +00:00
|
|
|
|
.AppendLine("\t\tImage emulates a 5.25\" high-density (MD2HD, 1.2Mb) floppy");
|
2017-10-09 00:32:17 +01:00
|
|
|
|
break;
|
|
|
|
|
|
case ElToritoEmulation.Mf2hd:
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata
|
2017-12-30 01:22:23 +00:00
|
|
|
|
.AppendLine("\t\tImage emulates a 3.5\" high-density (MF2HD, 1.44Mb) floppy");
|
2017-10-09 00:32:17 +01:00
|
|
|
|
break;
|
|
|
|
|
|
case ElToritoEmulation.Mf2ed:
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata
|
2017-12-30 01:22:23 +00:00
|
|
|
|
.AppendLine("\t\tImage emulates a 3.5\" extra-density (MF2ED, 2.88Mb) floppy");
|
2017-10-09 00:32:17 +01:00
|
|
|
|
break;
|
|
|
|
|
|
default:
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("\t\tImage uses unknown emulation type {0}",
|
|
|
|
|
|
(byte)initialEntry.boot_type).AppendLine();
|
2017-10-09 00:32:17 +01:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendFormat("\t\tSelection criteria type: {0}",
|
|
|
|
|
|
sectionEntry.selection_criteria_type).AppendLine();
|
|
|
|
|
|
isoMetadata.AppendFormat("\t\tSystem type: 0x{0:X2}", sectionEntry.system_type)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
.AppendLine();
|
2017-12-30 01:22:23 +00:00
|
|
|
|
if(bootImage != null)
|
|
|
|
|
|
isoMetadata.AppendFormat("\t\tBootable image's SHA1: {0}",
|
2018-02-03 19:11:41 +00:00
|
|
|
|
Sha1Context.Data(bootImage, out _)).AppendLine();
|
2017-10-09 00:32:17 +01:00
|
|
|
|
}
|
2017-12-22 07:28:54 +00:00
|
|
|
|
else isoMetadata.AppendLine("\t\tNot bootable");
|
2017-10-09 00:32:17 +01:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
ElToritoFlags flags = (ElToritoFlags)((byte)sectionEntry.boot_type & 0xF0);
|
2017-10-09 00:32:17 +01:00
|
|
|
|
if(flags.HasFlag(ElToritoFlags.ATAPI))
|
2017-12-22 07:28:54 +00:00
|
|
|
|
isoMetadata.AppendLine("\t\tImage contains ATAPI drivers");
|
|
|
|
|
|
if(flags.HasFlag(ElToritoFlags.SCSI)) isoMetadata.AppendLine("\t\tImage contains SCSI drivers");
|
2017-10-09 00:32:17 +01:00
|
|
|
|
|
2017-12-21 06:06:19 +00:00
|
|
|
|
if(!flags.HasFlag(ElToritoFlags.Continued)) continue;
|
|
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
while(toritoOff < vdSector.Length)
|
2017-12-21 06:06:19 +00:00
|
|
|
|
{
|
2017-12-22 07:28:54 +00:00
|
|
|
|
ptr = Marshal.AllocHGlobal(EL_TORITO_ENTRY_SIZE);
|
|
|
|
|
|
Marshal.Copy(vdSector, toritoOff, ptr, EL_TORITO_ENTRY_SIZE);
|
2017-12-24 02:37:41 +00:00
|
|
|
|
ElToritoSectionEntryExtension sectionExtension =
|
|
|
|
|
|
(ElToritoSectionEntryExtension)
|
2017-12-21 06:06:19 +00:00
|
|
|
|
Marshal.PtrToStructure(ptr, typeof(ElToritoSectionEntryExtension));
|
|
|
|
|
|
Marshal.FreeHGlobal(ptr);
|
2017-12-22 07:28:54 +00:00
|
|
|
|
toritoOff += EL_TORITO_ENTRY_SIZE;
|
2017-12-21 06:06:19 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(!sectionExtension.extension_flags.HasFlag(ElToritoFlags.Continued)) break;
|
2017-12-21 06:06:19 +00:00
|
|
|
|
}
|
2017-10-09 00:32:17 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(sectionHeader.header_id == ElToritoIndicator.LastHeader) break;
|
2017-10-09 00:32:17 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
exit_torito:
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(refareas.Count > 0) isoMetadata.Append(suspInformation);
|
2017-10-09 11:25:47 +01:00
|
|
|
|
|
2017-12-26 08:01:40 +00:00
|
|
|
|
XmlFsType.Type = fsFormat;
|
2015-12-23 23:46:31 +00:00
|
|
|
|
|
2017-10-08 20:28:56 +01:00
|
|
|
|
if(jolietvd != null)
|
2015-12-05 17:10:27 +00:00
|
|
|
|
{
|
2017-12-26 08:01:40 +00:00
|
|
|
|
XmlFsType.VolumeName = decodedJolietVd.VolumeIdentifier;
|
2017-12-22 07:28:54 +00:00
|
|
|
|
|
2019-02-12 18:57:20 +00:00
|
|
|
|
if(string.IsNullOrEmpty(decodedJolietVd.SystemIdentifier) ||
|
2017-12-22 07:28:54 +00:00
|
|
|
|
decodedVd.SystemIdentifier.Length > decodedJolietVd.SystemIdentifier.Length)
|
2019-02-12 18:57:20 +00:00
|
|
|
|
XmlFsType.SystemIdentifier = decodedVd.SystemIdentifier;
|
|
|
|
|
|
else
|
|
|
|
|
|
XmlFsType.SystemIdentifier = string.IsNullOrEmpty(decodedJolietVd.SystemIdentifier)
|
|
|
|
|
|
? null
|
|
|
|
|
|
: decodedJolietVd.SystemIdentifier;
|
2017-12-22 07:28:54 +00:00
|
|
|
|
|
2019-02-12 18:57:20 +00:00
|
|
|
|
if(string.IsNullOrEmpty(decodedJolietVd.VolumeSetIdentifier) || decodedVd.VolumeSetIdentifier.Length >
|
2017-12-22 07:28:54 +00:00
|
|
|
|
decodedJolietVd.VolumeSetIdentifier.Length)
|
2019-02-12 18:57:20 +00:00
|
|
|
|
XmlFsType.VolumeSetIdentifier = decodedVd.VolumeSetIdentifier;
|
|
|
|
|
|
else
|
|
|
|
|
|
XmlFsType.VolumeSetIdentifier = string.IsNullOrEmpty(decodedJolietVd.VolumeSetIdentifier)
|
|
|
|
|
|
? null
|
|
|
|
|
|
: decodedJolietVd.VolumeSetIdentifier;
|
2017-12-22 07:28:54 +00:00
|
|
|
|
|
2019-02-12 18:57:20 +00:00
|
|
|
|
if(string.IsNullOrEmpty(decodedJolietVd.PublisherIdentifier) || decodedVd.PublisherIdentifier.Length >
|
2017-12-22 07:28:54 +00:00
|
|
|
|
decodedJolietVd.PublisherIdentifier.Length)
|
2019-02-12 18:57:20 +00:00
|
|
|
|
XmlFsType.PublisherIdentifier = decodedVd.PublisherIdentifier;
|
|
|
|
|
|
else
|
|
|
|
|
|
XmlFsType.PublisherIdentifier = string.IsNullOrEmpty(decodedJolietVd.PublisherIdentifier)
|
|
|
|
|
|
? null
|
|
|
|
|
|
: decodedJolietVd.PublisherIdentifier;
|
|
|
|
|
|
|
|
|
|
|
|
if(string.IsNullOrEmpty(decodedJolietVd.DataPreparerIdentifier) ||
|
|
|
|
|
|
decodedVd.DataPreparerIdentifier.Length > decodedJolietVd.DataPreparerIdentifier.Length)
|
|
|
|
|
|
XmlFsType.DataPreparerIdentifier = decodedVd.DataPreparerIdentifier;
|
|
|
|
|
|
else
|
|
|
|
|
|
XmlFsType.DataPreparerIdentifier = string.IsNullOrEmpty(decodedJolietVd.DataPreparerIdentifier)
|
|
|
|
|
|
? null
|
|
|
|
|
|
: decodedJolietVd.DataPreparerIdentifier;
|
|
|
|
|
|
|
|
|
|
|
|
if(string.IsNullOrEmpty(decodedJolietVd.ApplicationIdentifier) ||
|
|
|
|
|
|
decodedVd.ApplicationIdentifier.Length > decodedJolietVd.ApplicationIdentifier.Length)
|
|
|
|
|
|
XmlFsType.ApplicationIdentifier = decodedVd.ApplicationIdentifier;
|
|
|
|
|
|
else
|
|
|
|
|
|
XmlFsType.ApplicationIdentifier = string.IsNullOrEmpty(decodedJolietVd.ApplicationIdentifier)
|
|
|
|
|
|
? null
|
|
|
|
|
|
: decodedJolietVd.ApplicationIdentifier;
|
2017-12-22 07:28:54 +00:00
|
|
|
|
|
2017-12-30 01:22:23 +00:00
|
|
|
|
XmlFsType.CreationDate = decodedJolietVd.CreationTime;
|
2017-12-26 08:01:40 +00:00
|
|
|
|
XmlFsType.CreationDateSpecified = true;
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(decodedJolietVd.HasModificationTime)
|
2015-12-06 05:09:31 +00:00
|
|
|
|
{
|
2017-12-30 01:22:23 +00:00
|
|
|
|
XmlFsType.ModificationDate = decodedJolietVd.ModificationTime;
|
2017-12-26 08:01:40 +00:00
|
|
|
|
XmlFsType.ModificationDateSpecified = true;
|
2015-12-06 05:09:31 +00:00
|
|
|
|
}
|
2017-12-30 01:22:23 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(decodedJolietVd.HasExpirationTime)
|
2015-12-06 05:09:31 +00:00
|
|
|
|
{
|
2017-12-30 01:22:23 +00:00
|
|
|
|
XmlFsType.ExpirationDate = decodedJolietVd.ExpirationTime;
|
2017-12-26 08:01:40 +00:00
|
|
|
|
XmlFsType.ExpirationDateSpecified = true;
|
2015-12-06 05:09:31 +00:00
|
|
|
|
}
|
2017-12-30 01:22:23 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(decodedJolietVd.HasEffectiveTime)
|
2015-12-06 05:09:31 +00:00
|
|
|
|
{
|
2017-12-30 01:22:23 +00:00
|
|
|
|
XmlFsType.EffectiveDate = decodedJolietVd.EffectiveTime;
|
2017-12-26 08:01:40 +00:00
|
|
|
|
XmlFsType.EffectiveDateSpecified = true;
|
2015-12-06 05:09:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2017-12-30 01:22:23 +00:00
|
|
|
|
XmlFsType.SystemIdentifier = decodedVd.SystemIdentifier;
|
|
|
|
|
|
XmlFsType.VolumeName = decodedVd.VolumeIdentifier;
|
|
|
|
|
|
XmlFsType.VolumeSetIdentifier = decodedVd.VolumeSetIdentifier;
|
|
|
|
|
|
XmlFsType.PublisherIdentifier = decodedVd.PublisherIdentifier;
|
2017-12-26 08:01:40 +00:00
|
|
|
|
XmlFsType.DataPreparerIdentifier = decodedVd.DataPreparerIdentifier;
|
2017-12-30 01:22:23 +00:00
|
|
|
|
XmlFsType.ApplicationIdentifier = decodedVd.ApplicationIdentifier;
|
|
|
|
|
|
XmlFsType.CreationDate = decodedVd.CreationTime;
|
|
|
|
|
|
XmlFsType.CreationDateSpecified = true;
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(decodedVd.HasModificationTime)
|
2015-12-06 05:09:31 +00:00
|
|
|
|
{
|
2017-12-30 01:22:23 +00:00
|
|
|
|
XmlFsType.ModificationDate = decodedVd.ModificationTime;
|
2017-12-26 08:01:40 +00:00
|
|
|
|
XmlFsType.ModificationDateSpecified = true;
|
2015-12-06 05:09:31 +00:00
|
|
|
|
}
|
2017-12-30 01:22:23 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(decodedVd.HasExpirationTime)
|
2015-12-06 05:09:31 +00:00
|
|
|
|
{
|
2017-12-30 01:22:23 +00:00
|
|
|
|
XmlFsType.ExpirationDate = decodedVd.ExpirationTime;
|
2017-12-26 08:01:40 +00:00
|
|
|
|
XmlFsType.ExpirationDateSpecified = true;
|
2015-12-06 05:09:31 +00:00
|
|
|
|
}
|
2017-12-30 01:22:23 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
if(decodedVd.HasEffectiveTime)
|
2015-12-06 05:09:31 +00:00
|
|
|
|
{
|
2017-12-30 01:22:23 +00:00
|
|
|
|
XmlFsType.EffectiveDate = decodedVd.EffectiveTime;
|
2017-12-26 08:01:40 +00:00
|
|
|
|
XmlFsType.EffectiveDateSpecified = true;
|
2015-12-06 05:09:31 +00:00
|
|
|
|
}
|
2015-12-05 17:10:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-30 01:22:23 +00:00
|
|
|
|
XmlFsType.Bootable |= bvd != null || segaCd != null || saturn != null || dreamcast != null;
|
|
|
|
|
|
XmlFsType.Clusters = decodedVd.Blocks;
|
|
|
|
|
|
XmlFsType.ClusterSize = decodedVd.BlockSize;
|
2015-12-06 05:09:31 +00:00
|
|
|
|
|
2017-12-22 07:28:54 +00:00
|
|
|
|
information = isoMetadata.ToString();
|
2011-03-03 18:34:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|