Prevent decoding subpages on subpage 00h decoders.

This commit is contained in:
2015-10-30 20:18:32 +00:00
parent 8f113f018a
commit 8c34914968
2 changed files with 79 additions and 3 deletions

View File

@@ -1269,6 +1269,9 @@ namespace DiscImageChef.Decoders.SCSI
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x0A)
return null;
@@ -1477,7 +1480,7 @@ namespace DiscImageChef.Decoders.SCSI
/// <summary>
/// Disconnect-reconnect page
/// Page code 0x02
/// 16 bytes in SCSI-2, SPC-1
/// 16 bytes in SCSI-2, SPC-1, SPC-2
/// </summary>
public struct ModePage_02
{
@@ -1537,6 +1540,9 @@ namespace DiscImageChef.Decoders.SCSI
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x02)
return null;
@@ -1676,6 +1682,9 @@ namespace DiscImageChef.Decoders.SCSI
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x08)
return null;
@@ -1897,6 +1906,9 @@ namespace DiscImageChef.Decoders.SCSI
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x05)
return null;
@@ -2177,6 +2189,9 @@ namespace DiscImageChef.Decoders.SCSI
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x03)
return null;
@@ -2271,6 +2286,9 @@ namespace DiscImageChef.Decoders.SCSI
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x0B)
return null;
@@ -2395,6 +2413,9 @@ namespace DiscImageChef.Decoders.SCSI
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x01)
return null;
@@ -2530,6 +2551,9 @@ namespace DiscImageChef.Decoders.SCSI
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x04)
return null;
@@ -2654,6 +2678,9 @@ namespace DiscImageChef.Decoders.SCSI
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x07)
return null;
@@ -2812,6 +2839,9 @@ namespace DiscImageChef.Decoders.SCSI
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x10)
return null;
@@ -3023,6 +3053,9 @@ namespace DiscImageChef.Decoders.SCSI
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x0E)
return null;
@@ -3226,6 +3259,9 @@ namespace DiscImageChef.Decoders.SCSI
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x0D)
return null;
@@ -3350,6 +3386,9 @@ namespace DiscImageChef.Decoders.SCSI
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x01)
return null;
@@ -3495,6 +3534,9 @@ namespace DiscImageChef.Decoders.SCSI
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x07)
return null;
@@ -3636,6 +3678,9 @@ namespace DiscImageChef.Decoders.SCSI
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x06)
return null;
@@ -3800,6 +3845,9 @@ namespace DiscImageChef.Decoders.SCSI
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x2A)
return null;
@@ -4000,7 +4048,7 @@ namespace DiscImageChef.Decoders.SCSI
/// <summary>
/// Informational exceptions control page
/// Page code 0x1C
/// 12 bytes in SPC-1
/// 12 bytes in SPC-1, SPC-2
/// </summary>
public struct ModePage_1C
{
@@ -4036,6 +4084,15 @@ namespace DiscImageChef.Decoders.SCSI
/// How many times to report informational exceptions
/// </summary>
public uint ReportCount;
/// <summary>
/// Enable background functions
/// </summary>
public bool EBF;
/// <summary>
/// Warning reporting enabled
/// </summary>
public bool EWasc;
}
public static ModePage_1C? DecodeModePage_1C(byte[] pageResponse)
@@ -4043,6 +4100,9 @@ namespace DiscImageChef.Decoders.SCSI
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x1C)
return null;
@@ -4066,6 +4126,9 @@ namespace DiscImageChef.Decoders.SCSI
decoded.IntervalTimer = (uint)((pageResponse[4] << 24) + (pageResponse[5] << 16) + (pageResponse[6] << 8) + pageResponse[7]);
decoded.ReportCount = (uint)((pageResponse[8] << 24) + (pageResponse[9] << 16) + (pageResponse[10] << 8) + pageResponse[11]);
decoded.EBF |= (pageResponse[2] & 0x20) == 0x20;
decoded.EWasc |= (pageResponse[2] & 0x10) == 0x10;
return decoded;
}
@@ -4140,6 +4203,11 @@ namespace DiscImageChef.Decoders.SCSI
sb.AppendFormat("\tInformational exception conditions will be reported a maximum of {0} times", page.ReportCount);
}
if (page.EWasc)
sb.AppendLine("\tWarning reporting is enabled");
if (page.EBF)
sb.AppendLine("\tBackground functions are enabled");
return sb.ToString();
}
#endregion Mode Page 0x1C: Informational exceptions control page
@@ -4148,7 +4216,7 @@ namespace DiscImageChef.Decoders.SCSI
/// <summary>
/// Power condition page
/// Page code 0x1A
/// 12 bytes in SPC-1
/// 12 bytes in SPC-1, SPC-2
/// </summary>
public struct ModePage_1A
{
@@ -4179,6 +4247,9 @@ namespace DiscImageChef.Decoders.SCSI
if (pageResponse == null)
return null;
if ((pageResponse[0] & 0x40) == 0x40)
return null;
if ((pageResponse[0] & 0x3F) != 0x1A)
return null;