From 3395c01fda555ad0aab73585495d2820c7421234 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 8 Jun 2017 21:47:18 +0100 Subject: [PATCH] Correctly store all bad sectors, not just first one on run. --- DiscImageChef.Core/Devices/Dumping/ATA.cs | 3 ++- DiscImageChef.Core/Devices/Dumping/CompactDisc.cs | 3 ++- DiscImageChef.Core/Devices/Dumping/SBC.cs | 3 ++- DiscImageChef.Core/Devices/Dumping/XGD.cs | 3 ++- DiscImageChef.Core/Devices/Scanning/ATA.cs | 3 ++- DiscImageChef.Core/Devices/Scanning/SCSI.cs | 9 ++++++--- 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/DiscImageChef.Core/Devices/Dumping/ATA.cs b/DiscImageChef.Core/Devices/Dumping/ATA.cs index b9204074..52e18cbb 100644 --- a/DiscImageChef.Core/Devices/Dumping/ATA.cs +++ b/DiscImageChef.Core/Devices/Dumping/ATA.cs @@ -241,7 +241,8 @@ namespace DiscImageChef.Core.Devices.Dumping } else { - unreadableSectors.Add(i); + for(ulong b = i; b < i + blocksToRead; b++) + unreadableSectors.Add(b); if(duration < 500) mhddLog.Write(i, 65535); else diff --git a/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs b/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs index 9e0b9add..a48b8723 100644 --- a/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs +++ b/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs @@ -570,7 +570,8 @@ namespace DiscImageChef.Core.Devices.Dumping // TODO: Record error on mapfile errored += blocksToRead; - unreadableSectors.Add(i); + for(ulong b = i; b < i + blocksToRead; b++) + unreadableSectors.Add(b); DicConsole.DebugWriteLine("Dump-Media", "READ error:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); if(cmdDuration < 500) mhddLog.Write(i, 65535); diff --git a/DiscImageChef.Core/Devices/Dumping/SBC.cs b/DiscImageChef.Core/Devices/Dumping/SBC.cs index 00c31e2e..903e6489 100644 --- a/DiscImageChef.Core/Devices/Dumping/SBC.cs +++ b/DiscImageChef.Core/Devices/Dumping/SBC.cs @@ -353,7 +353,8 @@ namespace DiscImageChef.Core.Devices.Dumping // TODO: Record error on mapfile errored += blocksToRead; - unreadableSectors.Add(i); + for(ulong b = i; b < i + blocksToRead; b++) + unreadableSectors.Add(b); if(cmdDuration < 500) mhddLog.Write(i, 65535); else diff --git a/DiscImageChef.Core/Devices/Dumping/XGD.cs b/DiscImageChef.Core/Devices/Dumping/XGD.cs index 9669e4cb..72147b89 100644 --- a/DiscImageChef.Core/Devices/Dumping/XGD.cs +++ b/DiscImageChef.Core/Devices/Dumping/XGD.cs @@ -283,7 +283,8 @@ namespace DiscImageChef.Core.Devices.Dumping // TODO: Record error on mapfile errored += blocksToRead; - unreadableSectors.Add(i); + for(ulong b = i; b < i + blocksToRead; b++) + unreadableSectors.Add(b); DicConsole.DebugWriteLine("Dump-Media", "READ error:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); if(cmdDuration < 500) mhddLog.Write(i, 65535); diff --git a/DiscImageChef.Core/Devices/Scanning/ATA.cs b/DiscImageChef.Core/Devices/Scanning/ATA.cs index e370be69..ef92d22e 100644 --- a/DiscImageChef.Core/Devices/Scanning/ATA.cs +++ b/DiscImageChef.Core/Devices/Scanning/ATA.cs @@ -185,7 +185,8 @@ namespace DiscImageChef.Core.Devices.Scanning else { results.errored += blocksToRead; - results.unreadableSectors.Add(i); + for(ulong b = i; b < i + blocksToRead; b++) + results.unreadableSectors.Add(b); if(duration < 500) mhddLog.Write(i, 65535); else diff --git a/DiscImageChef.Core/Devices/Scanning/SCSI.cs b/DiscImageChef.Core/Devices/Scanning/SCSI.cs index b5103a0a..c742e9ff 100644 --- a/DiscImageChef.Core/Devices/Scanning/SCSI.cs +++ b/DiscImageChef.Core/Devices/Scanning/SCSI.cs @@ -342,7 +342,8 @@ namespace DiscImageChef.Core.Devices.Scanning (senseDecoded.Value.ASC != 0x64 || senseDecoded.Value.ASCQ != 0x00)) { results.errored += blocksToRead; - results.unreadableSectors.Add(i); + for(ulong b = i; b < i + blocksToRead; b++) + results.unreadableSectors.Add(b); if(cmdDuration < 500) mhddLog.Write(i, 65535); else @@ -354,7 +355,8 @@ namespace DiscImageChef.Core.Devices.Scanning else { results.errored += blocksToRead; - results.unreadableSectors.Add(i); + for(ulong b = i; b < i + blocksToRead; b++) + results.unreadableSectors.Add(b); if(cmdDuration < 500) mhddLog.Write(i, 65535); else @@ -429,7 +431,8 @@ namespace DiscImageChef.Core.Devices.Scanning else { results.errored += blocksToRead; - results.unreadableSectors.Add(i); + for(ulong b = i; b < i + blocksToRead; b++) + results.unreadableSectors.Add(b); if(cmdDuration < 500) mhddLog.Write(i, 65535); else