From 62ed008626d1a2448e51b25cce7eef1b069e2354 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 12 Sep 2017 05:07:31 +0100 Subject: [PATCH] Corrected seeking on VMware FLAT and VMFS disk images. --- DiscImageChef.DiscImages/VMware.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/DiscImageChef.DiscImages/VMware.cs b/DiscImageChef.DiscImages/VMware.cs index 28279558..4ebec41d 100644 --- a/DiscImageChef.DiscImages/VMware.cs +++ b/DiscImageChef.DiscImages/VMware.cs @@ -370,7 +370,7 @@ namespace DiscImageChef.DiscImages newExtent.sectors = extHdrCow.sectors; newExtent.type = "SPARSE"; - DicConsole.DebugWriteLine("VMware plugin", "{0} {1} {2} \"{3}\" {4}", newExtent.access, newExtent.sectors, newExtent.type, newExtent.filter, newExtent.offset); + DicConsole.DebugWriteLine("VMware plugin", "{0} {1} {2} \"{3}\" {4}", newExtent.access, newExtent.sectors, newExtent.type, newExtent.filename, newExtent.offset); extents.Add(currentSector, newExtent); currentSector += newExtent.sectors; @@ -454,7 +454,7 @@ namespace DiscImageChef.DiscImages uint.TryParse(MatchExtent.Groups["offset"].Value, out newExtent.offset); uint.TryParse(MatchExtent.Groups["sectors"].Value, out newExtent.sectors); newExtent.type = MatchExtent.Groups["type"].Value; - DicConsole.DebugWriteLine("VMware plugin", "{0} {1} {2} \"{3}\" {4}", newExtent.access, newExtent.sectors, newExtent.type, newExtent.filter, newExtent.offset); + DicConsole.DebugWriteLine("VMware plugin", "{0} {1} {2} \"{3}\" {4}", newExtent.access, newExtent.sectors, newExtent.type, newExtent.filename, newExtent.offset); extents.Add(currentSector, newExtent); currentSector += newExtent.sectors; @@ -516,7 +516,7 @@ namespace DiscImageChef.DiscImages foreach(VMwareExtent extent in extents.Values) { if(extent.filter == null) - throw new Exception(string.Format("Extent file {0} not found.", extent.filter)); + throw new Exception(string.Format("Extent file {0} not found.", extent.filename)); if(extent.access == "NOACCESS") throw new Exception("Cannot access NOACCESS extents ;)."); @@ -530,7 +530,7 @@ namespace DiscImageChef.DiscImages extentStream.Seek(0, SeekOrigin.Begin); if(extentStream.Length < sectorSize) - throw new Exception(string.Format("Extent {0} is too small.", extent.filter)); + throw new Exception(string.Format("Extent {0} is too small.", extent.filename)); VMwareExtentHeader extentHdr = new VMwareExtentHeader(); byte[] extentHdr_b = new byte[Marshal.SizeOf(extentHdr)]; @@ -754,7 +754,7 @@ namespace DiscImageChef.DiscImages if(currentExtent.type == "FLAT" || currentExtent.type == "VMFS") { dataStream = currentExtent.filter.GetDataForkStream(); - dataStream.Seek((long)(currentExtent.offset + ((sectorAddress - extentStartSector) * sectorSize)), SeekOrigin.Begin); + dataStream.Seek((long)((currentExtent.offset + (sectorAddress - extentStartSector)) * sectorSize), SeekOrigin.Begin); sector = new byte[sectorSize]; dataStream.Read(sector, 0, sector.Length);