* DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs:

* DiscImageChef.CommonTypes/DiscImageChef.CommonTypes.csproj:
	  Added method to calculate MediaType from SCSI parameters
	  (mode, density, medium type, device type, etc).

	* DiscImageChef.Metadata/DeviceReport.cs:
	  Added command to guess drive and media parameters and output
	  an XML report of them.

	* DiscImageChef/Commands/DeviceReport.cs:
	* DiscImageChef.Metadata/DiscImageChef.Metadata.csproj:
	  Added command to guess drive and media parameters and output
	  an XML report of them.

	* DiscImageChef/Commands/DumpMedia.cs:
	  Added preliminary command to dump media. Only SCSI for now.
	  CDs and tapes are not supported. Errors are blalanty
	  ignored. Options are incomplete. Not yet usable.

	* DiscImageChef/Core/Checksum.cs:
	* DiscImageChef/Commands/CreateSidecar.cs:
	  Moved checksum generation to a separate class.

	* CICMMetadata:
	  Added support for ADIP.

	* DiscImageChef.CommonTypes/MediaType.cs:
	  Added parameters of UDO media.
	Moved DataPlay outside of Iomega, as it's not from that
	  manufacturer.
	Added missing Exatape media and corrected 160m XL one.
	Added SyJet media.
	Added all ECMA defined magneto-optical (sectors calculated
	  from specifications, unchecked).
	Added PD media.
	Added Imation 320Gb RDX.
	Added generic USB flash drives.

	* DiscImageChef.Decoders/SCSI/Enums.cs:
	  Make enumerations public.

	* DiscImageChef.Decoders/SCSI/Inquiry.cs:
	* DiscImageChef.Devices/Device/Constructor.cs:
	  Trim space padded strings on SCSI INQUIRY.

	* DiscImageChef.Devices/Device/ScsiCommands/MMC.cs:
	  Added PREVENT ALLOW MEDIUM REMOVAL.
	Added START STOP UNIT.

	* DiscImageChef.Devices/Device/ScsiCommands/NEC.cs:
	  Rename NEC methods.

	* DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs:
	  Corrected Pioneer transfer length calculation.

	* DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs:
	  Renamed Plextor methods.

	* DiscImageChef.Devices/Device/ScsiCommands/SPC.cs:
	  Renamed SSC PREVENT ALLOW MEDIUM REMOVAL to uncollide with
	  MMC same name but different command.

	* DiscImageChef.Devices/DiscImageChef.Devices.csproj:
	  Set platform target to x86 (does it really matter?).

	* DiscImageChef.Devices/Linux/Command.cs:
	  Reduced allocation for readlink() to current kernel
	  MAX_PATH.

	* DiscImageChef.Devices/Linux/Enums.cs:
	  Modified Linux ioctl to 32-bit. Works on 64-bit also. Solves
	  commands not working on 32-bit environments.

	* DiscImageChef.DiscImages/ZZZRawImage.cs:
	  Changed ECMA-184 and ECMA-183 enums.

	* DiscImageChef.Metadata/Dimensions.cs:
	  Added all ECMA defined magneto-opticals.
	Added PD media.
	Added 320Gb RDX.
	Corrected Exatape 160m XL.
	Added Exatape 22m and 28m.

	* DiscImageChef.Metadata/MediaType.cs:
	  Added 356mm magneto-optical media.
	Changed ECMA-184 and ECMA-183 enums.
	Added USB generic flash drive.

	* DiscImageChef/Commands/DeviceInfo.cs:
	  Corrected SCSI INQUIRY naming.
	Corrected SCSI MODE SENSE (6) parameters.
	Reduced SCSI MODE SENSE timeout, some devices just get stuck
	  with unsupported MODE SENSE commanda and must be left to
	  timeout.
	Changed FUJITSU vendor string comparison.

	* DiscImageChef/Commands/MediaInfo.cs:
	  Added method to calculate MediaType from SCSI parameters
	  (mode, density, medium type, device type, etc).
	Changed some error WriteLine() to debug ones. Too much
	  verbosity.
	Added DVD media type decoding from PFI.
	Found a drive that dumps ADIP, enabling it again (not
	  decoded).

	* DiscImageChef/Commands/MediaScan.cs:
	  Added option to generate ImgBurn compatible log to
	  media-scan command.

	* DiscImageChef/DiscImageChef.csproj:
	  Moved checksum generation to a separate class.
	Added command to guess drive and media parameters and output
	  an XML report of them.
	Added preliminary command to dump media. Only SCSI for now.
	  CDs and tapes are not supported. Errors are blalanty
	  ignored. Options are incomplete. Not yet usable.

	* DiscImageChef/Main.cs:
	  Added command to guess drive and media parameters and output
	  an XML report of them.
	Added preliminary command to dump media. Only SCSI for now.
	  CDs and tapes are not supported. Errors are blalanty
	  ignored. Options are incomplete. Not yet usable.

	* DiscImageChef/Options.cs:
	  Added command to guess drive and media parameters and output
	  an XML report of them.
	Added preliminary command to dump media. Only SCSI for now.
	  CDs and tapes are not supported. Errors are blalanty
	  ignored. Options are incomplete. Not yet usable.
	Added option to generate ImgBurn compatible log to media-scan
	  command.
This commit is contained in:
2016-01-31 08:05:56 +00:00
parent 04add8d634
commit bb69a1b8d9
30 changed files with 9476 additions and 944 deletions

View File

@@ -36,6 +36,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Partition.cs" />
<Compile Include="MediaType.cs" />
<Compile Include="MediaTypeFromSCSI.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -184,9 +184,12 @@ namespace DiscImageChef.CommonTypes
#endregion MiniDisc based
#region Plasmon UDO
/// <summary>Ultra Density Optical</summary>
/// <summary>5.25", Phase-Change, 1834348 sectors, 8192 bytes/sector, Ultra Density Optical, ECMA-350, ISO 17345</summary>
UDO,
/// <summary>5.25", Phase-Change, 3669724 sectors, 8192 bytes/sector, Ultra Density Optical 2, ECMA-380, ISO 11976</summary>
UDO2,
/// <summary>5.25", Write-Once, 3668759 sectors, 8192 bytes/sector, Ultra Density Optical 2, ECMA-380, ISO 11976</summary>
UDO2_WORM,
#endregion Plasmon UDO
#region Sony game media
@@ -399,18 +402,6 @@ namespace DiscImageChef.CommonTypes
ECMA_78,
/// <summary>5,25", DS, DD, 80 tracks, 9 spt, 512 bytes/sector, FM</summary>
ECMA_78_2,
/// <summary>3,5", M.O., 250000 sectors, 512 bytes/sector</summary>
ECMA_154,
/// <summary>5,25", M.O., 940470 sectors, 512 bytes/sector</summary>
ECMA_183_512,
/// <summary>5,25", M.O., 520902 sectors, 1024 bytes/sector</summary>
ECMA_183_1024,
/// <summary>5,25", M.O., 1165600 sectors, 512 bytes/sector</summary>
ECMA_184_512,
/// <summary>5,25", M.O., 639200 sectors, 1024 bytes/sector</summary>
ECMA_184_1024,
/// <summary>3,5", M.O., 448500 sectors, 512 bytes/sector</summary>
ECMA_201,
#endregion ECMA floppy standards
#region FDFORMAT, non-standard floppy formats
@@ -449,7 +440,6 @@ namespace DiscImageChef.CommonTypes
#region Iomega
Bernoulli,
Bernoulli2,
DataPlay,
Ditto,
DittoMax,
Jaz,
@@ -501,7 +491,9 @@ namespace DiscImageChef.CommonTypes
#region Exatape
Exatape15m,
Exatape22m,
Exatape22mAME,
Exatape28m,
Exatape40m,
Exatape45m,
Exatape54m,
@@ -509,7 +501,7 @@ namespace DiscImageChef.CommonTypes
Exatape76m,
Exatape80m,
Exatape106m,
Exatape106mXL,
Exatape160mXL,
Exatape112m,
Exatape125m,
Exatape150m,
@@ -540,6 +532,7 @@ namespace DiscImageChef.CommonTypes
SQ800,
SQ1500,
SQ2000,
SyJet,
#endregion SyQuest
#region Nintendo
@@ -679,9 +672,64 @@ namespace DiscImageChef.CommonTypes
VXA3,
#endregion VXA
#region Magneto-optical
/// <summary>5,25", M.O., ??? sectors, 1024 bytes/sector, ECMA-153, ISO 11560</summary>
ECMA_153,
/// <summary>5,25", M.O., ??? sectors, 512 bytes/sector, ECMA-153, ISO 11560</summary>
ECMA_153_512,
/// <summary>3,5", M.O., 249850 sectors, 512 bytes/sector, ECMA-154, ISO 10090</summary>
ECMA_154,
/// <summary>5,25", M.O., 904995 sectors, 512 bytes/sector, ECMA-183, ISO 13481</summary>
ECMA_183_512,
/// <summary>5,25", M.O., 498526 sectors, 1024 bytes/sector, ECMA-183, ISO 13481</summary>
ECMA_183,
/// <summary>5,25", M.O., 1128772 or 1163337 sectors, 512 bytes/sector, ECMA-183, ISO 13549</summary>
ECMA_184_512,
/// <summary>5,25", M.O., 603466 or 637041 sectors, 1024 bytes/sector, ECMA-183, ISO 13549</summary>
ECMA_184,
/// <summary>300mm, M.O., ??? sectors, 1024 bytes/sector, ECMA-189, ISO 13614</summary>
ECMA_189,
/// <summary>300mm, M.O., ??? sectors, 1024 bytes/sector, ECMA-190, ISO 13403</summary>
ECMA_190,
/// <summary>5,25", M.O., 936921 or 948770 sectors, 1024 bytes/sector, ECMA-195, ISO 13842</summary>
ECMA_195,
/// <summary>5,25", M.O., 1644581 or 1647371 sectors, 512 bytes/sector, ECMA-195, ISO 13842</summary>
ECMA_195_512,
/// <summary>3,5", M.O., 446325 sectors, 512 bytes/sector, ECMA-201, ISO 13963</summary>
ECMA_201,
/// <summary>3,5", M.O., 429975 sectors, 512 bytes/sector, embossed, ISO 13963</summary>
ECMA_201_ROM,
/// <summary>3,5", M.O., 371371 sectors, 1024 bytes/sector, ECMA-223</summary>
ECMA_223,
/// <summary>3,5", M.O., 694929 sectors, 512 bytes/sector, ECMA-223</summary>
ECMA_223_512,
/// <summary>5,25", M.O., 1244621 sectors, 1024 bytes/sector, ECMA-238, ISO 15486</summary>
ECMA_238,
/// <summary>3,5", M.O., 318988, 320332 or 321100 sectors, 2048 bytes/sector, ECMA-239, ISO 15498</summary>
ECMA_239,
/// <summary>356mm, M.O., 14476734 sectors, 1024 bytes/sector, ECMA-260, ISO 15898</summary>
ECMA_260,
/// <summary>356mm, M.O., 24445990 sectors, 1024 bytes/sector, ECMA-260, ISO 15898</summary>
ECMA_260_Double,
/// <summary>5,25", M.O., 1128134 sectors, 2048 bytes/sector, ECMA-280, ISO 18093</summary>
ECMA_280,
/// <summary>300mm, M.O., 7355716 sectors, 2048 bytes/sector, ECMA-317, ISO 20162</summary>
ECMA_317,
/// <summary>5,25", M.O., 1095840 sectors, 4096 bytes/sector, ECMA-322, ISO 22092</summary>
ECMA_322,
/// <summary>5,25", M.O., 2043664 sectors, 2048 bytes/sector, ECMA-322, ISO 22092</summary>
ECMA_322_2k,
/// <summary>3,5", M.O., 605846 sectors, 2048 bytes/sector, Cherry Book, GigaMo, ECMA-351, ISO 17346</summary>
GigaMo,
/// <summary>3,5", M.O., 1063146 sectors, 2048 bytes/sector, Cherry Book 2, GigaMo 2, ECMA-353, ISO 22533</summary>
GigaMo2,
UnknownMO,
#endregion Magneto-optical
#region Other floppy standards
CompactFloppy,
DemiDiskette,
/// <summary>3.5", 652 tracks, 2 sides, 512 bytes/sector, Floptical, ECMA-207, ISO 14169</summary>
Floptical,
HiFD,
LS120,
@@ -713,13 +761,23 @@ namespace DiscImageChef.CommonTypes
SmartMedia,
xD,
XQD,
DataPlay,
/// <summary>120mm, Phase-Change, 1298496 sectors, 512 bytes/sector, PD650, ECMA-240, ISO 15485</summary>
PD650,
/// <summary>120mm, Write-Once, 1281856 sectors, 512 bytes/sector, PD650, ECMA-240, ISO 15485</summary>
PD650_WORM,
#endregion Miscellaneous
#region Generic hard disks
Microdrive,
RDX,
GENERIC_HDD
/// <summary>Imation 320Gb RDX</summary>
RDX320,
GENERIC_HDD,
Zone_HDD,
// USB flash drives
FlashDrive
#endregion Generic hard disks
};
}

File diff suppressed because it is too large Load Diff

View File

@@ -39,7 +39,7 @@ using System;
namespace DiscImageChef.Decoders.SCSI
{
enum PeripheralQualifiers : byte
public enum PeripheralQualifiers : byte
{
/// <summary>
/// Peripheral qualifier: Device is connected and supported
@@ -159,7 +159,7 @@ namespace DiscImageChef.Decoders.SCSI
UnknownDevice = 0x1F
}
enum ANSIVersions : byte
public enum ANSIVersions : byte
{
/// <summary>
/// Device does not claim conformance to any ANSI version
@@ -191,7 +191,7 @@ namespace DiscImageChef.Decoders.SCSI
ANSI2008Version = 0x06
}
enum ECMAVersions : byte
public enum ECMAVersions : byte
{
/// <summary>
/// Device does not claim conformance to any ECMA version
@@ -203,7 +203,7 @@ namespace DiscImageChef.Decoders.SCSI
ECMA111 = 0x01
}
enum ISOVersions : byte
public enum ISOVersions : byte
{
/// <summary>
/// Device does not claim conformance to any ISO/IEC version
@@ -215,7 +215,7 @@ namespace DiscImageChef.Decoders.SCSI
ISO1995Version = 0x02
}
enum SPIClocking : byte
public enum SPIClocking : byte
{
/// <summary>
/// Supports only ST
@@ -235,7 +235,7 @@ namespace DiscImageChef.Decoders.SCSI
STandDT = 0x03,
}
enum TGPSValues : byte
public enum TGPSValues : byte
{
/// <summary>
/// Assymetrical access not supported

View File

@@ -204,9 +204,9 @@ namespace DiscImageChef.Decoders.SCSI
StringBuilder sb = new StringBuilder();
sb.AppendFormat("Device vendor: {0}", VendorString.Prettify(StringHandlers.SpacePaddedToString(response.VendorIdentification))).AppendLine();
sb.AppendFormat("Device name: {0}", StringHandlers.SpacePaddedToString(response.ProductIdentification)).AppendLine();
sb.AppendFormat("Device release level: {0}", StringHandlers.SpacePaddedToString(response.ProductRevisionLevel)).AppendLine();
sb.AppendFormat("Device vendor: {0}", VendorString.Prettify(StringHandlers.CToString(response.VendorIdentification).Trim())).AppendLine();
sb.AppendFormat("Device name: {0}", StringHandlers.CToString(response.ProductIdentification).Trim()).AppendLine();
sb.AppendFormat("Device release level: {0}", StringHandlers.CToString(response.ProductRevisionLevel).Trim()).AppendLine();
switch ((PeripheralQualifiers)response.PeripheralQualifier)
{
case PeripheralQualifiers.Supported:

View File

@@ -91,6 +91,9 @@ namespace DiscImageChef.Devices
throw new InvalidOperationException(String.Format("Platform {0} not yet supported.", platformID));
}
if (error)
throw new SystemException(String.Format("Error {0} opening device.", lastError));
type = DeviceType.Unknown;
scsiType = Decoders.SCSI.PeripheralDeviceTypes.UnknownDevice;
@@ -102,6 +105,9 @@ namespace DiscImageChef.Devices
bool scsiSense = ScsiInquiry(out inqBuf, out senseBuf);
if (error)
throw new SystemException(String.Format("Error {0} trying device.", lastError));
#region USB
if(platformID == DiscImageChef.Interop.PlatformID.Linux)
{
@@ -251,9 +257,9 @@ namespace DiscImageChef.Devices
if (Inquiry.HasValue)
{
revision = StringHandlers.SpacePaddedToString(Inquiry.Value.ProductRevisionLevel);
model = StringHandlers.SpacePaddedToString(Inquiry.Value.ProductIdentification);
manufacturer = StringHandlers.SpacePaddedToString(Inquiry.Value.VendorIdentification);
revision = StringHandlers.CToString(Inquiry.Value.ProductRevisionLevel).Trim();
model = StringHandlers.CToString(Inquiry.Value.ProductIdentification).Trim();
manufacturer = StringHandlers.CToString(Inquiry.Value.VendorIdentification).Trim();
removable = Inquiry.Value.RMB;
scsiType = (Decoders.SCSI.PeripheralDeviceTypes)Inquiry.Value.PeripheralDeviceType;

View File

@@ -492,6 +492,90 @@ namespace DiscImageChef.Devices
return sense;
}
public bool PreventMediumRemoval(out byte[] senseBuffer, uint timeout, out double duration)
{
return PreventAllowMediumRemoval(out senseBuffer, false, true, timeout, out duration);
}
public bool AllowMediumRemoval(out byte[] senseBuffer, uint timeout, out double duration)
{
return PreventAllowMediumRemoval(out senseBuffer, false, false, timeout, out duration);
}
public bool PreventAllowMediumRemoval(out byte[] senseBuffer, bool persistent, bool prevent, uint timeout, out double duration)
{
senseBuffer = new byte[32];
byte[] cdb = new byte[6];
byte[] buffer = new byte[0];
bool sense;
cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval;
if (prevent)
cdb[4] += 0x01;
if (persistent)
cdb[4] += 0x02;
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
error = lastError != 0;
DicConsole.DebugWriteLine("SCSI Device", "PREVENT ALLOW MEDIUM REMOVAL took {0} ms.", duration);
return sense;
}
public bool LoadTray(out byte[] senseBuffer, uint timeout, out double duration)
{
return StartStopUnit(out senseBuffer, false, 0, 0, false, true, true, timeout, out duration);
}
public bool EjectTray(out byte[] senseBuffer, uint timeout, out double duration)
{
return StartStopUnit(out senseBuffer, false, 0, 0, false, true, false, timeout, out duration);
}
public bool StartUnit(out byte[] senseBuffer, uint timeout, out double duration)
{
return StartStopUnit(out senseBuffer, false, 0, 0, false, false, true, timeout, out duration);
}
public bool StopUnit(out byte[] senseBuffer, uint timeout, out double duration)
{
return StartStopUnit(out senseBuffer, false, 0, 0, false, false, false, timeout, out duration);
}
public bool StartStopUnit(out byte[] senseBuffer, bool immediate, byte formatLayer, byte powerConditions, bool changeFormatLayer, bool loadEject, bool start, uint timeout, out double duration)
{
senseBuffer = new byte[32];
byte[] cdb = new byte[6];
byte[] buffer = new byte[0];
bool sense;
cdb[0] = (byte)ScsiCommands.StartStopUnit;
if (immediate)
cdb[1] += 0x01;
if (changeFormatLayer)
{
cdb[3] = (byte)(formatLayer & 0x03);
cdb[4] += 0x04;
}
else
{
if(loadEject)
cdb[4] += 0x02;
if(start)
cdb[4] += 0x01;
}
cdb[4] += (byte)((powerConditions & 0x0F) << 4);
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
error = lastError != 0;
DicConsole.DebugWriteLine("SCSI Device", "START STOP UNIT took {0} ms.", duration);
return sense;
}
}
}

View File

@@ -52,7 +52,7 @@ namespace DiscImageChef.Devices
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
/// <param name="lba">Start block address.</param>
/// <param name="transferLength">How many blocks to read.</param>
public bool ReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, uint timeout, out double duration)
public bool NecReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint transferLength, uint timeout, out double duration)
{
senseBuffer = new byte[32];
byte[] cdb = new byte[10];

View File

@@ -107,8 +107,7 @@ namespace DiscImageChef.Devices
cdb[9] = (byte)(endMsf & 0xFF);
cdb[10] = (byte)subchannel;
uint transferLength = (uint)((cdb[6] - cdb[3]) * 60 * 75 + (cdb[7] - cdb[4]) * 75 + (cdb[8] - cdb[5]));
uint transferLength = (uint)((cdb[7] - cdb[3]) * 60 * 75 + (cdb[8] - cdb[4]) * 75 + (cdb[9] - cdb[5]));
buffer = new byte[blockSize * transferLength];
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);

View File

@@ -54,7 +54,7 @@ namespace DiscImageChef.Devices
/// <param name="transferLength">How many blocks to read.</param>
/// <param name="blockSize">Block size.</param>
/// <param name="subchannel">Subchannel selection.</param>
public bool ReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint transferLength, PlextorSubchannel subchannel, uint timeout, out double duration)
public bool PlextorReadCdDa(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint transferLength, PlextorSubchannel subchannel, uint timeout, out double duration)
{
senseBuffer = new byte[32];
byte[] cdb = new byte[12];

View File

@@ -382,9 +382,9 @@ namespace DiscImageChef.Devices
/// <param name="senseBuffer">Sense buffer.</param>
/// <param name="timeout">Timeout in seconds.</param>
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
public bool PreventMediumRemoval(out byte[] senseBuffer, uint timeout, out double duration)
public bool SpcPreventMediumRemoval(out byte[] senseBuffer, uint timeout, out double duration)
{
return PreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Prevent, timeout, out duration);
return SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Prevent, timeout, out duration);
}
/// <summary>
@@ -394,9 +394,9 @@ namespace DiscImageChef.Devices
/// <param name="senseBuffer">Sense buffer.</param>
/// <param name="timeout">Timeout in seconds.</param>
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
public bool AllowMediumRemoval(out byte[] senseBuffer, uint timeout, out double duration)
public bool SpcAllowMediumRemoval(out byte[] senseBuffer, uint timeout, out double duration)
{
return PreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Allow, timeout, out duration);
return SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Allow, timeout, out duration);
}
/// <summary>
@@ -407,12 +407,12 @@ namespace DiscImageChef.Devices
/// <param name="timeout">Timeout in seconds.</param>
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
/// <param name="prevent"><c>true</c> to prevent medium removal, <c>false</c> to allow it.</param>
public bool PreventAllowMediumRemoval(out byte[] senseBuffer, bool prevent, uint timeout, out double duration)
public bool SpcPreventAllowMediumRemoval(out byte[] senseBuffer, bool prevent, uint timeout, out double duration)
{
if (prevent)
return PreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Prevent, timeout, out duration);
return SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Prevent, timeout, out duration);
else
return PreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Allow, timeout, out duration);
return SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Allow, timeout, out duration);
}
/// <summary>
@@ -423,7 +423,7 @@ namespace DiscImageChef.Devices
/// <param name="timeout">Timeout in seconds.</param>
/// <param name="duration">Duration in milliseconds it took for the device to execute the command.</param>
/// <param name="preventMode">Prevention mode.</param>
public bool PreventAllowMediumRemoval(out byte[] senseBuffer, ScsiPreventAllowMode preventMode, uint timeout, out double duration)
public bool SpcPreventAllowMediumRemoval(out byte[] senseBuffer, ScsiPreventAllowMode preventMode, uint timeout, out double duration)
{
senseBuffer = new byte[32];
byte[] cdb = new byte[6];

View File

@@ -20,6 +20,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>

View File

@@ -331,12 +331,12 @@ namespace DiscImageChef.Devices.Linux
public static string ReadLink(string path)
{
IntPtr buf = Marshal.AllocHGlobal(int.MaxValue);
IntPtr buf = Marshal.AllocHGlobal(4096);
int resultSize;
if (Interop.DetectOS.Is64Bit())
{
long result64 = Extern.readlink64(path, buf, (long)int.MaxValue);
long result64 = Extern.readlink64(path, buf, (long)4096);
if (result64 <= 0)
return null;
@@ -344,7 +344,7 @@ namespace DiscImageChef.Devices.Linux
}
else
{
int result = Extern.readlink(path, buf, int.MaxValue);
int result = Extern.readlink(path, buf, 4096);
if (result <= 0)
return null;

View File

@@ -145,7 +145,7 @@ namespace DiscImageChef.Devices.Linux
Unknown = -5
}
enum LinuxIoctl : ulong
enum LinuxIoctl : uint
{
// SCSI IOCtls
SG_GET_VERSION_NUM = 0x2282,

View File

@@ -673,11 +673,11 @@ namespace DiscImageChef.ImagePlugins
case 481520640:
return MediaType.ECMA_183_512;
case 533403648:
return MediaType.ECMA_183_1024;
return MediaType.ECMA_183;
case 596787200:
return MediaType.ECMA_184_512;
case 654540800:
return MediaType.ECMA_184_1024;
return MediaType.ECMA_184;
default:
return MediaType.GENERIC_HDD;
}

View File

@@ -0,0 +1,958 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : DeviceReport.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 <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using System;
using System.Xml.Serialization;
using DiscImageChef.Decoders.ATA;
using DiscImageChef.Decoders.SCSI;
namespace DiscImageChef.Metadata
{
[SerializableAttribute()]
[XmlRootAttribute("DicDeviceReport", Namespace="", IsNullable=false)]
public class DeviceReport
{
public usbType USB;
public firewireType FireWire;
public ataType ATA;
public ataType ATAPI;
public scsiType SCSI;
}
public class usbType
{
public ushort VendorID;
public ushort ProductID;
public string Manufacturer;
public string Product;
public bool RemovableMedia;
}
public class firewireType
{
public uint VendorID;
public uint ProductID;
public string Manufacturer;
public string Product;
public bool RemovableMedia;
}
public class ataType
{
public chsType CHS;
public chsType CurrentCHS;
public string AdditionalPID;
public Identify.TransferMode APIOSupported;
public ushort ATAPIByteCount;
public ushort BufferType;
public ushort BufferSize;
public Identify.CapabilitiesBit Capabilities;
public Identify.CapabilitiesBit2 Capabilities2;
public Identify.CapabilitiesBit3 Capabilities3;
public ushort CFAPowerMode;
public Identify.CommandSetBit CommandSet;
public Identify.CommandSetBit2 CommandSet2;
public Identify.CommandSetBit3 CommandSet3;
public Identify.CommandSetBit4 CommandSet4;
public Identify.CommandSetBit5 CommandSet5;
public byte CurrentAAM;
public ushort CurrentAPM;
public Identify.DataSetMgmtBit DataSetMgmt;
public ushort DataSetMgmtSize;
public Identify.DeviceFormFactorEnum DeviceFormFactor;
public Identify.TransferMode DMAActive;
public Identify.TransferMode DMASupported;
public byte DMATransferTimingMode;
public ushort EccBytes;
public ushort EnhancedSecurityEraseTime;
public Identify.CommandSetBit EnabledCommandSet;
public Identify.CommandSetBit2 EnabledCommandSet2;
public Identify.CommandSetBit3 EnabledCommandSet3;
public Identify.CommandSetBit4 EnabledCommandSet4;
public Identify.SATAFeaturesBit EnabledSATAFeatures;
public ulong ExtendedUserSectors;
public byte FreeFallSensitivity;
public string FirmwareRevision;
public Identify.GeneralConfigurationBit GeneralConfiguration;
public ushort HardwareResetResult;
public ushort InterseekDelay;
public uint LBASectors;
public uint LBASectorsCurrent;
public ulong LBA48Sectors;
public ushort LogicalAlignment;
public uint LogicalSectorWords;
public Identify.MajorVersionBit MajorVersion;
public ushort MasterPasswordRevisionCode;
public ushort MaxDownloadMicroMode3;
public ushort MaxQueueDepth;
public Identify.TransferMode MDMAActive;
public Identify.TransferMode MDMASupported;
public ushort MinDownloadMicroMode3;
public ushort MinMDMACycleTime;
public ushort MinorVersion;
public ushort MinPIOCycleTimeNoFlow;
public ushort MinPIOCycleTimeFlow;
public string Model;
public byte MultipleMaxSectors;
public byte MultipleSectorNumber;
public ushort NVCacheCaps;
public uint NVCacheSize;
public ushort NVCacheWriteSpeed;
public byte NVEstimatedSpinUp;
public ushort NominalRotationRate;
public ushort PacketBusRelease;
public ushort PhysLogSectorSize;
public byte PIOTransferTimingMode;
public byte RecommendedAAM;
public ushort RecommendedMDMACycleTime;
public ushort RemovableStatusSet;
public Identify.SATACapabilitiesBit SATACapabilities;
public Identify.SATACapabilitiesBit2 SATACapabilities2;
public Identify.SATAFeaturesBit SATAFeatures;
public Identify.SCTCommandTransportBit SCTCommandTransport;
public uint SectorsPerCard;
public ushort SecurityEraseTime;
public Identify.SecurityStatusBit SecurityStatus;
public ushort ServiceBusyClear;
public Identify.SpecificConfigurationEnum SpecificConfiguration;
public ushort StreamAccessLatency;
public ushort StreamMinReqSize;
public uint StreamPerformanceGranularity;
public ushort StreamTransferTimeDMA;
public ushort StreamTransferTimePIO;
public ushort TransportMajorVersion;
public ushort TransportMinorVersion;
public Identify.TrustedComputingBit TrustedComputing;
public Identify.TransferMode UDMAActive;
public Identify.TransferMode UDMASupported;
public ushort UnformattedBPT;
public ushort UnformattedBPS;
public byte WRVMode;
public uint WRVSectorCountMode3;
public uint WRVSectorCountMode2;
[XmlIgnoreAttribute()]
public bool AdditionalPIDSpecified;
[XmlIgnoreAttribute()]
public bool APIOSupportedSpecified;
[XmlIgnoreAttribute()]
public bool ATAPIByteCountSpecified;
[XmlIgnoreAttribute()]
public bool BufferTypeSpecified;
[XmlIgnoreAttribute()]
public bool BufferSizeSpecified;
[XmlIgnoreAttribute()]
public bool CapabilitiesSpecified;
[XmlIgnoreAttribute()]
public bool Capabilities2Specified;
[XmlIgnoreAttribute()]
public bool Capabilities3Specified;
[XmlIgnoreAttribute()]
public bool CFAPowerModeSpecified;
[XmlIgnoreAttribute()]
public bool CommandSetSpecified;
[XmlIgnoreAttribute()]
public bool CommandSet2Specified;
[XmlIgnoreAttribute()]
public bool CommandSet3Specified;
[XmlIgnoreAttribute()]
public bool CommandSet4Specified;
[XmlIgnoreAttribute()]
public bool CommandSet5Specified;
[XmlIgnoreAttribute()]
public bool CurrentAAMSpecified;
[XmlIgnoreAttribute()]
public bool CurrentAPMSpecified;
[XmlIgnoreAttribute()]
public bool DataSetMgmtSpecified;
[XmlIgnoreAttribute()]
public bool DataSetMgmtSizeSpecified;
[XmlIgnoreAttribute()]
public bool DeviceFormFactorSpecified;
[XmlIgnoreAttribute()]
public bool DMAActiveSpecified;
[XmlIgnoreAttribute()]
public bool DMASupportedSpecified;
[XmlIgnoreAttribute()]
public bool DMATransferTimingModeSpecified;
[XmlIgnoreAttribute()]
public bool EccBytesSpecified;
[XmlIgnoreAttribute()]
public bool EnhancedSecurityEraseTimeSpecified;
[XmlIgnoreAttribute()]
public bool EnabledCommandSetSpecified;
[XmlIgnoreAttribute()]
public bool EnabledCommandSet2Specified;
[XmlIgnoreAttribute()]
public bool EnabledCommandSet3Specified;
[XmlIgnoreAttribute()]
public bool EnabledCommandSet4Specified;
[XmlIgnoreAttribute()]
public bool EnabledSATAFeaturesSpecified;
[XmlIgnoreAttribute()]
public bool ExtendedIdentifySpecified;
[XmlIgnoreAttribute()]
public bool ExtendedUserSectorsSpecified;
[XmlIgnoreAttribute()]
public bool FreeFallSensitivitySpecified;
[XmlIgnoreAttribute()]
public bool FirmwareRevisionSpecified;
[XmlIgnoreAttribute()]
public bool GeneralConfigurationSpecified;
[XmlIgnoreAttribute()]
public bool HardwareResetResultSpecified;
[XmlIgnoreAttribute()]
public bool InterseekDelaySpecified;
[XmlIgnoreAttribute()]
public bool LBASectorsSpecified;
[XmlIgnoreAttribute()]
public bool LBASectorsCurrentSpecified;
[XmlIgnoreAttribute()]
public bool LBA48SectorsSpecified;
[XmlIgnoreAttribute()]
public bool LogicalAlignmentSpecified;
[XmlIgnoreAttribute()]
public bool LogicalSectorWordsSpecified;
[XmlIgnoreAttribute()]
public bool MajorVersionSpecified;
[XmlIgnoreAttribute()]
public bool MasterPasswordRevisionCodeSpecified;
[XmlIgnoreAttribute()]
public bool MaxDownloadMicroMode3Specified;
[XmlIgnoreAttribute()]
public bool MaxQueueDepthSpecified;
[XmlIgnoreAttribute()]
public bool MDMAActiveSpecified;
[XmlIgnoreAttribute()]
public bool MDMASupportedSpecified;
[XmlIgnoreAttribute()]
public bool MinDownloadMicroMode3Specified;
[XmlIgnoreAttribute()]
public bool MinMDMACycleTimeSpecified;
[XmlIgnoreAttribute()]
public bool MinorVersionSpecified;
[XmlIgnoreAttribute()]
public bool MinPIOCycleTimeNoFlowSpecified;
[XmlIgnoreAttribute()]
public bool MinPIOCycleTimeFlowSpecified;
[XmlIgnoreAttribute()]
public bool ModelSpecified;
[XmlIgnoreAttribute()]
public bool MultipleMaxSectorsSpecified;
[XmlIgnoreAttribute()]
public bool MultipleSectorNumberSpecified;
[XmlIgnoreAttribute()]
public bool NVCacheCapsSpecified;
[XmlIgnoreAttribute()]
public bool NVCacheSizeSpecified;
[XmlIgnoreAttribute()]
public bool NVCacheWriteSpeedSpecified;
[XmlIgnoreAttribute()]
public bool NVEstimatedSpinUpSpecified;
[XmlIgnoreAttribute()]
public bool NominalRotationRateSpecified;
[XmlIgnoreAttribute()]
public bool PacketBusReleaseSpecified;
[XmlIgnoreAttribute()]
public bool PhysLogSectorSizeSpecified;
[XmlIgnoreAttribute()]
public bool PIOTransferTimingModeSpecified;
[XmlIgnoreAttribute()]
public bool RecommendedAAMSpecified;
[XmlIgnoreAttribute()]
public bool RecommendedMDMACycleTimeSpecified;
[XmlIgnoreAttribute()]
public bool RemovableStatusSetSpecified;
[XmlIgnoreAttribute()]
public bool SATACapabilitiesSpecified;
[XmlIgnoreAttribute()]
public bool SATACapabilities2Specified;
[XmlIgnoreAttribute()]
public bool SATAFeaturesSpecified;
[XmlIgnoreAttribute()]
public bool SCTCommandTransportSpecified;
[XmlIgnoreAttribute()]
public bool SectorsPerCardSpecified;
[XmlIgnoreAttribute()]
public bool SecurityEraseTimeSpecified;
[XmlIgnoreAttribute()]
public bool SecurityStatusSpecified;
[XmlIgnoreAttribute()]
public bool ServiceBusyClearSpecified;
[XmlIgnoreAttribute()]
public bool SpecificConfigurationSpecified;
[XmlIgnoreAttribute()]
public bool StreamAccessLatencySpecified;
[XmlIgnoreAttribute()]
public bool StreamMinReqSizeSpecified;
[XmlIgnoreAttribute()]
public bool StreamPerformanceGranularitySpecified;
[XmlIgnoreAttribute()]
public bool StreamTransferTimeDMASpecified;
[XmlIgnoreAttribute()]
public bool StreamTransferTimePIOSpecified;
[XmlIgnoreAttribute()]
public bool TransportMajorVersionSpecified;
[XmlIgnoreAttribute()]
public bool TransportMinorVersionSpecified;
[XmlIgnoreAttribute()]
public bool TrustedComputingSpecified;
[XmlIgnoreAttribute()]
public bool UDMAActiveSpecified;
[XmlIgnoreAttribute()]
public bool UDMASupportedSpecified;
[XmlIgnoreAttribute()]
public bool UnformattedBPTSpecified;
[XmlIgnoreAttribute()]
public bool UnformattedBPSSpecified;
[XmlIgnoreAttribute()]
public bool WRVModeSpecified;
[XmlIgnoreAttribute()]
public bool WRVSectorCountMode3Specified;
[XmlIgnoreAttribute()]
public bool WRVSectorCountMode2Specified;
}
public class chsType
{
public ushort Cylinders;
public ushort Heads;
public ushort Sectors;
}
public class scsiType
{
public scsiInquiryType Inquiry;
public pageType[] EVPDPages;
public bool SupportsModeSense6;
public bool SupportsModeSense10;
public bool SupportsModeSubpages;
public modeType ModeSense;
public mmcType MultiMediaDevice;
public testedMediaType ReadCapabilities;
public testedMediaType[] RemovableMedias;
public sscType SequentialDevice;
[XmlIgnoreAttribute()]
public bool ReadCapabilitiesSpecified;
}
public class scsiInquiryType
{
public bool AccessControlCoordinator;
public bool ACKRequests;
public bool AERCSupported;
public bool Address16;
public bool Address32;
public byte ANSIVersion;
public TGPSValues AsymmetricalLUNAccess;
public bool BasicQueueing;
public byte DeviceTypeModifier;
public byte ECMAVersion;
public bool EnclosureServices;
public bool HierarchicalLUN;
public bool IUS;
public byte ISOVersion;
public bool LinkedCommands;
public bool MediumChanger;
public bool MultiPortDevice;
public bool NormalACA;
public PeripheralDeviceTypes PeripheralDeviceType;
public PeripheralQualifiers PeripheralQualifier;
public string ProductIdentification;
public string ProductRevisionLevel;
public bool Protection;
public bool QAS;
public bool RelativeAddressing;
public bool Removable;
public byte ResponseDataFormat;
public bool TaggedCommandQueue;
public bool TerminateTaskSupported;
public bool ThirdPartyCopy;
public bool TranferDisable;
public bool SoftReset;
public SPIClocking SPIClocking;
public bool StorageArrayController;
public bool SyncTransfer;
public string VendorIdentification;
public ushort[] VersionDescriptors;
public bool WideBus16;
public bool WideBus32;
[XmlIgnoreAttribute()]
public bool ANSIVersionSpecified;
[XmlIgnoreAttribute()]
public bool ECMAVersionSpecified;
[XmlIgnoreAttribute()]
public bool DeviceTypeModifierSpecified;
[XmlIgnoreAttribute()]
public bool ISOVersionSpecified;
[XmlIgnoreAttribute()]
public bool ProductIdentificationSpecified;
[XmlIgnoreAttribute()]
public bool ProductRevisionLevelSpecified;
[XmlIgnoreAttribute()]
public bool ResponseDataFormatSpecified;
[XmlIgnoreAttribute()]
public bool VendorIdentificationSpecified;
}
[SerializableAttribute()]
public class pageType
{
[XmlAttributeAttribute()]
public byte page;
[XmlTextAttribute()]
public byte[] value;
}
public class modeType
{
public byte MediumType;
public bool WriteProtected;
public blockDescriptorType[] BlockDescriptors;
public byte Speed;
public byte BufferedMode;
public bool BlankCheckEnabled;
public bool DPOandFUA;
public modePageType[] ModePages;
[XmlIgnoreAttribute()]
public bool MediumTypeSpecified;
[XmlIgnoreAttribute()]
public bool SpeedSpecified;
[XmlIgnoreAttribute()]
public bool BufferedModeSpecified;
}
public class blockDescriptorType
{
public byte Density;
public ulong Blocks;
public uint BlockLength;
[XmlIgnoreAttribute()]
public bool BlocksSpecified;
[XmlIgnoreAttribute()]
public bool BlockLengthSpecified;
}
[SerializableAttribute()]
public class modePageType
{
[XmlAttributeAttribute()]
public byte page;
[XmlAttributeAttribute()]
public byte subpage;
[XmlTextAttribute()]
public byte[] value;
}
public class mmcType
{
public mmcModeType ModeSense2A;
public mmcFeaturesType Features;
public testedMediaType[] TestedMedia;
}
public class mmcModeType
{
public bool AccurateCDDA;
public bool BCK;
public ushort BufferSize;
public bool BufferUnderRunProtection;
public bool CanEject;
public bool CanLockMedia;
public bool CDDACommand;
public bool CompositeAudioVideo;
public bool CSSandCPPMSupported;
public ushort CurrentSpeed;
public ushort CurrentWriteSpeed;
public ushort CurrentWriteSpeedSelected;
public bool DeterministicSlotChanger;
public bool DigitalPort1;
public bool DigitalPort2;
public bool LeadInPW;
public byte LoadingMechanismType;
public bool LockStatus;
public bool LSBF;
public ushort MaximumSpeed;
public ushort MaximumWriteSpeed;
public bool PlaysAudio;
public bool PreventJumperStatus;
public bool RCK;
public bool ReadsBarcode;
public bool ReadsBothSides;
public bool ReadsCDR;
public bool ReadsCDRW;
public bool ReadsDeinterlavedSubchannel;
public bool ReadsDVDR;
public bool ReadsDVDRAM;
public bool ReadsDVDROM;
public bool ReadsISRC;
public bool ReadsMode2Form2;
public bool ReadsMode2Form1;
public bool ReadsPacketCDR;
public bool ReadsSubchannel;
public bool ReadsUPC;
public bool ReturnsC2Pointers;
public byte RotationControlSelected;
public bool SeparateChannelMute;
public bool SeparateChannelVolume;
public bool SSS;
public bool SupportsMultiSession;
public ushort SupportedVolumeLevels;
public bool TestWrite;
public bool WritesCDR;
public bool WritesCDRW;
public bool WritesDVDR;
public bool WritesDVDRAM;
public Modes.ModePage_2A_WriteDescriptor[] WriteSpeedPerformanceDescriptors;
[XmlIgnoreAttribute()]
public bool MaximumSpeedSpecified;
[XmlIgnoreAttribute()]
public bool SupportedVolumeLevelsSpecified;
[XmlIgnoreAttribute()]
public bool BufferSizeSpecified;
[XmlIgnoreAttribute()]
public bool CurrentSpeedSpecified;
[XmlIgnoreAttribute()]
public bool MaximumWriteSpeedSpecified;
[XmlIgnoreAttribute()]
public bool CurrentWriteSpeedSpecified;
[XmlIgnoreAttribute()]
public bool RotationControlSelectedSpecified;
[XmlIgnoreAttribute()]
public bool CurrentWriteSpeedSelectedSpecified;
}
public class mmcFeaturesType
{
public byte AACSVersion;
public byte AGIDs;
public byte BindingNonceBlocks;
public ushort BlocksPerReadableUnit;
public bool BufferUnderrunFreeInDVD;
public bool BufferUnderrunFreeInSAO;
public bool BufferUnderrunFreeInTAO;
public bool CanAudioScan;
public bool CanEject;
public bool CanEraseSector;
public bool CanExpandBDRESpareArea;
public bool CanFormat;
public bool CanFormatBDREWithoutSpare;
public bool CanFormatCert;
public bool CanFormatFRF;
public bool CanFormatQCert;
public bool CanFormatRRM;
public bool CanGenerateBindingNonce;
public bool CanLoad;
public bool CanMuteSeparateChannels;
public bool CanOverwriteSAOTrack;
public bool CanOverwriteTAOTrack;
public bool CanPlayCDAudio;
public bool CanPseudoOverwriteBDR;
public bool CanReadAllDualR;
public bool CanReadAllDualRW;
public bool CanReadBD;
public bool CanReadBDR;
public bool CanReadBDRE1;
public bool CanReadBDRE2;
public bool CanReadBDROM;
public bool CanReadBluBCA;
public bool CanReadCD;
public bool CanReadCDMRW;
public bool CanReadCPRM_MKB;
public bool CanReadDDCD;
public bool CanReadDVD;
public bool CanReadDVDPlusMRW;
public bool CanReadDVDPlusR;
public bool CanReadDVDPlusRDL;
public bool CanReadDVDPlusRW;
public bool CanReadDVDPlusRWDL;
public bool CanReadDriveAACSCertificate;
public bool CanReadHDDVD;
public bool CanReadHDDVDR;
public bool CanReadHDDVDRAM;
public bool CanReadLeadInCDText;
public bool CanReadOldBDR;
public bool CanReadOldBDRE;
public bool CanReadOldBDROM;
public bool CanReadSpareAreaInformation;
public bool CanReportDriveSerial;
public bool CanReportMediaSerial;
public bool CanTestWriteDDCDR;
public bool CanTestWriteDVD;
public bool CanTestWriteInSAO;
public bool CanTestWriteInTAO;
public bool CanUpgradeFirmware;
public bool CanWriteBD;
public bool CanWriteBDR;
public bool CanWriteBDRE1;
public bool CanWriteBDRE2;
public bool CanWriteBusEncryptedBlocks;
public bool CanWriteCDMRW;
public bool CanWriteCDRW;
public bool CanWriteCDRWCAV;
public bool CanWriteCDSAO;
public bool CanWriteCDTAO;
public bool CanWriteCSSManagedDVD;
public bool CanWriteDDCDR;
public bool CanWriteDDCDRW;
public bool CanWriteDVDPlusMRW;
public bool CanWriteDVDPlusR;
public bool CanWriteDVDPlusRDL;
public bool CanWriteDVDPlusRW;
public bool CanWriteDVDPlusRWDL;
public bool CanWriteDVDR;
public bool CanWriteDVDRDL;
public bool CanWriteDVDRW;
public bool CanWriteHDDVDR;
public bool CanWriteHDDVDRAM;
public bool CanWriteOldBDR;
public bool CanWriteOldBDRE;
public bool CanWritePackedSubchannelInTAO;
public bool CanWriteRWSubchannelInSAO;
public bool CanWriteRWSubchannelInTAO;
public bool CanWriteRaw;
public bool CanWriteRawMultiSession;
public bool CanWriteRawSubchannelInTAO;
public bool ChangerIsSideChangeCapable;
public byte ChangerSlots;
public bool ChangerSupportsDiscPresent;
public byte CPRMVersion;
public byte CSSVersion;
public bool DBML;
public bool DVDMultiRead;
public bool EmbeddedChanger;
public bool ErrorRecoveryPage;
[XmlElementAttribute(DataType="date")]
public DateTime FirmwareDate;
public byte LoadingMechanismType;
public bool Locked;
public uint LogicalBlockSize;
public bool MultiRead;
public DiscImageChef.Decoders.SCSI.MMC.PhysicalInterfaces PhysicalInterfaceStandard;
public bool PreventJumper;
public bool SupportsAACS;
public bool SupportsBusEncryption;
public bool SupportsC2;
public bool SupportsCPRM;
public bool SupportsCSS;
public bool SupportsDAP;
public bool SupportsDeviceBusyEvent;
public bool SupportsHybridDiscs;
public bool SupportsModePage1Ch;
public bool SupportsOSSC;
public bool SupportsPWP;
public bool SupportsSWPP;
public bool SupportsSecurDisc;
public bool SupportsSeparateVolume;
public bool SupportsVCPS;
public bool SupportsWriteInhibitDCB;
public bool SupportsWriteProtectPAC;
public ushort VolumeLevels;
[XmlIgnoreAttribute()]
public bool PhysicalInterfaceStandardSpecified;
[XmlIgnoreAttribute()]
public bool AACSVersionSpecified;
[XmlIgnoreAttribute()]
public bool AGIDsSpecified;
[XmlIgnoreAttribute()]
public bool BindingNonceBlocksSpecified;
[XmlIgnoreAttribute()]
public bool CPRMVersionSpecified;
[XmlIgnoreAttribute()]
public bool CSSVersionSpecified;
[XmlIgnoreAttribute()]
public bool ChangerHighestSlotNumberSpecified;
[XmlIgnoreAttribute()]
public bool LoadingMechanismTypeSpecified;
[XmlIgnoreAttribute()]
public bool LogicalBlockSizeSpecified;
[XmlIgnoreAttribute()]
public bool BlocksPerReadableUnitSpecified;
[XmlIgnoreAttribute()]
public bool FirmwareDateSpecified;
[XmlIgnoreAttribute()]
public bool VolumeLevelsSpecified;
}
public class testedMediaType
{
public ulong Blocks;
public uint BlockSize;
public bool CanReadAACS;
public bool CanReadADIP;
public bool CanReadATIP;
public bool CanReadBCA;
public bool CanReadC2Pointers;
public bool CanReadCMI;
public bool CanReadCorrectedSubchannel;
public bool CanReadCorrectedSubchannelWithC2;
public bool CanReadDCB;
public bool CanReadDDS;
public bool CanReadDMI;
public bool CanReadDiscInformation;
public bool CanReadFullTOC;
public bool CanReadHDCMI;
public bool CanReadLayerCapacity;
public bool CanReadLeadIn;
public bool CanReadLeadOut;
public bool CanReadMediaID;
public bool CanReadMediaSerial;
public bool CanReadPAC;
public bool CanReadPFI;
public bool CanReadPMA;
public bool CanReadPQSubchannel;
public bool CanReadPQSubchannelWithC2;
public bool CanReadPRI;
public bool CanReadRWSubchannel;
public bool CanReadRWSubchannelWithC2;
public bool CanReadRecordablePFI;
public bool CanReadSpareAreaInformation;
public bool CanReadTOC;
public byte Density;
public uint LongBlockSize;
public string Manufacturer;
public bool MediaIsRecognized;
public byte MediumType;
public string MediumTypeName;
public string Model;
public bool SupportsHLDTSTReadRawDVD;
public bool SupportsNECReadCDDA;
public bool SupportsPioneerReadCDDA;
public bool SupportsPioneerReadCDDAMSF;
public bool SupportsPlextorReadCDDA;
public bool SupportsPlextorReadRawDVD;
public bool SupportsRead10;
public bool SupportsRead12;
public bool SupportsRead16;
public bool SupportsRead;
public bool SupportsReadCapacity16;
public bool SupportsReadCapacity;
public bool SupportsReadCd;
public bool SupportsReadCdMsf;
public bool SupportsReadCdRaw;
public bool SupportsReadCdMsfRaw;
public bool SupportsReadLong16;
public bool SupportsReadLong;
[XmlIgnoreAttribute()]
public bool BlocksSpecified;
[XmlIgnoreAttribute()]
public bool BlockSizeSpecified;
[XmlIgnoreAttribute()]
public bool CanReadAACSSpecified;
[XmlIgnoreAttribute()]
public bool CanReadADIPSpecified;
[XmlIgnoreAttribute()]
public bool CanReadATIPSpecified;
[XmlIgnoreAttribute()]
public bool CanReadBCASpecified;
[XmlIgnoreAttribute()]
public bool CanReadC2PointersSpecified;
[XmlIgnoreAttribute()]
public bool CanReadCMISpecified;
[XmlIgnoreAttribute()]
public bool CanReadCorrectedSubchannelSpecified;
[XmlIgnoreAttribute()]
public bool CanReadCorrectedSubchannelWithC2Specified;
[XmlIgnoreAttribute()]
public bool CanReadDCBSpecified;
[XmlIgnoreAttribute()]
public bool CanReadDDSSpecified;
[XmlIgnoreAttribute()]
public bool CanReadDMISpecified;
[XmlIgnoreAttribute()]
public bool CanReadDiscInformationSpecified;
[XmlIgnoreAttribute()]
public bool CanReadFullTOCSpecified;
[XmlIgnoreAttribute()]
public bool CanReadHDCMISpecified;
[XmlIgnoreAttribute()]
public bool CanReadLayerCapacitySpecified;
[XmlIgnoreAttribute()]
public bool CanReadLeadInSpecified;
[XmlIgnoreAttribute()]
public bool CanReadLeadOutSpecified;
[XmlIgnoreAttribute()]
public bool CanReadMediaIDSpecified;
[XmlIgnoreAttribute()]
public bool CanReadMediaSerialSpecified;
[XmlIgnoreAttribute()]
public bool CanReadPACSpecified;
[XmlIgnoreAttribute()]
public bool CanReadPFISpecified;
[XmlIgnoreAttribute()]
public bool CanReadPMASpecified;
[XmlIgnoreAttribute()]
public bool CanReadPQSubchannelSpecified;
[XmlIgnoreAttribute()]
public bool CanReadPQSubchannelWithC2Specified;
[XmlIgnoreAttribute()]
public bool CanReadPRISpecified;
[XmlIgnoreAttribute()]
public bool CanReadRWSubchannelSpecified;
[XmlIgnoreAttribute()]
public bool CanReadRWSubchannelWithC2Specified;
[XmlIgnoreAttribute()]
public bool CanReadRecordablePFISpecified;
[XmlIgnoreAttribute()]
public bool CanReadSpareAreaInformationSpecified;
[XmlIgnoreAttribute()]
public bool CanReadTOCSpecified;
[XmlIgnoreAttribute()]
public bool DensitySpecified;
[XmlIgnoreAttribute()]
public bool LongBlockSizeSpecified;
[XmlIgnoreAttribute()]
public bool ManufacturerSpecified;
[XmlIgnoreAttribute()]
public bool MediumTypeSpecified;
[XmlIgnoreAttribute()]
public bool ModelSpecified;
[XmlIgnoreAttribute()]
public bool SupportsHLDTSTReadRawDVDSpecified;
[XmlIgnoreAttribute()]
public bool SupportsNECReadCDDASpecified;
[XmlIgnoreAttribute()]
public bool SupportsPioneerReadCDDASpecified;
[XmlIgnoreAttribute()]
public bool SupportsPioneerReadCDDAMSFSpecified;
[XmlIgnoreAttribute()]
public bool SupportsPlextorReadCDDASpecified;
[XmlIgnoreAttribute()]
public bool SupportsPlextorReadRawDVDSpecified;
[XmlIgnoreAttribute()]
public bool SupportsRead10Specified;
[XmlIgnoreAttribute()]
public bool SupportsRead12Specified;
[XmlIgnoreAttribute()]
public bool SupportsRead16Specified;
[XmlIgnoreAttribute()]
public bool SupportsReadSpecified;
[XmlIgnoreAttribute()]
public bool SupportsReadCapacity16Specified;
[XmlIgnoreAttribute()]
public bool SupportsReadCapacitySpecified;
[XmlIgnoreAttribute()]
public bool SupportsReadCdSpecified;
[XmlIgnoreAttribute()]
public bool SupportsReadCdMsfSpecified;
[XmlIgnoreAttribute()]
public bool SupportsReadCdRawSpecified;
[XmlIgnoreAttribute()]
public bool SupportsReadCdMsfRawSpecified;
[XmlIgnoreAttribute()]
public bool SupportsReadLong16Specified;
[XmlIgnoreAttribute()]
public bool SupportsReadLongSpecified;
}
public class sscType
{
public byte BlockSizeGranularity;
public uint MaxBlockLength;
public uint MinBlockLength;
public SupportedDensity[] SupportedDensities;
public SupportedMedia[] SupportedMediaTypes;
public SequentialMedia[] TestedMedia;
[XmlIgnoreAttribute()]
public bool BlockSizeGranularitySpecified;
[XmlIgnoreAttribute()]
public bool MaxBlockLengthSpecified;
[XmlIgnoreAttribute()]
public bool MinBlockLengthSpecified;
}
public struct SupportedDensity
{
public byte PrimaryCode;
public byte SecondaryCode;
public bool Writable;
public bool Duplicate;
public bool DefaultDensity;
public uint BitsPerMm;
public ushort Width;
public ushort Tracks;
public uint Capacity;
public string Organization;
public string Name;
public string Description;
}
public struct SupportedMedia
{
public byte MediumType;
public int[] DensityCodes;
public ushort Width;
public ushort Length;
public string Organization;
public string Name;
public string Description;
}
public struct SequentialMedia
{
public bool CanReadMediaSerial;
public byte Density;
public string Manufacturer;
public bool MediaIsRecognized;
public byte MediumType;
public string MediumTypeName;
public string Model;
public SupportedDensity[] SupportedDensities;
public SupportedMedia[] SupportedMediaTypes;
[XmlIgnoreAttribute()]
public bool CanReadMediaSerialSpecified;
[XmlIgnoreAttribute()]
public bool DensitySpecified;
[XmlIgnoreAttribute()]
public bool MediumTypeSpecified;
}
}

View File

@@ -152,11 +152,47 @@ namespace DiscImageChef.Metadata
return dmns;
#endregion 8" floppy disk
#region 356mm magneto optical
case CommonTypes.MediaType.ECMA_260:
case CommonTypes.MediaType.ECMA_260_Double:
// According to ECMA-260 et al
dmns.Height = 421.84;
dmns.HeightSpecified = true;
dmns.Width = 443.76;
dmns.WidthSpecified = true;
dmns.Thickness = 25.4;
return dmns;
#endregion 356mm magneto optical
#region 300mm magneto optical
case CommonTypes.MediaType.ECMA_189:
case CommonTypes.MediaType.ECMA_190:
case CommonTypes.MediaType.ECMA_317:
// According to ECMA-317 et al
dmns.Height = 340;
dmns.HeightSpecified = true;
dmns.Width = 320;
dmns.WidthSpecified = true;
dmns.Thickness = 17;
return dmns;
#endregion 300mm magneto optical
#region 5.25" magneto optical
case CommonTypes.MediaType.ECMA_153:
case CommonTypes.MediaType.ECMA_153_512:
case CommonTypes.MediaType.ECMA_183_512:
case CommonTypes.MediaType.ECMA_183_1024:
case CommonTypes.MediaType.ECMA_183:
case CommonTypes.MediaType.ECMA_184_512:
case CommonTypes.MediaType.ECMA_184_1024:
case CommonTypes.MediaType.ECMA_184:
case CommonTypes.MediaType.ECMA_195:
case CommonTypes.MediaType.ECMA_195_512:
case CommonTypes.MediaType.ECMA_238:
case CommonTypes.MediaType.ECMA_280:
case CommonTypes.MediaType.ECMA_322:
case CommonTypes.MediaType.ECMA_322_2k:
case CommonTypes.MediaType.UDO:
case CommonTypes.MediaType.UDO2:
case CommonTypes.MediaType.UDO2_WORM:
// According to ECMA-183 et al
dmns.Height = 153;
dmns.HeightSpecified = true;
@@ -169,6 +205,11 @@ namespace DiscImageChef.Metadata
#region 3.5" magneto optical
case CommonTypes.MediaType.ECMA_154:
case CommonTypes.MediaType.ECMA_201:
case CommonTypes.MediaType.ECMA_201_ROM:
case CommonTypes.MediaType.ECMA_223:
case CommonTypes.MediaType.ECMA_223_512:
case CommonTypes.MediaType.GigaMo:
case CommonTypes.MediaType.GigaMo2:
// According to ECMA-154 et al
dmns.Height = 94;
dmns.HeightSpecified = true;
@@ -178,6 +219,21 @@ namespace DiscImageChef.Metadata
return dmns;
#endregion 3.5" magneto optical
case CommonTypes.MediaType.PD650:
case CommonTypes.MediaType.PD650_WORM:
dmns.Height = 135;
dmns.HeightSpecified = true;
dmns.Width = 124;
dmns.WidthSpecified = true;
dmns.Thickness = 7.8;
return dmns;
case CommonTypes.MediaType.ECMA_239:
dmns.Height = 97;
dmns.HeightSpecified = true;
dmns.Width = 92;
dmns.WidthSpecified = true;
dmns.Thickness = 5;
return dmns;
case CommonTypes.MediaType.MMCmicro:
dmns.Height = 14;
dmns.HeightSpecified = true;
@@ -483,19 +539,14 @@ namespace DiscImageChef.Metadata
dmns.Thickness = 14;
return dmns;
case CommonTypes.MediaType.RDX:
case CommonTypes.MediaType.RDX320:
dmns.Height = 119;
dmns.HeightSpecified = true;
dmns.Width = 86.5;
dmns.Width = 87;
dmns.WidthSpecified = true;
dmns.Thickness = 23.2;
dmns.Thickness = 23;
return dmns;
case CommonTypes.MediaType.LS120:
dmns.Height = 94;
dmns.HeightSpecified = true;
dmns.Width = 90;
dmns.WidthSpecified = true;
dmns.Thickness = 3.5;
return dmns;
case CommonTypes.MediaType.LS240:
dmns.Height = 94;
dmns.HeightSpecified = true;
@@ -550,14 +601,16 @@ namespace DiscImageChef.Metadata
case CommonTypes.MediaType.AIT5:
case CommonTypes.MediaType.AITETurbo:
case CommonTypes.MediaType.Exatape106m:
case CommonTypes.MediaType.Exatape106mXL:
case CommonTypes.MediaType.Exatape160mXL:
case CommonTypes.MediaType.Exatape112m:
case CommonTypes.MediaType.Exatape125m:
case CommonTypes.MediaType.Exatape150m:
case CommonTypes.MediaType.Exatape15m:
case CommonTypes.MediaType.Exatape170m:
case CommonTypes.MediaType.Exatape225m:
case CommonTypes.MediaType.Exatape22m:
case CommonTypes.MediaType.Exatape22mAME:
case CommonTypes.MediaType.Exatape28m:
case CommonTypes.MediaType.Exatape40m:
case CommonTypes.MediaType.Exatape45m:
case CommonTypes.MediaType.Exatape54m:

View File

@@ -40,6 +40,7 @@
</Compile>
<Compile Include="Dimensions.cs" />
<Compile Include="MediaType.cs" />
<Compile Include="DeviceReport.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
@@ -47,5 +48,9 @@
<Project>{F2B84194-26EB-4227-B1C5-6602517E85AE}</Project>
<Name>DiscImageChef.CommonTypes</Name>
</ProjectReference>
<ProjectReference Include="..\DiscImageChef.Decoders\DiscImageChef.Decoders.csproj">
<Project>{0BEB3088-B634-4289-AE17-CDF2D25D00D5}</Project>
<Name>DiscImageChef.Decoders</Name>
</ProjectReference>
</ItemGroup>
</Project>

View File

@@ -613,13 +613,18 @@ namespace DiscImageChef.Metadata
DiscType = "3.5\" floppy";
DiscSubType = "FDFORMAT high-density";
break;
case CommonTypes.MediaType.ECMA_260:
case CommonTypes.MediaType.ECMA_260_Double:
DiscType = "356mm magneto-optical";
DiscSubType = "ECMA-260 / ISO 15898";
break;
case CommonTypes.MediaType.ECMA_183_512:
case CommonTypes.MediaType.ECMA_183_1024:
case CommonTypes.MediaType.ECMA_183:
DiscType = "5.25\" magneto-optical";
DiscSubType = "ECMA-183";
break;
case CommonTypes.MediaType.ECMA_184_512:
case CommonTypes.MediaType.ECMA_184_1024:
case CommonTypes.MediaType.ECMA_184:
DiscType = "5.25\" magneto-optical";
DiscSubType = "ECMA-184";
break;
@@ -631,6 +636,10 @@ namespace DiscImageChef.Metadata
DiscType = "3.5\" magneto-optical";
DiscSubType = "ECMA-201";
break;
case DiscImageChef.CommonTypes.MediaType.FlashDrive:
DiscType = "USB flash drive";
DiscSubType = "USB flash drive";
break;
default:
DiscType = "Unknown";
DiscSubType = "Unknown";

View File

@@ -96,64 +96,7 @@ namespace DiscImageChef.Commands
FileInfo fi = new FileInfo(options.InputFile);
FileStream fs = new FileStream(options.InputFile, FileMode.Open, FileAccess.Read);
Adler32Context adler32ctx = new Adler32Context();
CRC16Context crc16ctx = new CRC16Context();
CRC32Context crc32ctx = new CRC32Context();
CRC64Context crc64ctx = new CRC64Context();
MD5Context md5ctx = new MD5Context();
RIPEMD160Context ripemd160ctx = new RIPEMD160Context();
SHA1Context sha1ctx = new SHA1Context();
SHA256Context sha256ctx = new SHA256Context();
SHA384Context sha384ctx = new SHA384Context();
SHA512Context sha512ctx = new SHA512Context();
SpamSumContext ssctx = new SpamSumContext();
Thread adlerThread = new Thread(updateAdler);
Thread crc16Thread = new Thread(updateCRC16);
Thread crc32Thread = new Thread(updateCRC32);
Thread crc64Thread = new Thread(updateCRC64);
Thread md5Thread = new Thread(updateMD5);
Thread ripemd160Thread = new Thread(updateRIPEMD160);
Thread sha1Thread = new Thread(updateSHA1);
Thread sha256Thread = new Thread(updateSHA256);
Thread sha384Thread = new Thread(updateSHA384);
Thread sha512Thread = new Thread(updateSHA512);
Thread spamsumThread = new Thread(updateSpamSum);
adlerPacket adlerPkt = new adlerPacket();
crc16Packet crc16Pkt = new crc16Packet();
crc32Packet crc32Pkt = new crc32Packet();
crc64Packet crc64Pkt = new crc64Packet();
md5Packet md5Pkt = new md5Packet();
ripemd160Packet ripemd160Pkt = new ripemd160Packet();
sha1Packet sha1Pkt = new sha1Packet();
sha256Packet sha256Pkt = new sha256Packet();
sha384Packet sha384Pkt = new sha384Packet();
sha512Packet sha512Pkt = new sha512Packet();
spamsumPacket spamsumPkt = new spamsumPacket();
adler32ctx.Init();
adlerPkt.context = adler32ctx;
crc16ctx.Init();
crc16Pkt.context = crc16ctx;
crc32ctx.Init();
crc32Pkt.context = crc32ctx;
crc64ctx.Init();
crc64Pkt.context = crc64ctx;
md5ctx.Init();
md5Pkt.context = md5ctx;
ripemd160ctx.Init();
ripemd160Pkt.context = ripemd160ctx;
sha1ctx.Init();
sha1Pkt.context = sha1ctx;
sha256ctx.Init();
sha256Pkt.context = sha256ctx;
sha384ctx.Init();
sha384Pkt.context = sha384ctx;
sha512ctx.Init();
sha512Pkt.context = sha512ctx;
ssctx.Init();
spamsumPkt.context = ssctx;
Core.Checksum imgChkWorker = new DiscImageChef.Core.Checksum();
byte[] data;
long position = 0;
@@ -164,49 +107,7 @@ namespace DiscImageChef.Commands
DicConsole.Write("\rHashing image file byte {0} of {1}", position, fi.Length);
adlerPkt.data = data;
adlerThread.Start(adlerPkt);
crc16Pkt.data = data;
crc16Thread.Start(crc16Pkt);
crc32Pkt.data = data;
crc32Thread.Start(crc32Pkt);
crc64Pkt.data = data;
crc64Thread.Start(crc64Pkt);
md5Pkt.data = data;
md5Thread.Start(md5Pkt);
ripemd160Pkt.data = data;
ripemd160Thread.Start(ripemd160Pkt);
sha1Pkt.data = data;
sha1Thread.Start(sha1Pkt);
sha256Pkt.data = data;
sha256Thread.Start(sha256Pkt);
sha384Pkt.data = data;
sha384Thread.Start(sha384Pkt);
sha512Pkt.data = data;
sha512Thread.Start(sha512Pkt);
spamsumPkt.data = data;
spamsumThread.Start(spamsumPkt);
while (adlerThread.IsAlive || crc16Thread.IsAlive ||
crc32Thread.IsAlive || crc64Thread.IsAlive ||
md5Thread.IsAlive || ripemd160Thread.IsAlive ||
sha1Thread.IsAlive || sha256Thread.IsAlive ||
sha384Thread.IsAlive || sha512Thread.IsAlive ||
spamsumThread.IsAlive)
{
}
adlerThread = new Thread(updateAdler);
crc16Thread = new Thread(updateCRC16);
crc32Thread = new Thread(updateCRC32);
crc64Thread = new Thread(updateCRC64);
md5Thread = new Thread(updateMD5);
ripemd160Thread = new Thread(updateRIPEMD160);
sha1Thread = new Thread(updateSHA1);
sha256Thread = new Thread(updateSHA256);
sha384Thread = new Thread(updateSHA384);
sha512Thread = new Thread(updateSHA512);
spamsumThread = new Thread(updateSpamSum);
imgChkWorker.Update(data);
position += 1048576;
}
@@ -216,97 +117,12 @@ namespace DiscImageChef.Commands
DicConsole.Write("\rHashing image file byte {0} of {1}", position, fi.Length);
adlerPkt.data = data;
adlerThread.Start(adlerPkt);
crc16Pkt.data = data;
crc16Thread.Start(crc16Pkt);
crc32Pkt.data = data;
crc32Thread.Start(crc32Pkt);
crc64Pkt.data = data;
crc64Thread.Start(crc64Pkt);
md5Pkt.data = data;
md5Thread.Start(md5Pkt);
ripemd160Pkt.data = data;
ripemd160Thread.Start(ripemd160Pkt);
sha1Pkt.data = data;
sha1Thread.Start(sha1Pkt);
sha256Pkt.data = data;
sha256Thread.Start(sha256Pkt);
sha384Pkt.data = data;
sha384Thread.Start(sha384Pkt);
sha512Pkt.data = data;
sha512Thread.Start(sha512Pkt);
spamsumPkt.data = data;
spamsumThread.Start(spamsumPkt);
while (adlerThread.IsAlive || crc16Thread.IsAlive ||
crc32Thread.IsAlive || crc64Thread.IsAlive ||
md5Thread.IsAlive || ripemd160Thread.IsAlive ||
sha1Thread.IsAlive || sha256Thread.IsAlive ||
sha384Thread.IsAlive || sha512Thread.IsAlive ||
spamsumThread.IsAlive)
{
}
imgChkWorker.Update(data);
DicConsole.WriteLine();
fs.Close();
List<ChecksumType> imgChecksums = new List<ChecksumType>();
ChecksumType chk = new ChecksumType();
chk.type = ChecksumTypeType.adler32;
chk.Value = adler32ctx.End();
imgChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc16;
chk.Value = crc16ctx.End();
imgChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc32;
chk.Value = crc32ctx.End();
imgChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc64;
chk.Value = crc64ctx.End();
imgChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.md5;
chk.Value = md5ctx.End();
imgChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.ripemd160;
chk.Value = ripemd160ctx.End();
imgChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha1;
chk.Value = sha1ctx.End();
imgChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha256;
chk.Value = sha256ctx.End();
imgChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha384;
chk.Value = sha384ctx.End();
imgChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha512;
chk.Value = sha512ctx.End();
imgChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.spamsum;
chk.Value = ssctx.End();
imgChecksums.Add(chk);
List<ChecksumType> imgChecksums = imgChkWorker.End();
switch (_imageFormat.ImageInfo.xmlMediaType)
{
@@ -342,7 +158,7 @@ namespace DiscImageChef.Commands
{
case MediaTagType.CD_ATIP:
sidecar.OpticalDisc[0].ATIP = new DumpType();
sidecar.OpticalDisc[0].ATIP.Checksums = GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.CD_ATIP)).ToArray();
sidecar.OpticalDisc[0].ATIP.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.CD_ATIP)).ToArray();
sidecar.OpticalDisc[0].ATIP.Size = _imageFormat.ReadDiskTag(MediaTagType.CD_ATIP).Length;
Decoders.CD.ATIP.CDATIP? atip = Decoders.CD.ATIP.Decode(_imageFormat.ReadDiskTag(MediaTagType.CD_ATIP));
if (atip.HasValue)
@@ -355,12 +171,12 @@ namespace DiscImageChef.Commands
break;
case MediaTagType.DVD_BCA:
sidecar.OpticalDisc[0].BCA = new DumpType();
sidecar.OpticalDisc[0].BCA.Checksums = GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.DVD_BCA)).ToArray();
sidecar.OpticalDisc[0].BCA.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.DVD_BCA)).ToArray();
sidecar.OpticalDisc[0].BCA.Size = _imageFormat.ReadDiskTag(MediaTagType.DVD_BCA).Length;
break;
case MediaTagType.BD_BCA:
sidecar.OpticalDisc[0].BCA = new DumpType();
sidecar.OpticalDisc[0].BCA.Checksums = GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.BD_BCA)).ToArray();
sidecar.OpticalDisc[0].BCA.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.BD_BCA)).ToArray();
sidecar.OpticalDisc[0].BCA.Size = _imageFormat.ReadDiskTag(MediaTagType.BD_BCA).Length;
break;
case MediaTagType.DVD_CMI:
@@ -381,12 +197,12 @@ namespace DiscImageChef.Commands
break;
}
}
sidecar.OpticalDisc[0].CMI.Checksums = GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.DVD_CMI)).ToArray();
sidecar.OpticalDisc[0].CMI.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.DVD_CMI)).ToArray();
sidecar.OpticalDisc[0].CMI.Size = _imageFormat.ReadDiskTag(MediaTagType.DVD_CMI).Length;
break;
case MediaTagType.DVD_DMI:
sidecar.OpticalDisc[0].DMI = new DumpType();
sidecar.OpticalDisc[0].DMI.Checksums = GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.DVD_DMI)).ToArray();
sidecar.OpticalDisc[0].DMI.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.DVD_DMI)).ToArray();
sidecar.OpticalDisc[0].DMI.Size = _imageFormat.ReadDiskTag(MediaTagType.DVD_DMI).Length;
if (Decoders.Xbox.DMI.IsXbox(_imageFormat.ReadDiskTag(MediaTagType.DVD_DMI)))
{
@@ -403,7 +219,7 @@ namespace DiscImageChef.Commands
break;
case MediaTagType.DVD_PFI:
sidecar.OpticalDisc[0].PFI = new DumpType();
sidecar.OpticalDisc[0].PFI.Checksums = GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.DVD_PFI)).ToArray();
sidecar.OpticalDisc[0].PFI.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.DVD_PFI)).ToArray();
sidecar.OpticalDisc[0].PFI.Size = _imageFormat.ReadDiskTag(MediaTagType.DVD_PFI).Length;
Decoders.DVD.PFI.PhysicalFormatInformation? pfi = Decoders.DVD.PFI.Decode(_imageFormat.ReadDiskTag(MediaTagType.DVD_PFI));
if (pfi.HasValue)
@@ -477,7 +293,7 @@ namespace DiscImageChef.Commands
break;
case MediaTagType.CD_PMA:
sidecar.OpticalDisc[0].PMA = new DumpType();
sidecar.OpticalDisc[0].PMA.Checksums = GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.CD_PMA)).ToArray();
sidecar.OpticalDisc[0].PMA.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.CD_PMA)).ToArray();
sidecar.OpticalDisc[0].PMA.Size = _imageFormat.ReadDiskTag(MediaTagType.CD_PMA).Length;
break;
}
@@ -583,64 +399,7 @@ namespace DiscImageChef.Commands
uint sectorsToRead = 512;
adler32ctx = new Adler32Context();
crc16ctx = new CRC16Context();
crc32ctx = new CRC32Context();
crc64ctx = new CRC64Context();
md5ctx = new MD5Context();
ripemd160ctx = new RIPEMD160Context();
sha1ctx = new SHA1Context();
sha256ctx = new SHA256Context();
sha384ctx = new SHA384Context();
sha512ctx = new SHA512Context();
ssctx = new SpamSumContext();
adlerThread = new Thread(updateAdler);
crc16Thread = new Thread(updateCRC16);
crc32Thread = new Thread(updateCRC32);
crc64Thread = new Thread(updateCRC64);
md5Thread = new Thread(updateMD5);
ripemd160Thread = new Thread(updateRIPEMD160);
sha1Thread = new Thread(updateSHA1);
sha256Thread = new Thread(updateSHA256);
sha384Thread = new Thread(updateSHA384);
sha512Thread = new Thread(updateSHA512);
spamsumThread = new Thread(updateSpamSum);
adlerPkt = new adlerPacket();
crc16Pkt = new crc16Packet();
crc32Pkt = new crc32Packet();
crc64Pkt = new crc64Packet();
md5Pkt = new md5Packet();
ripemd160Pkt = new ripemd160Packet();
sha1Pkt = new sha1Packet();
sha256Pkt = new sha256Packet();
sha384Pkt = new sha384Packet();
sha512Pkt = new sha512Packet();
spamsumPkt = new spamsumPacket();
adler32ctx.Init();
adlerPkt.context = adler32ctx;
crc16ctx.Init();
crc16Pkt.context = crc16ctx;
crc32ctx.Init();
crc32Pkt.context = crc32ctx;
crc64ctx.Init();
crc64Pkt.context = crc64ctx;
md5ctx.Init();
md5Pkt.context = md5ctx;
ripemd160ctx.Init();
ripemd160Pkt.context = ripemd160ctx;
sha1ctx.Init();
sha1Pkt.context = sha1ctx;
sha256ctx.Init();
sha256Pkt.context = sha256ctx;
sha384ctx.Init();
sha384Pkt.context = sha384ctx;
sha512ctx.Init();
sha512Pkt.context = sha512ctx;
ssctx.Init();
spamsumPkt.context = ssctx;
Core.Checksum trkChkWorker = new DiscImageChef.Core.Checksum();
ulong sectors = (ulong)(xmlTrk.EndSector - xmlTrk.StartSector + 1);
ulong doneSectors = 0;
@@ -662,107 +421,10 @@ namespace DiscImageChef.Commands
doneSectors += (sectors - doneSectors);
}
adlerPkt.data = sector;
adlerThread.Start(adlerPkt);
crc16Pkt.data = sector;
crc16Thread.Start(crc16Pkt);
crc32Pkt.data = sector;
crc32Thread.Start(crc32Pkt);
crc64Pkt.data = sector;
crc64Thread.Start(crc64Pkt);
md5Pkt.data = sector;
md5Thread.Start(md5Pkt);
ripemd160Pkt.data = sector;
ripemd160Thread.Start(ripemd160Pkt);
sha1Pkt.data = sector;
sha1Thread.Start(sha1Pkt);
sha256Pkt.data = sector;
sha256Thread.Start(sha256Pkt);
sha384Pkt.data = sector;
sha384Thread.Start(sha384Pkt);
sha512Pkt.data = sector;
sha512Thread.Start(sha512Pkt);
spamsumPkt.data = sector;
spamsumThread.Start(spamsumPkt);
while (adlerThread.IsAlive || crc16Thread.IsAlive ||
crc32Thread.IsAlive || crc64Thread.IsAlive ||
md5Thread.IsAlive || ripemd160Thread.IsAlive ||
sha1Thread.IsAlive || sha256Thread.IsAlive ||
sha384Thread.IsAlive || sha512Thread.IsAlive ||
spamsumThread.IsAlive)
{
}
adlerThread = new Thread(updateAdler);
crc16Thread = new Thread(updateCRC16);
crc32Thread = new Thread(updateCRC32);
crc64Thread = new Thread(updateCRC64);
md5Thread = new Thread(updateMD5);
ripemd160Thread = new Thread(updateRIPEMD160);
sha1Thread = new Thread(updateSHA1);
sha256Thread = new Thread(updateSHA256);
sha384Thread = new Thread(updateSHA384);
sha512Thread = new Thread(updateSHA512);
spamsumThread = new Thread(updateSpamSum);
trkChkWorker.Update(sector);
}
List<ChecksumType> trkChecksums = new List<ChecksumType>();
chk = new ChecksumType();
chk.type = ChecksumTypeType.adler32;
chk.Value = adler32ctx.End();
trkChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc16;
chk.Value = crc16ctx.End();
trkChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc32;
chk.Value = crc32ctx.End();
trkChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc64;
chk.Value = crc64ctx.End();
trkChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.md5;
chk.Value = md5ctx.End();
trkChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.ripemd160;
chk.Value = ripemd160ctx.End();
trkChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha1;
chk.Value = sha1ctx.End();
trkChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha256;
chk.Value = sha256ctx.End();
trkChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha384;
chk.Value = sha384ctx.End();
trkChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha512;
chk.Value = sha512ctx.End();
trkChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.spamsum;
chk.Value = ssctx.End();
trkChecksums.Add(chk);
List<ChecksumType> trkChecksums = trkChkWorker.End();
xmlTrk.Checksums = trkChecksums.ToArray();
@@ -794,64 +456,7 @@ namespace DiscImageChef.Commands
// TODO: Packed subchannel has different size?
xmlTrk.SubChannel.Size = (xmlTrk.EndSector - xmlTrk.StartSector + 1) * 96;
adler32ctx = new Adler32Context();
crc16ctx = new CRC16Context();
crc32ctx = new CRC32Context();
crc64ctx = new CRC64Context();
md5ctx = new MD5Context();
ripemd160ctx = new RIPEMD160Context();
sha1ctx = new SHA1Context();
sha256ctx = new SHA256Context();
sha384ctx = new SHA384Context();
sha512ctx = new SHA512Context();
ssctx = new SpamSumContext();
adlerThread = new Thread(updateAdler);
crc16Thread = new Thread(updateCRC16);
crc32Thread = new Thread(updateCRC32);
crc64Thread = new Thread(updateCRC64);
md5Thread = new Thread(updateMD5);
ripemd160Thread = new Thread(updateRIPEMD160);
sha1Thread = new Thread(updateSHA1);
sha256Thread = new Thread(updateSHA256);
sha384Thread = new Thread(updateSHA384);
sha512Thread = new Thread(updateSHA512);
spamsumThread = new Thread(updateSpamSum);
adlerPkt = new adlerPacket();
crc16Pkt = new crc16Packet();
crc32Pkt = new crc32Packet();
crc64Pkt = new crc64Packet();
md5Pkt = new md5Packet();
ripemd160Pkt = new ripemd160Packet();
sha1Pkt = new sha1Packet();
sha256Pkt = new sha256Packet();
sha384Pkt = new sha384Packet();
sha512Pkt = new sha512Packet();
spamsumPkt = new spamsumPacket();
adler32ctx.Init();
adlerPkt.context = adler32ctx;
crc16ctx.Init();
crc16Pkt.context = crc16ctx;
crc32ctx.Init();
crc32Pkt.context = crc32ctx;
crc64ctx.Init();
crc64Pkt.context = crc64ctx;
md5ctx.Init();
md5Pkt.context = md5ctx;
ripemd160ctx.Init();
ripemd160Pkt.context = ripemd160ctx;
sha1ctx.Init();
sha1Pkt.context = sha1ctx;
sha256ctx.Init();
sha256Pkt.context = sha256ctx;
sha384ctx.Init();
sha384Pkt.context = sha384ctx;
sha512ctx.Init();
sha512Pkt.context = sha512ctx;
ssctx.Init();
spamsumPkt.context = ssctx;
Core.Checksum subChkWorker = new DiscImageChef.Core.Checksum();
sectors = (ulong)(xmlTrk.EndSector - xmlTrk.StartSector + 1);
doneSectors = 0;
@@ -873,107 +478,10 @@ namespace DiscImageChef.Commands
doneSectors += (sectors - doneSectors);
}
adlerPkt.data = sector;
adlerThread.Start(adlerPkt);
crc16Pkt.data = sector;
crc16Thread.Start(crc16Pkt);
crc32Pkt.data = sector;
crc32Thread.Start(crc32Pkt);
crc64Pkt.data = sector;
crc64Thread.Start(crc64Pkt);
md5Pkt.data = sector;
md5Thread.Start(md5Pkt);
ripemd160Pkt.data = sector;
ripemd160Thread.Start(ripemd160Pkt);
sha1Pkt.data = sector;
sha1Thread.Start(sha1Pkt);
sha256Pkt.data = sector;
sha256Thread.Start(sha256Pkt);
sha384Pkt.data = sector;
sha384Thread.Start(sha384Pkt);
sha512Pkt.data = sector;
sha512Thread.Start(sha512Pkt);
spamsumPkt.data = sector;
spamsumThread.Start(spamsumPkt);
while (adlerThread.IsAlive || crc16Thread.IsAlive ||
crc32Thread.IsAlive || crc64Thread.IsAlive ||
md5Thread.IsAlive || ripemd160Thread.IsAlive ||
sha1Thread.IsAlive || sha256Thread.IsAlive ||
sha384Thread.IsAlive || sha512Thread.IsAlive ||
spamsumThread.IsAlive)
{
}
adlerThread = new Thread(updateAdler);
crc16Thread = new Thread(updateCRC16);
crc32Thread = new Thread(updateCRC32);
crc64Thread = new Thread(updateCRC64);
md5Thread = new Thread(updateMD5);
ripemd160Thread = new Thread(updateRIPEMD160);
sha1Thread = new Thread(updateSHA1);
sha256Thread = new Thread(updateSHA256);
sha384Thread = new Thread(updateSHA384);
sha512Thread = new Thread(updateSHA512);
spamsumThread = new Thread(updateSpamSum);
subChkWorker.Update(sector);
}
List<ChecksumType> subChecksums = new List<ChecksumType>();
chk = new ChecksumType();
chk.type = ChecksumTypeType.adler32;
chk.Value = adler32ctx.End();
subChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc16;
chk.Value = crc16ctx.End();
subChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc32;
chk.Value = crc32ctx.End();
subChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc64;
chk.Value = crc64ctx.End();
subChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.md5;
chk.Value = md5ctx.End();
subChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.ripemd160;
chk.Value = ripemd160ctx.End();
subChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha1;
chk.Value = sha1ctx.End();
subChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha256;
chk.Value = sha256ctx.End();
subChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha384;
chk.Value = sha384ctx.End();
subChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha512;
chk.Value = sha512ctx.End();
subChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.spamsum;
chk.Value = ssctx.End();
subChecksums.Add(chk);
List<ChecksumType> subChecksums = subChkWorker.End();
xmlTrk.SubChannel.Checksums = subChecksums.ToArray();
@@ -1103,46 +611,46 @@ namespace DiscImageChef.Commands
case MediaTagType.ATAPI_IDENTIFY:
sidecar.BlockMedia[0].ATA = new ATAType();
sidecar.BlockMedia[0].ATA.Identify = new DumpType();
sidecar.BlockMedia[0].ATA.Identify.Checksums = GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY)).ToArray();
sidecar.BlockMedia[0].ATA.Identify.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY)).ToArray();
sidecar.BlockMedia[0].ATA.Identify.Size = _imageFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY).Length;
break;
case MediaTagType.ATA_IDENTIFY:
sidecar.BlockMedia[0].ATA = new ATAType();
sidecar.BlockMedia[0].ATA.Identify = new DumpType();
sidecar.BlockMedia[0].ATA.Identify.Checksums = GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY)).ToArray();
sidecar.BlockMedia[0].ATA.Identify.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY)).ToArray();
sidecar.BlockMedia[0].ATA.Identify.Size = _imageFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY).Length;
break;
case MediaTagType.PCMCIA_CIS:
sidecar.BlockMedia[0].PCMCIA = new PCMCIAType();
sidecar.BlockMedia[0].PCMCIA.CIS = new DumpType();
sidecar.BlockMedia[0].PCMCIA.CIS.Checksums = GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.PCMCIA_CIS)).ToArray();
sidecar.BlockMedia[0].PCMCIA.CIS.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.PCMCIA_CIS)).ToArray();
sidecar.BlockMedia[0].PCMCIA.CIS.Size = _imageFormat.ReadDiskTag(MediaTagType.PCMCIA_CIS).Length;
break;
case MediaTagType.SCSI_INQUIRY:
sidecar.BlockMedia[0].SCSI = new SCSIType();
sidecar.BlockMedia[0].SCSI.Inquiry = new DumpType();
sidecar.BlockMedia[0].SCSI.Inquiry.Checksums = GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.SCSI_INQUIRY)).ToArray();
sidecar.BlockMedia[0].SCSI.Inquiry.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.SCSI_INQUIRY)).ToArray();
sidecar.BlockMedia[0].SCSI.Inquiry.Size = _imageFormat.ReadDiskTag(MediaTagType.SCSI_INQUIRY).Length;
break;
case MediaTagType.SD_CID:
if(sidecar.BlockMedia[0].SecureDigital == null)
sidecar.BlockMedia[0].SecureDigital = new SecureDigitalType();
sidecar.BlockMedia[0].SecureDigital.CID = new DumpType();
sidecar.BlockMedia[0].SecureDigital.CID.Checksums = GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.SD_CID)).ToArray();
sidecar.BlockMedia[0].SecureDigital.CID.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.SD_CID)).ToArray();
sidecar.BlockMedia[0].SecureDigital.CID.Size = _imageFormat.ReadDiskTag(MediaTagType.SD_CID).Length;
break;
case MediaTagType.SD_CSD:
if(sidecar.BlockMedia[0].SecureDigital == null)
sidecar.BlockMedia[0].SecureDigital = new SecureDigitalType();
sidecar.BlockMedia[0].SecureDigital.CSD = new DumpType();
sidecar.BlockMedia[0].SecureDigital.CSD.Checksums = GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.SD_CSD)).ToArray();
sidecar.BlockMedia[0].SecureDigital.CSD.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.SD_CSD)).ToArray();
sidecar.BlockMedia[0].SecureDigital.CSD.Size = _imageFormat.ReadDiskTag(MediaTagType.SD_CSD).Length;
break;
case MediaTagType.SD_ExtendedCSD:
if(sidecar.BlockMedia[0].SecureDigital == null)
sidecar.BlockMedia[0].SecureDigital = new SecureDigitalType();
sidecar.BlockMedia[0].SecureDigital.ExtendedCSD = new DumpType();
sidecar.BlockMedia[0].SecureDigital.ExtendedCSD.Checksums = GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.SD_ExtendedCSD)).ToArray();
sidecar.BlockMedia[0].SecureDigital.ExtendedCSD.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.SD_ExtendedCSD)).ToArray();
sidecar.BlockMedia[0].SecureDigital.ExtendedCSD.Size = _imageFormat.ReadDiskTag(MediaTagType.SD_ExtendedCSD).Length;
break;
}
@@ -1360,297 +868,6 @@ namespace DiscImageChef.Commands
return String.Format("{3}:{0:D2}:{1:D2}:{2:D2}", m, s, f, h);
}
static List<ChecksumType> GetChecksums(byte[] data)
{
Adler32Context adler32ctx = new Adler32Context();
CRC16Context crc16ctx = new CRC16Context();
CRC32Context crc32ctx = new CRC32Context();
CRC64Context crc64ctx = new CRC64Context();
MD5Context md5ctx = new MD5Context();
RIPEMD160Context ripemd160ctx = new RIPEMD160Context();
SHA1Context sha1ctx = new SHA1Context();
SHA256Context sha256ctx = new SHA256Context();
SHA384Context sha384ctx = new SHA384Context();
SHA512Context sha512ctx = new SHA512Context();
SpamSumContext ssctx = new SpamSumContext();
Thread adlerThread = new Thread(updateAdler);
Thread crc16Thread = new Thread(updateCRC16);
Thread crc32Thread = new Thread(updateCRC32);
Thread crc64Thread = new Thread(updateCRC64);
Thread md5Thread = new Thread(updateMD5);
Thread ripemd160Thread = new Thread(updateRIPEMD160);
Thread sha1Thread = new Thread(updateSHA1);
Thread sha256Thread = new Thread(updateSHA256);
Thread sha384Thread = new Thread(updateSHA384);
Thread sha512Thread = new Thread(updateSHA512);
Thread spamsumThread = new Thread(updateSpamSum);
adlerPacket adlerPkt = new adlerPacket();
crc16Packet crc16Pkt = new crc16Packet();
crc32Packet crc32Pkt = new crc32Packet();
crc64Packet crc64Pkt = new crc64Packet();
md5Packet md5Pkt = new md5Packet();
ripemd160Packet ripemd160Pkt = new ripemd160Packet();
sha1Packet sha1Pkt = new sha1Packet();
sha256Packet sha256Pkt = new sha256Packet();
sha384Packet sha384Pkt = new sha384Packet();
sha512Packet sha512Pkt = new sha512Packet();
spamsumPacket spamsumPkt = new spamsumPacket();
adler32ctx.Init();
adlerPkt.context = adler32ctx;
crc16ctx.Init();
crc16Pkt.context = crc16ctx;
crc32ctx.Init();
crc32Pkt.context = crc32ctx;
crc64ctx.Init();
crc64Pkt.context = crc64ctx;
md5ctx.Init();
md5Pkt.context = md5ctx;
ripemd160ctx.Init();
ripemd160Pkt.context = ripemd160ctx;
sha1ctx.Init();
sha1Pkt.context = sha1ctx;
sha256ctx.Init();
sha256Pkt.context = sha256ctx;
sha384ctx.Init();
sha384Pkt.context = sha384ctx;
sha512ctx.Init();
sha512Pkt.context = sha512ctx;
ssctx.Init();
spamsumPkt.context = ssctx;
adlerPkt.data = data;
adlerThread.Start(adlerPkt);
crc16Pkt.data = data;
crc16Thread.Start(crc16Pkt);
crc32Pkt.data = data;
crc32Thread.Start(crc32Pkt);
crc64Pkt.data = data;
crc64Thread.Start(crc64Pkt);
md5Pkt.data = data;
md5Thread.Start(md5Pkt);
ripemd160Pkt.data = data;
ripemd160Thread.Start(ripemd160Pkt);
sha1Pkt.data = data;
sha1Thread.Start(sha1Pkt);
sha256Pkt.data = data;
sha256Thread.Start(sha256Pkt);
sha384Pkt.data = data;
sha384Thread.Start(sha384Pkt);
sha512Pkt.data = data;
sha512Thread.Start(sha512Pkt);
spamsumPkt.data = data;
spamsumThread.Start(spamsumPkt);
while (adlerThread.IsAlive || crc16Thread.IsAlive ||
crc32Thread.IsAlive || crc64Thread.IsAlive ||
md5Thread.IsAlive || ripemd160Thread.IsAlive ||
sha1Thread.IsAlive || sha256Thread.IsAlive ||
sha384Thread.IsAlive || sha512Thread.IsAlive ||
spamsumThread.IsAlive)
{
}
List<ChecksumType> imgChecksums = new List<ChecksumType>();
ChecksumType chk = new ChecksumType();
chk.type = ChecksumTypeType.adler32;
chk.Value = adler32ctx.End();
imgChecksums.Add(chk);
chk.type = ChecksumTypeType.crc16;
chk.Value = crc16ctx.End();
imgChecksums.Add(chk);
chk.type = ChecksumTypeType.crc32;
chk.Value = crc32ctx.End();
imgChecksums.Add(chk);
chk.type = ChecksumTypeType.crc64;
chk.Value = crc64ctx.End();
imgChecksums.Add(chk);
chk.type = ChecksumTypeType.md5;
chk.Value = md5ctx.End();
imgChecksums.Add(chk);
chk.type = ChecksumTypeType.ripemd160;
chk.Value = ripemd160ctx.End();
imgChecksums.Add(chk);
chk.type = ChecksumTypeType.sha1;
chk.Value = sha1ctx.End();
imgChecksums.Add(chk);
chk.type = ChecksumTypeType.sha256;
chk.Value = sha256ctx.End();
imgChecksums.Add(chk);
chk.type = ChecksumTypeType.sha384;
chk.Value = sha384ctx.End();
imgChecksums.Add(chk);
chk.type = ChecksumTypeType.sha512;
chk.Value = sha512ctx.End();
imgChecksums.Add(chk);
chk.type = ChecksumTypeType.spamsum;
chk.Value = ssctx.End();
imgChecksums.Add(chk);
return imgChecksums;
}
#region Threading helpers
struct adlerPacket
{
public Adler32Context context;
public byte[] data;
}
struct crc16Packet
{
public CRC16Context context;
public byte[] data;
}
struct crc32Packet
{
public CRC32Context context;
public byte[] data;
}
struct crc64Packet
{
public CRC64Context context;
public byte[] data;
}
/*struct fletcher16Packet
{
public Fletcher16Context context;
public byte[] data;
}
struct fletcher32Packet
{
public Fletcher32Context context;
public byte[] data;
}*/
struct md5Packet
{
public MD5Context context;
public byte[] data;
}
struct ripemd160Packet
{
public RIPEMD160Context context;
public byte[] data;
}
struct sha1Packet
{
public SHA1Context context;
public byte[] data;
}
struct sha256Packet
{
public SHA256Context context;
public byte[] data;
}
struct sha384Packet
{
public SHA384Context context;
public byte[] data;
}
struct sha512Packet
{
public SHA512Context context;
public byte[] data;
}
struct spamsumPacket
{
public SpamSumContext context;
public byte[] data;
}
static void updateAdler(object packet)
{
((adlerPacket)packet).context.Update(((adlerPacket)packet).data);
}
static void updateCRC16(object packet)
{
((crc16Packet)packet).context.Update(((crc16Packet)packet).data);
}
static void updateCRC32(object packet)
{
((crc32Packet)packet).context.Update(((crc32Packet)packet).data);
}
static void updateCRC64(object packet)
{
((crc64Packet)packet).context.Update(((crc64Packet)packet).data);
}
/*static void updateFletcher16(object packet)
{
((fletcher16Packet)packet).context.Update(((fletcher16Packet)packet).data);
}
static void updateFletcher32(object packet)
{
((fletcher32Packet)packet).context.Update(((fletcher32Packet)packet).data);
}*/
static void updateMD5(object packet)
{
((md5Packet)packet).context.Update(((md5Packet)packet).data);
}
static void updateRIPEMD160(object packet)
{
((ripemd160Packet)packet).context.Update(((ripemd160Packet)packet).data);
}
static void updateSHA1(object packet)
{
((sha1Packet)packet).context.Update(((sha1Packet)packet).data);
}
static void updateSHA256(object packet)
{
((sha256Packet)packet).context.Update(((sha256Packet)packet).data);
}
static void updateSHA384(object packet)
{
((sha384Packet)packet).context.Update(((sha384Packet)packet).data);
}
static void updateSHA512(object packet)
{
((sha512Packet)packet).context.Update(((sha512Packet)packet).data);
}
static void updateSpamSum(object packet)
{
((spamsumPacket)packet).context.Update(((spamsumPacket)packet).data);
}
#endregion Threading helpers
}
}

View File

@@ -164,7 +164,7 @@ namespace DiscImageChef.Commands
if (dev.Type != DeviceType.ATAPI)
DicConsole.WriteLine("SCSI device");
doWriteFile(options.OutputPrefix, "_scsi_inquiry.bin", "SCSI IDENTIFY", inqBuf);
doWriteFile(options.OutputPrefix, "_scsi_inquiry.bin", "SCSI INQUIRY", inqBuf);
Decoders.SCSI.Inquiry.SCSIInquiry? inq = Decoders.SCSI.Inquiry.Decode(inqBuf);
DicConsole.WriteLine(Decoders.SCSI.Inquiry.Prettify(inq));
@@ -237,10 +237,10 @@ namespace DiscImageChef.Commands
Decoders.SCSI.Modes.DecodedMode? decMode = null;
Decoders.SCSI.PeripheralDeviceTypes devType = (DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes)inq.Value.PeripheralDeviceType;
sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF, dev.Timeout, out duration);
sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out duration);
if (sense || dev.Error)
{
sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, dev.Timeout, out duration);
sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration);
}
if (!sense && !dev.Error)
@@ -250,11 +250,11 @@ namespace DiscImageChef.Commands
if(sense || dev.Error || !decMode.HasValue)
{
sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, dev.Timeout, out duration);
sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out duration);
if (sense || dev.Error)
sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, dev.Timeout, out duration);
sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration);
if (sense || dev.Error)
sense = dev.ModeSense(out modeBuf, out senseBuf, 15000, out duration);
sense = dev.ModeSense(out modeBuf, out senseBuf, 5, out duration);
if (!sense && !dev.Error)
decMode = Decoders.SCSI.Modes.DecodeMode6(modeBuf, devType);
@@ -477,7 +477,7 @@ namespace DiscImageChef.Commands
}
case 0x3E:
{
if (StringHandlers.SpacePaddedToString(inq.Value.VendorIdentification) == "FUJITSU")
if (StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "FUJITSU")
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyFujitsuModePage_3E(page.PageResponse));
else
goto default;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -175,6 +175,51 @@ namespace DiscImageChef.Commands
}
}
byte[] modeBuf;
Decoders.SCSI.Modes.DecodedMode? decMode = null;
Decoders.SCSI.PeripheralDeviceTypes devType = dev.SCSIType;
sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out duration);
if (sense || dev.Error)
{
sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration);
}
if (!sense && !dev.Error)
{
decMode = Decoders.SCSI.Modes.DecodeMode10(modeBuf, devType);
}
if(sense || dev.Error || !decMode.HasValue)
{
sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration);
if (sense || dev.Error)
sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration);
if (sense || dev.Error)
sense = dev.ModeSense(out modeBuf, out senseBuf, 5, out duration);
if (!sense && !dev.Error)
decMode = Decoders.SCSI.Modes.DecodeMode6(modeBuf, devType);
}
if (!sense)
doWriteFile(outputPrefix, "_scsi_modesense.bin", "SCSI MODE SENSE", modeBuf);
byte scsiMediumType = 0;
byte scsiDensityCode = 0;
bool containsFloppyPage = false;
if(decMode.HasValue)
{
scsiMediumType = (byte)decMode.Value.Header.MediumType;
if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length >= 1)
scsiDensityCode = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
foreach(Decoders.SCSI.Modes.ModePage modePage in decMode.Value.Pages)
if(modePage.Page == 0x05)
containsFloppyPage = true;
}
if (dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.DirectAccess ||
dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice ||
dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.OCRWDevice ||
@@ -280,7 +325,7 @@ namespace DiscImageChef.Commands
{
sense = dev.GetConfiguration(out cmdBuf, out senseBuf, 0, MmcGetConfigurationRt.Current, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ GET CONFIGURATION:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ GET CONFIGURATION:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_getconfiguration_current.bin", "SCSI GET CONFIGURATION", cmdBuf);
@@ -383,12 +428,12 @@ namespace DiscImageChef.Commands
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.RecognizedFormatLayers, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Recognized Format Layers\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Recognized Format Layers\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_formatlayers.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.WriteProtectionStatus, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Write Protection Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Write Protection Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_writeprotection.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -396,7 +441,7 @@ namespace DiscImageChef.Commands
/*
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.CapabilityList, 0, dev.Timeout, out duration);
if(sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Capability List\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Capability List\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_capabilitylist.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
*/
@@ -415,15 +460,78 @@ namespace DiscImageChef.Commands
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: PFI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PFI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_readdiscstructure_dvd_pfi.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
DicConsole.WriteLine("PFI:\n{0}", Decoders.DVD.PFI.Prettify(cmdBuf));
Decoders.DVD.PFI.PhysicalFormatInformation? decPfi = Decoders.DVD.PFI.Decode(cmdBuf);
if(decPfi.HasValue)
{
DicConsole.WriteLine("PFI:\n{0}", Decoders.DVD.PFI.Prettify(decPfi));
// False book types
if(dskType == MediaType.DVDROM)
{
switch(decPfi.Value.DiskCategory)
{
case Decoders.DVD.DiskCategory.DVDPR:
dskType = MediaType.DVDPR;
break;
case Decoders.DVD.DiskCategory.DVDPRDL:
dskType = MediaType.DVDPRDL;
break;
case Decoders.DVD.DiskCategory.DVDPRW:
dskType = MediaType.DVDPRW;
break;
case Decoders.DVD.DiskCategory.DVDPRWDL:
dskType = MediaType.DVDPRWDL;
break;
case Decoders.DVD.DiskCategory.DVDR:
if(decPfi.Value.PartVersion == 6)
dskType = MediaType.DVDRDL;
else
dskType = MediaType.DVDR;
break;
case Decoders.DVD.DiskCategory.DVDRAM:
dskType = MediaType.DVDRAM;
break;
default:
dskType = MediaType.DVDROM;
break;
case Decoders.DVD.DiskCategory.DVDRW:
if(decPfi.Value.PartVersion == 3)
dskType = MediaType.DVDRWDL;
else
dskType = MediaType.DVDRW;
break;
case Decoders.DVD.DiskCategory.HDDVDR:
dskType = MediaType.HDDVDR;
break;
case Decoders.DVD.DiskCategory.HDDVDRAM:
dskType = MediaType.HDDVDRAM;
break;
case Decoders.DVD.DiskCategory.HDDVDROM:
dskType = MediaType.HDDVDROM;
break;
case Decoders.DVD.DiskCategory.HDDVDRW:
dskType = MediaType.HDDVDRW;
break;
case Decoders.DVD.DiskCategory.Nintendo:
if(decPfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.Eighty)
dskType = MediaType.GOD;
else
dskType = MediaType.WOD;
break;
case Decoders.DVD.DiskCategory.UMD:
dskType = MediaType.UMD;
break;
}
}
}
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: DMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_readdiscstructure_dvd_dmi.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -445,7 +553,7 @@ namespace DiscImageChef.Commands
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.CopyrightInformation, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: CMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: CMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_readdiscstructure_dvd_cmi.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -460,12 +568,12 @@ namespace DiscImageChef.Commands
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.BurstCuttingArea, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: BCA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: BCA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_bca.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVD_AACS, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: DVD AACS\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD AACS\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_aacs.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
}
@@ -475,57 +583,57 @@ namespace DiscImageChef.Commands
/*
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DiscKey, 0, dev.Timeout, out duration);
if(sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Disc Key\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Disc Key\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_disckey.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.SectorCopyrightInformation, 0, dev.Timeout, out duration);
if(sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Sector CMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Sector CMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_sectorcmi.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.MediaIdentifier, 0, dev.Timeout, out duration);
if(sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Media ID\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Media ID\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_mediaid.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.MediaKeyBlock, 0, dev.Timeout, out duration);
if(sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: MKB\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: MKB\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_mkb.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.AACSVolId, 0, dev.Timeout, out duration);
if(sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: AACS Volume ID\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: AACS Volume ID\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_aacsvolid.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.AACSMediaSerial, 0, dev.Timeout, out duration);
if(sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: AACS Media Serial Number\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: AACS Media Serial Number\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_aacssn.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.AACSMediaId, 0, dev.Timeout, out duration);
if(sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: AACS Media ID\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: AACS Media ID\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_aacsmediaid.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.AACSMKB, 0, dev.Timeout, out duration);
if(sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: AACS MKB\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: AACS MKB\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_aacsmkb.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.AACSLBAExtents, 0, dev.Timeout, out duration);
if(sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: AACS LBA Extents\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: AACS LBA Extents\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_aacslbaextents.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.AACSMKBCPRM, 0, dev.Timeout, out duration);
if(sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: AACS CPRM MKB\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: AACS CPRM MKB\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_aacscprmmkb.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.AACSDataKeys, 0, dev.Timeout, out duration);
if(sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: AACS Data Keys\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: AACS Data Keys\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_aacsdatakeys.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
*/
@@ -536,7 +644,7 @@ namespace DiscImageChef.Commands
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_DDS, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: DDS\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DDS\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_readdiscstructure_dvdram_dds.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -544,7 +652,7 @@ namespace DiscImageChef.Commands
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_MediumStatus, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Medium Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Medium Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_readdiscstructure_dvdram_status.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -552,7 +660,7 @@ namespace DiscImageChef.Commands
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_SpareAreaInformation, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: SAI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: SAI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_readdiscstructure_dvdram_spare.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -566,7 +674,7 @@ namespace DiscImageChef.Commands
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.LastBorderOutRMD, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Last-Out Border RMD\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Last-Out Border RMD\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_lastrmd.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
}
@@ -577,7 +685,7 @@ namespace DiscImageChef.Commands
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PreRecordedInfo, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Pre-Recorded Info\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Pre-Recorded Info\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_pri.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
}
@@ -588,12 +696,12 @@ namespace DiscImageChef.Commands
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_MediaIdentifier, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: DVD-R Media ID\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD-R Media ID\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvdr_mediaid.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_PhysicalInformation, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: DVD-R PFI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD-R PFI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvdr_pfi.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
}
@@ -603,18 +711,15 @@ namespace DiscImageChef.Commands
if (dskType == MediaType.DVDPR || dskType == MediaType.DVDPRDL ||
dskType == MediaType.DVDPRW || dskType == MediaType.DVDPRWDL)
{
// TODO: None of my test discs return an ADIP. Also, it just seems to contain pre-recorded PFI, and drive is returning it on blank media using standard PFI command
/*
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.ADIP, 0, dev.Timeout, out duration);
if(sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: ADIP\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: ADIP\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd+_adip.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
*/
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DCB, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: DCB\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DCB\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd+_dcb.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
}
@@ -625,7 +730,7 @@ namespace DiscImageChef.Commands
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.HDDVD_CopyrightInformation, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: HDDVD CMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: HDDVD CMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_hddvd_cmi.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
}
@@ -636,12 +741,12 @@ namespace DiscImageChef.Commands
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.HDDVDR_MediumStatus, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: HDDVD-R Medium Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: HDDVD-R Medium Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_hddvdr_status.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.HDDVDR_LastRMD, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Last RMD\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Last RMD\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_hddvdr_lastrmd.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
}
@@ -653,7 +758,7 @@ namespace DiscImageChef.Commands
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_LayerCapacity, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Layer Capacity\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Layer Capacity\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvdr_layercap.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
}
@@ -664,22 +769,22 @@ namespace DiscImageChef.Commands
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.MiddleZoneStart, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Middle Zone Start\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Middle Zone Start\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_mzs.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.JumpIntervalSize, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Jump Interval Size\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Jump Interval Size\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_jis.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.ManualLayerJumpStartLBA, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Manual Layer Jump Start LBA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Manual Layer Jump Start LBA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_manuallj.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.RemapAnchorPoint, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Remap Anchor Point\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Remap Anchor Point\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_remapanchor.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
}
@@ -691,7 +796,7 @@ namespace DiscImageChef.Commands
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.DiscInformation, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: DI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_readdiscstructure_bd_di.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -699,7 +804,7 @@ namespace DiscImageChef.Commands
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.PAC, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: PAC\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PAC\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_bd_pac.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
}
@@ -710,7 +815,7 @@ namespace DiscImageChef.Commands
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_BurstCuttingArea, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: BCA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: BCA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_readdiscstructure_bd_bca.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -725,7 +830,7 @@ namespace DiscImageChef.Commands
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_DDS, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: DDS\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DDS\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_readdiscstructure_bd_dds.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -733,7 +838,7 @@ namespace DiscImageChef.Commands
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.CartridgeStatus, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Cartridge Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Cartridge Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_readdiscstructure_bd_cartstatus.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -741,7 +846,7 @@ namespace DiscImageChef.Commands
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_SpareAreaInformation, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Spare Area Information\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Spare Area Information\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_readdiscstructure_bd_spare.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -749,12 +854,12 @@ namespace DiscImageChef.Commands
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.RawDFL, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: Raw DFL\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Raw DFL\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_bd_dfl.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, MmcDiscInformationDataTypes.TrackResources, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC INFORMATION 001b\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 001b\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
DicConsole.WriteLine("Track Resources Information:\n{0}", Decoders.SCSI.MMC.DiscInformation.Prettify(cmdBuf));
@@ -762,7 +867,7 @@ namespace DiscImageChef.Commands
}
sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, MmcDiscInformationDataTypes.POWResources, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC INFORMATION 010b\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 010b\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
DicConsole.WriteLine("POW Resources Information:\n{0}", Decoders.SCSI.MMC.DiscInformation.Prettify(cmdBuf));
@@ -784,7 +889,7 @@ namespace DiscImageChef.Commands
// No TOC, no CD (or an empty one)
bool tocSense = dev.ReadTocPmaAtip(out cmdBuf, out senseBuf, false, 0, 0, dev.Timeout, out duration);
if (tocSense)
DicConsole.ErrorWriteLine("READ TOC/PMA/ATIP: TOC\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: TOC\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
toc = Decoders.CD.TOC.Decode(cmdBuf);
@@ -799,7 +904,7 @@ namespace DiscImageChef.Commands
// ATIP exists on blank CDs
sense = dev.ReadAtip(out cmdBuf, out senseBuf, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ TOC/PMA/ATIP: ATIP\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: ATIP\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_atip.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf);
@@ -817,7 +922,7 @@ namespace DiscImageChef.Commands
{
sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, MmcDiscInformationDataTypes.DiscInformation, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC INFORMATION 000b\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 000b\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
Decoders.SCSI.MMC.DiscInformation.StandardDiscInformation? discInfo = Decoders.SCSI.MMC.DiscInformation.Decode000b(cmdBuf);
@@ -847,7 +952,7 @@ namespace DiscImageChef.Commands
sense = dev.ReadSessionInfo(out cmdBuf, out senseBuf, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ TOC/PMA/ATIP: Session info\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: Session info\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_session.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf);
@@ -904,7 +1009,7 @@ namespace DiscImageChef.Commands
sense = dev.ReadRawToc(out cmdBuf, out senseBuf, 1, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ TOC/PMA/ATIP: Raw TOC\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: Raw TOC\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_rawtoc.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf);
@@ -912,7 +1017,7 @@ namespace DiscImageChef.Commands
}
sense = dev.ReadPma(out cmdBuf, out senseBuf, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ TOC/PMA/ATIP: PMA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: PMA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_pma.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf);
@@ -921,7 +1026,7 @@ namespace DiscImageChef.Commands
sense = dev.ReadCdText(out cmdBuf, out senseBuf, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ TOC/PMA/ATIP: CD-TEXT\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: CD-TEXT\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_cdtext.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf);
@@ -937,7 +1042,7 @@ namespace DiscImageChef.Commands
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: PFI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PFI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_readdiscstructure_dvd_pfi.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -957,18 +1062,24 @@ namespace DiscImageChef.Commands
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ DISC STRUCTURE: DMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_dmi.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
}
#endregion Nintendo
}
if(dskType == MediaType.Unknown)
dskType = MediaTypeFromSCSI.Get((byte)dev.SCSIType, dev.Manufacturer, dev.Model, scsiMediumType, scsiDensityCode, blocks, blockSize);
if(dskType == MediaType.Unknown && dev.IsUSB && containsFloppyPage)
dskType = MediaType.FlashDrive;
DicConsole.WriteLine("Media identified as {0}", dskType);
sense = dev.ReadMediaSerialNumber(out cmdBuf, out senseBuf, dev.Timeout, out duration);
if (sense)
DicConsole.ErrorWriteLine("READ MEDIA SERIAL NUMBER\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
DicConsole.DebugWriteLine("Media-Info command", "READ MEDIA SERIAL NUMBER\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_mediaserialnumber.bin", "SCSI READ MEDIA SERIAL NUMBER", cmdBuf);

View File

@@ -41,6 +41,7 @@ using System.IO;
using DiscImageChef.Devices;
using System.Text;
using System.Collections.Generic;
using System.Globalization;
namespace DiscImageChef.Commands
{
@@ -48,6 +49,22 @@ namespace DiscImageChef.Commands
{
static bool aborted;
static FileStream mhddFs;
static FileStream ibgFs;
static StringBuilder ibgSb;
static DateTime ibgDatePoint;
static CultureInfo ibgCulture;
static double ibgStartSpeed;
static string ibgMediaType;
static double ibgDivider;
static bool ibgStartSet;
static int ibgMinSampleRate;
static double ibgMaxSpeed;
static double ibgIntSpeed;
static int ibgSnaps;
static ulong ibgIntSector = 0;
static double ibgIntTime = 0;
static int ibgSampleRate;
public static void doMediaScan(MediaScanSubOptions options)
{
@@ -55,6 +72,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Media-Scan command", "--verbose={0}", options.Verbose);
DicConsole.DebugWriteLine("Media-Scan command", "--device={0}", options.DevicePath);
DicConsole.DebugWriteLine("Media-Scan command", "--mhdd-log={0}", options.MHDDLogPath);
DicConsole.DebugWriteLine("Media-Scan command", "--ibg-log={0}", options.IBGLogPath);
if (options.DevicePath.Length == 2 && options.DevicePath[1] == ':' &&
options.DevicePath[0] != '/' && Char.IsLetter(options.DevicePath[0]))
@@ -63,6 +81,7 @@ namespace DiscImageChef.Commands
}
mhddFs = null;
ibgFs = null;
Device dev = new Device(options.DevicePath);
@@ -75,40 +94,40 @@ namespace DiscImageChef.Commands
switch (dev.Type)
{
case DeviceType.ATA:
doATAMediaScan(options.MHDDLogPath, dev);
doATAMediaScan(options.MHDDLogPath, options.IBGLogPath, options.DevicePath, dev);
break;
case DeviceType.MMC:
case DeviceType.SecureDigital:
doSDMediaScan(options.MHDDLogPath, dev);
doSDMediaScan(options.MHDDLogPath, options.IBGLogPath, options.DevicePath, dev);
break;
case DeviceType.NVMe:
doNVMeMediaScan(options.MHDDLogPath, dev);
doNVMeMediaScan(options.MHDDLogPath, options.IBGLogPath, options.DevicePath, dev);
break;
case DeviceType.ATAPI:
case DeviceType.SCSI:
doSCSIMediaScan(options.MHDDLogPath, dev);
doSCSIMediaScan(options.MHDDLogPath, options.IBGLogPath, options.DevicePath, dev);
break;
default:
throw new NotSupportedException("Unknown device type.");
}
}
static void doATAMediaScan(string MHDDLogPath, Device dev)
static void doATAMediaScan(string MHDDLogPath, string IBGLogPath, string devicePath, Device dev)
{
throw new NotImplementedException("ATA devices not yet supported.");
}
static void doNVMeMediaScan(string MHDDLogPath, Device dev)
static void doNVMeMediaScan(string MHDDLogPath, string IBGLogPath, string devicePath, Device dev)
{
throw new NotImplementedException("NVMe devices not yet supported.");
}
static void doSDMediaScan(string MHDDLogPath, Device dev)
static void doSDMediaScan(string MHDDLogPath, string IBGLogPath, string devicePath, Device dev)
{
throw new NotImplementedException("MMC/SD devices not yet supported.");
}
static void doSCSIMediaScan(string MHDDLogPath, Device dev)
static void doSCSIMediaScan(string MHDDLogPath, string IBGLogPath, string devicePath, Device dev)
{
byte[] cmdBuf;
byte[] senseBuf;
@@ -116,6 +135,7 @@ namespace DiscImageChef.Commands
double duration;
ulong blocks = 0;
uint blockSize = 0;
ushort currentProfile = 0x0001;
if (dev.IsRemovable)
{
@@ -249,6 +269,8 @@ namespace DiscImageChef.Commands
{
Decoders.SCSI.MMC.Features.SeparatedFeatures ftr = Decoders.SCSI.MMC.Features.Separate(cmdBuf);
currentProfile = ftr.CurrentProfile;
switch (ftr.CurrentProfile)
{
case 0x0005:
@@ -267,6 +289,7 @@ namespace DiscImageChef.Commands
if (compactDisc)
{
currentProfile = 0x0008;
// We discarded all discs that falsify a TOC before requesting a real TOC
// No TOC, no CD (or an empty one)
bool tocSense = dev.ReadRawToc(out cmdBuf, out senseBuf, 1, dev.Timeout, out duration);
@@ -342,6 +365,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead);
initMHDDLogFile(MHDDLogPath, dev, blocks, blockSize, blocksToRead);
initIBGLogFile(IBGLogPath, currentProfile);
for (ulong i = 0; i < blocks; i += blocksToRead)
{
@@ -395,6 +419,7 @@ namespace DiscImageChef.Commands
}
writeMHDDLogFile(i, cmdDuration);
writeIBGLogFile(i, currentSpeed * 1024);
}
else
{
@@ -416,6 +441,8 @@ namespace DiscImageChef.Commands
writeMHDDLogFile(i, 65535);
else
writeMHDDLogFile(i, cmdDuration);
writeIBGLogFile(i, 0);
}
}
else
@@ -426,6 +453,8 @@ namespace DiscImageChef.Commands
writeMHDDLogFile(i, 65535);
else
writeMHDDLogFile(i, cmdDuration);
writeIBGLogFile(i, 0);
}
}
@@ -435,6 +464,7 @@ namespace DiscImageChef.Commands
end = DateTime.UtcNow;
DicConsole.WriteLine();
closeMHDDLogFile();
closeIBGLogFile(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000), devicePath);
}
else
{
@@ -460,7 +490,7 @@ namespace DiscImageChef.Commands
if (!read16 && blocks > ((long)0xFFFFFFFF + (long)1))
{
DicConsole.ErrorWriteLine("Device only supports SCSI READ (16) but has more than {0} blocks ({1} blocks total)", (long)0xFFFFFFFF + (long)1, blocks);
DicConsole.ErrorWriteLine("Device only supports SCSI READ (10) but has more than {0} blocks ({1} blocks total)", (long)0xFFFFFFFF + (long)1, blocks);
return;
}
@@ -515,6 +545,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead);
initMHDDLogFile(MHDDLogPath, dev, blocks, blockSize, blocksToRead);
initIBGLogFile(IBGLogPath, currentProfile);
for (ulong i = 0; i < blocks; i += blocksToRead)
{
@@ -570,6 +601,7 @@ namespace DiscImageChef.Commands
A += blocksToRead;
writeMHDDLogFile(i, cmdDuration);
writeIBGLogFile(i, currentSpeed * 1024);
}
// TODO: Separate errors on kind of errors.
else
@@ -581,6 +613,7 @@ namespace DiscImageChef.Commands
writeMHDDLogFile(i, 65535);
else
writeMHDDLogFile(i, cmdDuration);
writeIBGLogFile(i, 0);
}
currentSpeed = ((double)blockSize * blocksToRead / (double)1048576) / (cmdDuration / (double)1000);
@@ -588,6 +621,7 @@ namespace DiscImageChef.Commands
end = DateTime.UtcNow;
DicConsole.WriteLine();
closeMHDDLogFile();
closeIBGLogFile(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000), devicePath);
}
bool seek6, seek10;
@@ -800,6 +834,245 @@ namespace DiscImageChef.Commands
mhddFs.Write(durationBytes, 0, 8);
}
}
static void writeIBGLogFile(ulong sector, double currentSpeed)
{
if (ibgFs != null)
{
ibgIntSpeed += currentSpeed;
ibgSampleRate += (int)Math.Floor((DateTime.Now - ibgDatePoint).TotalMilliseconds);
ibgSnaps++;
if(ibgSampleRate >= 100)
{
if (ibgIntSpeed > 0 && !ibgStartSet)
{
ibgStartSpeed = ibgIntSpeed / ibgSnaps / ibgDivider;
ibgStartSet = true;
}
ibgSb.AppendFormat("{0:0.00},{1},{2:0},0", ibgIntSpeed / ibgSnaps / ibgDivider, ibgIntSector, ibgSampleRate).AppendLine();
if ((ibgIntSpeed / ibgSnaps / ibgDivider) > ibgMaxSpeed)
ibgMaxSpeed = ibgIntSpeed / ibgDivider;
ibgDatePoint = DateTime.Now;
ibgIntSpeed = 0;
ibgSampleRate = 0;
ibgSnaps = 0;
ibgIntSector = sector;
}
}
}
static void initIBGLogFile(string outputFile, ushort currentProfile)
{
if (!string.IsNullOrEmpty(outputFile))
{
ibgFs = new FileStream(outputFile, FileMode.Create);
ibgSb = new StringBuilder();
ibgDatePoint = DateTime.Now;
ibgCulture = new CultureInfo("en-US");
ibgStartSet = false;
ibgMinSampleRate = int.MaxValue;
ibgMaxSpeed = 0;
ibgIntSpeed = 0;
ibgSnaps = 0;
ibgIntSector = 0;
ibgIntTime = 0;
switch (currentProfile)
{
case 0x0001:
ibgMediaType = "HDD";
ibgDivider = 1353;
break;
case 0x0005:
ibgMediaType = "CD-MO";
ibgDivider = 150;
break;
case 0x0008:
ibgMediaType = "CD-ROM";
ibgDivider = 150;
break;
case 0x0009:
ibgMediaType = "CD-R";
ibgDivider = 150;
break;
case 0x000A:
ibgMediaType = "CD-RW";
ibgDivider = 150;
break;
case 0x0010:
ibgMediaType = "DVD-ROM";
ibgDivider = 1353;
break;
case 0x0011:
ibgMediaType = "DVD-R";
ibgDivider = 1353;
break;
case 0x0012:
ibgMediaType = "DVD-RAM";
ibgDivider = 1353;
break;
case 0x0013:
case 0x0014:
ibgMediaType = "DVD-RW";
ibgDivider = 1353;
break;
case 0x0015:
case 0x0016:
ibgMediaType = "DVD-R DL";
ibgDivider = 1353;
break;
case 0x0017:
ibgMediaType = "DVD-RW DL";
ibgDivider = 1353;
break;
case 0x0018:
ibgMediaType = "DVD-Download";
ibgDivider = 1353;
break;
case 0x001A:
ibgMediaType = "DVD+RW";
ibgDivider = 1353;
break;
case 0x001B:
ibgMediaType = "DVD+R";
ibgDivider = 1353;
break;
case 0x0020:
ibgMediaType = "DDCD-ROM";
ibgDivider = 150;
break;
case 0x0021:
ibgMediaType = "DDCD-R";
ibgDivider = 150;
break;
case 0x0022:
ibgMediaType = "DDCD-RW";
ibgDivider = 150;
break;
case 0x002A:
ibgMediaType = "DVD+RW DL";
ibgDivider = 1353;
break;
case 0x002B:
ibgMediaType = "DVD+R DL";
ibgDivider = 1353;
break;
case 0x0040:
ibgMediaType = "BD-ROM";
ibgDivider = 4500;
break;
case 0x0041:
case 0x0042:
ibgMediaType = "BD-R";
ibgDivider = 4500;
break;
case 0x0043:
ibgMediaType = "BD-RE";
ibgDivider = 4500;
break;
case 0x0050:
ibgMediaType = "HD DVD-ROM";
ibgDivider = 4500;
break;
case 0x0051:
ibgMediaType = "HD DVD-R";
ibgDivider = 4500;
break;
case 0x0052:
ibgMediaType = "HD DVD-RAM";
ibgDivider = 4500;
break;
case 0x0053:
ibgMediaType = "HD DVD-RW";
ibgDivider = 4500;
break;
case 0x0058:
ibgMediaType = "HD DVD-R DL";
ibgDivider = 4500;
break;
case 0x005A:
ibgMediaType = "HD DVD-RW DL";
ibgDivider = 4500;
break;
default:
ibgMediaType = "Unknown";
ibgDivider = 1353;
break;
}
}
}
static void closeIBGLogFile(Device dev, ulong blocks, ulong blockSize, double totalSeconds, double currentSpeed, double averageSpeed, string devicePath)
{
if (ibgFs != null)
{
StringBuilder ibgHeader = new StringBuilder();
string ibgBusType;
if (dev.IsUSB)
ibgBusType = "USB";
else if (dev.IsFireWire)
ibgBusType = "FireWire";
else
ibgBusType = dev.Type.ToString();
ibgHeader.AppendLine("IBGD");
ibgHeader.AppendLine();
ibgHeader.AppendLine("[START_CONFIGURATION]");
ibgHeader.AppendLine("IBGD_VERSION=2");
ibgHeader.AppendLine();
ibgHeader.AppendFormat("DATE={0}", DateTime.Now).AppendLine();
ibgHeader.AppendLine();
ibgHeader.AppendFormat("SAMPLE_RATE={0}", 100).AppendLine();
ibgHeader.AppendLine();
ibgHeader.AppendFormat("DEVICE=[0:0:0] {0} {1} ({2}) ({3})",
dev.Manufacturer, dev.Model, devicePath, ibgBusType).AppendLine();
ibgHeader.AppendLine("DEVICE_ADDRESS=0:0:0");
ibgHeader.AppendFormat("DEVICE_MAKEMODEL={0} {1}", dev.Manufacturer, dev.Model).AppendLine();
ibgHeader.AppendFormat("DEVICE_FIRMWAREVERSION={0}", dev.Revision).AppendLine();
ibgHeader.AppendFormat("DEVICE_DRIVELETTER={0}", devicePath).AppendLine();
ibgHeader.AppendFormat("DEVICE_BUSTYPE={0}", ibgBusType).AppendLine();
ibgHeader.AppendLine();
ibgHeader.AppendFormat("MEDIA_TYPE={0}", ibgMediaType).AppendLine();
ibgHeader.AppendLine("MEDIA_BOOKTYPE=Unknown");
ibgHeader.AppendLine("MEDIA_ID=N/A");
ibgHeader.AppendLine("MEDIA_TRACKPATH=PTP");
ibgHeader.AppendLine("MEDIA_SPEEDS=N/A");
ibgHeader.AppendFormat("MEDIA_CAPACITY={0}", blocks).AppendLine();
ibgHeader.AppendLine("MEDIA_LAYER_BREAK=0");
ibgHeader.AppendLine();
ibgHeader.AppendLine("DATA_IMAGEFILE=/dev/null");
ibgHeader.AppendFormat("DATA_SECTORS={0}", blocks).AppendLine();
ibgHeader.AppendFormat("DATA_TYPE=MODE1/{0}", blockSize).AppendLine();
ibgHeader.AppendLine("DATA_VOLUMEIDENTIFIER=");
ibgHeader.AppendLine();
ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_START={0:0.00}", ibgStartSpeed).AppendLine();
ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_END={0:0.00}", currentSpeed / ibgDivider).AppendLine();
ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_AVERAGE={0:0.00}", averageSpeed / ibgDivider).AppendLine();
ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_MAX={0:0.00}", ibgMaxSpeed).AppendLine();
ibgHeader.AppendFormat(ibgCulture, "VERIFY_TIME_TAKEN={0:0}", Math.Floor(totalSeconds)).AppendLine();
ibgHeader.AppendLine("[END_CONFIGURATION]");
ibgHeader.AppendLine();
ibgHeader.AppendLine("HRPC=True");
ibgHeader.AppendLine();
ibgHeader.AppendLine("[START_VERIFY_GRAPH_VALUES]");
ibgHeader.Append(ibgSb.ToString());
ibgHeader.AppendLine("[END_VERIFY_GRAPH_VALUES]");
ibgHeader.AppendLine();
ibgHeader.Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", "\r\n");
StreamWriter sr = new StreamWriter(ibgFs);
sr.Write(ibgHeader.ToString());
sr.Close();
ibgFs.Close();
}
}
}
}

View File

@@ -0,0 +1,558 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : GetChecksum.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 <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using System;
using System.Collections.Generic;
using DiscImageChef.Checksums;
using Schemas;
using System.Threading;
using System.IO;
namespace DiscImageChef.Core
{
class Checksum
{
Adler32Context adler32ctx;
CRC16Context crc16ctx;
CRC32Context crc32ctx;
CRC64Context crc64ctx;
MD5Context md5ctx;
RIPEMD160Context ripemd160ctx;
SHA1Context sha1ctx;
SHA256Context sha256ctx;
SHA384Context sha384ctx;
SHA512Context sha512ctx;
SpamSumContext ssctx;
Thread adlerThread;
Thread crc16Thread;
Thread crc32Thread;
Thread crc64Thread;
Thread md5Thread;
Thread ripemd160Thread;
Thread sha1Thread;
Thread sha256Thread;
Thread sha384Thread;
Thread sha512Thread;
Thread spamsumThread;
adlerPacket adlerPkt;
crc16Packet crc16Pkt;
crc32Packet crc32Pkt;
crc64Packet crc64Pkt;
md5Packet md5Pkt;
ripemd160Packet ripemd160Pkt;
sha1Packet sha1Pkt;
sha256Packet sha256Pkt;
sha384Packet sha384Pkt;
sha512Packet sha512Pkt;
spamsumPacket spamsumPkt;
internal Checksum()
{
adler32ctx = new Adler32Context();
crc16ctx = new CRC16Context();
crc32ctx = new CRC32Context();
crc64ctx = new CRC64Context();
md5ctx = new MD5Context();
ripemd160ctx = new RIPEMD160Context();
sha1ctx = new SHA1Context();
sha256ctx = new SHA256Context();
sha384ctx = new SHA384Context();
sha512ctx = new SHA512Context();
ssctx = new SpamSumContext();
adlerThread = new Thread(updateAdler);
crc16Thread = new Thread(updateCRC16);
crc32Thread = new Thread(updateCRC32);
crc64Thread = new Thread(updateCRC64);
md5Thread = new Thread(updateMD5);
ripemd160Thread = new Thread(updateRIPEMD160);
sha1Thread = new Thread(updateSHA1);
sha256Thread = new Thread(updateSHA256);
sha384Thread = new Thread(updateSHA384);
sha512Thread = new Thread(updateSHA512);
spamsumThread = new Thread(updateSpamSum);
adlerPkt = new adlerPacket();
crc16Pkt = new crc16Packet();
crc32Pkt = new crc32Packet();
crc64Pkt = new crc64Packet();
md5Pkt = new md5Packet();
ripemd160Pkt = new ripemd160Packet();
sha1Pkt = new sha1Packet();
sha256Pkt = new sha256Packet();
sha384Pkt = new sha384Packet();
sha512Pkt = new sha512Packet();
spamsumPkt = new spamsumPacket();
adler32ctx.Init();
adlerPkt.context = adler32ctx;
crc16ctx.Init();
crc16Pkt.context = crc16ctx;
crc32ctx.Init();
crc32Pkt.context = crc32ctx;
crc64ctx.Init();
crc64Pkt.context = crc64ctx;
md5ctx.Init();
md5Pkt.context = md5ctx;
ripemd160ctx.Init();
ripemd160Pkt.context = ripemd160ctx;
sha1ctx.Init();
sha1Pkt.context = sha1ctx;
sha256ctx.Init();
sha256Pkt.context = sha256ctx;
sha384ctx.Init();
sha384Pkt.context = sha384ctx;
sha512ctx.Init();
sha512Pkt.context = sha512ctx;
ssctx.Init();
spamsumPkt.context = ssctx;
}
internal void Update(byte[] data)
{
adlerPkt.data = data;
adlerThread.Start(adlerPkt);
crc16Pkt.data = data;
crc16Thread.Start(crc16Pkt);
crc32Pkt.data = data;
crc32Thread.Start(crc32Pkt);
crc64Pkt.data = data;
crc64Thread.Start(crc64Pkt);
md5Pkt.data = data;
md5Thread.Start(md5Pkt);
ripemd160Pkt.data = data;
ripemd160Thread.Start(ripemd160Pkt);
sha1Pkt.data = data;
sha1Thread.Start(sha1Pkt);
sha256Pkt.data = data;
sha256Thread.Start(sha256Pkt);
sha384Pkt.data = data;
sha384Thread.Start(sha384Pkt);
sha512Pkt.data = data;
sha512Thread.Start(sha512Pkt);
spamsumPkt.data = data;
spamsumThread.Start(spamsumPkt);
while (adlerThread.IsAlive || crc16Thread.IsAlive ||
crc32Thread.IsAlive || crc64Thread.IsAlive ||
md5Thread.IsAlive || ripemd160Thread.IsAlive ||
sha1Thread.IsAlive || sha256Thread.IsAlive ||
sha384Thread.IsAlive || sha512Thread.IsAlive ||
spamsumThread.IsAlive)
{
}
adlerThread = new Thread(updateAdler);
crc16Thread = new Thread(updateCRC16);
crc32Thread = new Thread(updateCRC32);
crc64Thread = new Thread(updateCRC64);
md5Thread = new Thread(updateMD5);
ripemd160Thread = new Thread(updateRIPEMD160);
sha1Thread = new Thread(updateSHA1);
sha256Thread = new Thread(updateSHA256);
sha384Thread = new Thread(updateSHA384);
sha512Thread = new Thread(updateSHA512);
spamsumThread = new Thread(updateSpamSum);
}
internal List<ChecksumType> End()
{
List<ChecksumType> Checksums = new List<ChecksumType>();
ChecksumType chk = new ChecksumType();
chk.type = ChecksumTypeType.adler32;
chk.Value = adler32ctx.End();
Checksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc16;
chk.Value = crc16ctx.End();
Checksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc32;
chk.Value = crc32ctx.End();
Checksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc64;
chk.Value = crc64ctx.End();
Checksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.md5;
chk.Value = md5ctx.End();
Checksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.ripemd160;
chk.Value = ripemd160ctx.End();
Checksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha1;
chk.Value = sha1ctx.End();
Checksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha256;
chk.Value = sha256ctx.End();
Checksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha384;
chk.Value = sha384ctx.End();
Checksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha512;
chk.Value = sha512ctx.End();
Checksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.spamsum;
chk.Value = ssctx.End();
Checksums.Add(chk);
return Checksums;
}
internal static List<ChecksumType> GetChecksums(byte[] data)
{
Adler32Context adler32ctxData = new Adler32Context();
CRC16Context crc16ctxData = new CRC16Context();
CRC32Context crc32ctxData = new CRC32Context();
CRC64Context crc64ctxData = new CRC64Context();
MD5Context md5ctxData = new MD5Context();
RIPEMD160Context ripemd160ctxData = new RIPEMD160Context();
SHA1Context sha1ctxData = new SHA1Context();
SHA256Context sha256ctxData = new SHA256Context();
SHA384Context sha384ctxData = new SHA384Context();
SHA512Context sha512ctxData = new SHA512Context();
SpamSumContext ssctxData = new SpamSumContext();
Thread adlerThreadData = new Thread(updateAdler);
Thread crc16ThreadData = new Thread(updateCRC16);
Thread crc32ThreadData = new Thread(updateCRC32);
Thread crc64ThreadData = new Thread(updateCRC64);
Thread md5ThreadData = new Thread(updateMD5);
Thread ripemd160ThreadData = new Thread(updateRIPEMD160);
Thread sha1ThreadData = new Thread(updateSHA1);
Thread sha256ThreadData = new Thread(updateSHA256);
Thread sha384ThreadData = new Thread(updateSHA384);
Thread sha512ThreadData = new Thread(updateSHA512);
Thread spamsumThreadData = new Thread(updateSpamSum);
adlerPacket adlerPktData = new adlerPacket();
crc16Packet crc16PktData = new crc16Packet();
crc32Packet crc32PktData = new crc32Packet();
crc64Packet crc64PktData = new crc64Packet();
md5Packet md5PktData = new md5Packet();
ripemd160Packet ripemd160PktData = new ripemd160Packet();
sha1Packet sha1PktData = new sha1Packet();
sha256Packet sha256PktData = new sha256Packet();
sha384Packet sha384PktData = new sha384Packet();
sha512Packet sha512PktData = new sha512Packet();
spamsumPacket spamsumPktData = new spamsumPacket();
adler32ctxData.Init();
adlerPktData.context = adler32ctxData;
crc16ctxData.Init();
crc16PktData.context = crc16ctxData;
crc32ctxData.Init();
crc32PktData.context = crc32ctxData;
crc64ctxData.Init();
crc64PktData.context = crc64ctxData;
md5ctxData.Init();
md5PktData.context = md5ctxData;
ripemd160ctxData.Init();
ripemd160PktData.context = ripemd160ctxData;
sha1ctxData.Init();
sha1PktData.context = sha1ctxData;
sha256ctxData.Init();
sha256PktData.context = sha256ctxData;
sha384ctxData.Init();
sha384PktData.context = sha384ctxData;
sha512ctxData.Init();
sha512PktData.context = sha512ctxData;
ssctxData.Init();
spamsumPktData.context = ssctxData;
adlerPktData.data = data;
adlerThreadData.Start(adlerPktData);
crc16PktData.data = data;
crc16ThreadData.Start(crc16PktData);
crc32PktData.data = data;
crc32ThreadData.Start(crc32PktData);
crc64PktData.data = data;
crc64ThreadData.Start(crc64PktData);
md5PktData.data = data;
md5ThreadData.Start(md5PktData);
ripemd160PktData.data = data;
ripemd160ThreadData.Start(ripemd160PktData);
sha1PktData.data = data;
sha1ThreadData.Start(sha1PktData);
sha256PktData.data = data;
sha256ThreadData.Start(sha256PktData);
sha384PktData.data = data;
sha384ThreadData.Start(sha384PktData);
sha512PktData.data = data;
sha512ThreadData.Start(sha512PktData);
spamsumPktData.data = data;
spamsumThreadData.Start(spamsumPktData);
while (adlerThreadData.IsAlive || crc16ThreadData.IsAlive ||
crc32ThreadData.IsAlive || crc64ThreadData.IsAlive ||
md5ThreadData.IsAlive || ripemd160ThreadData.IsAlive ||
sha1ThreadData.IsAlive || sha256ThreadData.IsAlive ||
sha384ThreadData.IsAlive || sha512ThreadData.IsAlive ||
spamsumThreadData.IsAlive)
{
}
List<ChecksumType> dataChecksums = new List<ChecksumType>();
ChecksumType chk;
chk = new ChecksumType();
chk.type = ChecksumTypeType.adler32;
chk.Value = adler32ctxData.End();
dataChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc16;
chk.Value = crc16ctxData.End();
dataChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc32;
chk.Value = crc32ctxData.End();
dataChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc64;
chk.Value = crc64ctxData.End();
dataChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.md5;
chk.Value = md5ctxData.End();
dataChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.ripemd160;
chk.Value = ripemd160ctxData.End();
dataChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha1;
chk.Value = sha1ctxData.End();
dataChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha256;
chk.Value = sha256ctxData.End();
dataChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha384;
chk.Value = sha384ctxData.End();
dataChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha512;
chk.Value = sha512ctxData.End();
dataChecksums.Add(chk);
chk = new ChecksumType();
chk.type = ChecksumTypeType.spamsum;
chk.Value = ssctxData.End();
dataChecksums.Add(chk);
return dataChecksums;
}
#region Threading helpers
struct adlerPacket
{
public Adler32Context context;
public byte[] data;
}
struct crc16Packet
{
public CRC16Context context;
public byte[] data;
}
struct crc32Packet
{
public CRC32Context context;
public byte[] data;
}
struct crc64Packet
{
public CRC64Context context;
public byte[] data;
}
/*struct fletcher16Packet
{
public Fletcher16Context context;
public byte[] data;
}
struct fletcher32Packet
{
public Fletcher32Context context;
public byte[] data;
}*/
struct md5Packet
{
public MD5Context context;
public byte[] data;
}
struct ripemd160Packet
{
public RIPEMD160Context context;
public byte[] data;
}
struct sha1Packet
{
public SHA1Context context;
public byte[] data;
}
struct sha256Packet
{
public SHA256Context context;
public byte[] data;
}
struct sha384Packet
{
public SHA384Context context;
public byte[] data;
}
struct sha512Packet
{
public SHA512Context context;
public byte[] data;
}
struct spamsumPacket
{
public SpamSumContext context;
public byte[] data;
}
static void updateAdler(object packet)
{
((adlerPacket)packet).context.Update(((adlerPacket)packet).data);
}
static void updateCRC16(object packet)
{
((crc16Packet)packet).context.Update(((crc16Packet)packet).data);
}
static void updateCRC32(object packet)
{
((crc32Packet)packet).context.Update(((crc32Packet)packet).data);
}
static void updateCRC64(object packet)
{
((crc64Packet)packet).context.Update(((crc64Packet)packet).data);
}
/*static void updateFletcher16(object packet)
{
((fletcher16Packet)packet).context.Update(((fletcher16Packet)packet).data);
}
static void updateFletcher32(object packet)
{
((fletcher32Packet)packet).context.Update(((fletcher32Packet)packet).data);
}*/
static void updateMD5(object packet)
{
((md5Packet)packet).context.Update(((md5Packet)packet).data);
}
static void updateRIPEMD160(object packet)
{
((ripemd160Packet)packet).context.Update(((ripemd160Packet)packet).data);
}
static void updateSHA1(object packet)
{
((sha1Packet)packet).context.Update(((sha1Packet)packet).data);
}
static void updateSHA256(object packet)
{
((sha256Packet)packet).context.Update(((sha256Packet)packet).data);
}
static void updateSHA384(object packet)
{
((sha384Packet)packet).context.Update(((sha384Packet)packet).data);
}
static void updateSHA512(object packet)
{
((sha512Packet)packet).context.Update(((sha512Packet)packet).data);
}
static void updateSpamSum(object packet)
{
((spamsumPacket)packet).context.Update(((spamsumPacket)packet).data);
}
#endregion Threading helpers
}
}

View File

@@ -58,10 +58,14 @@
</Compile>
<Compile Include="Commands\CreateSidecar.cs" />
<Compile Include="Commands\MediaScan.cs" />
<Compile Include="Commands\DumpMedia.cs" />
<Compile Include="Core\Checksum.cs" />
<Compile Include="Commands\DeviceReport.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Folder Include="Commands\" />
<Folder Include="Core\" />
</ItemGroup>
<ProjectExtensions>
<MonoDevelop>

View File

@@ -186,6 +186,22 @@ namespace DiscImageChef
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Commands.MediaScan.doMediaScan(MediaScanOptions);
break;
case "dump-media":
DumpMediaSubOptions DumpMediaOptions = (DumpMediaSubOptions)invokedVerbInstance;
if (DumpMediaOptions.Debug)
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if (DumpMediaOptions.Verbose)
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Commands.DumpMedia.doDumpMedia(DumpMediaOptions);
break;
case "device-report":
DeviceReportSubOptions DeviceReportOptions = (DeviceReportSubOptions)invokedVerbInstance;
if (DeviceReportOptions.Debug)
DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if (DeviceReportOptions.Verbose)
DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Commands.DeviceReport.doDeviceReport(DeviceReportOptions);
break;
default:
throw new ArgumentException("Should never arrive here!");
}

View File

@@ -239,6 +239,9 @@ namespace DiscImageChef
[Option('m', "mhdd-log", Required = false, DefaultValue = "", HelpText = "Write a log of the scan in the format used by MHDD.")]
public string MHDDLogPath { get; set; }
[Option('b', "ibg-log", Required = false, DefaultValue = "", HelpText = "Write a log of the scan in the format used by ImgBurn.")]
public string IBGLogPath { get; set; }
}
public class FormatsSubOptions : CommonSubOptions
@@ -260,6 +263,38 @@ namespace DiscImageChef
public string InputFile { get; set; }
}
// TODO: Add more options
public class DumpMediaSubOptions : CommonSubOptions
{
[Option('i', "device", Required = true, HelpText = "Device path.")]
public string DevicePath { get; set; }
[Option('w', "output-prefix", Required = true, HelpText = "Prefix for media dump.")]
public string OutputPrefix { get; set; }
[Option('r', "raw", DefaultValue = false,
HelpText = "Print sectors with tags included.")]
public bool Raw { get; set; }
[Option('s', "stop-on-error", DefaultValue = false,
HelpText = "Print sectors with tags included.")]
public bool StopOnError { get; set; }
[Option('f', "force", DefaultValue = false,
HelpText = "Continue dump whatever happens.")]
public bool Force { get; set; }
[Option("reset", DefaultValue = (ushort)0,
HelpText = "Reset the device after these many errors. 0 to disable.")]
public ushort Reset { get; set; }
}
public class DeviceReportSubOptions : CommonSubOptions
{
[Option('i', "device", Required = true, HelpText = "Device path.")]
public string DevicePath { get; set; }
}
public class Options
{
public Options()
@@ -277,6 +312,8 @@ namespace DiscImageChef
BenchmarkVerb = new BenchmarkSubOptions();
CreateSidecarVerb = new CreateSidecarSubOptions();
MediaScanVerb = new MediaScanSubOptions();
DumpMediaVerb = new DumpMediaSubOptions();
DeviceReportVerb = new DeviceReportSubOptions();
}
[VerbOption("analyze", HelpText = "Analyzes a disc image and searches for partitions and/or filesystems.")]
@@ -318,6 +355,12 @@ namespace DiscImageChef
[VerbOption("media-scan", HelpText = "Scans the media inserted on a device.")]
public MediaScanSubOptions MediaScanVerb { get; set; }
[VerbOption("dump-media", HelpText = "Dumps the media inserted on a device to a media image.")]
public DumpMediaSubOptions DumpMediaVerb { get; set; }
[VerbOption("device-report", HelpText = "Tests the device capabilities and creates an XML report of them.")]
public DeviceReportSubOptions DeviceReportVerb { get; set; }
[HelpVerbOption]
public string DoHelpForVerb(string verbName)
{