On GPT, corrected reading when total entries are less than a whole

sector size.
This commit is contained in:
2017-11-08 17:44:39 +00:00
parent b00d364cb1
commit 8481f73b2c

View File

@@ -113,7 +113,7 @@ namespace DiscImageChef.PartPlugins
if(hdr.signature != GptMagic) if(hdr.signature != GptMagic)
return false; return false;
if(hdr.myLBA != 1) if(hdr.myLBA != 1 + sectorOffset)
return false; return false;
uint divisor, modulo, sectorSize; uint divisor, modulo, sectorSize;
@@ -132,6 +132,8 @@ namespace DiscImageChef.PartPlugins
} }
uint totalEntriesSectors = (hdr.entries * hdr.entriesSize) / imagePlugin.GetSectorSize(); uint totalEntriesSectors = (hdr.entries * hdr.entriesSize) / imagePlugin.GetSectorSize();
if((hdr.entries * hdr.entriesSize) % imagePlugin.GetSectorSize() > 0)
totalEntriesSectors++;
byte[] temp = imagePlugin.ReadSectors(hdr.entryLBA / divisor, totalEntriesSectors + modulo); byte[] temp = imagePlugin.ReadSectors(hdr.entryLBA / divisor, totalEntriesSectors + modulo);
byte[] entriesBytes = new byte[temp.Length - (modulo * 512)]; byte[] entriesBytes = new byte[temp.Length - (modulo * 512)];