Added detection of absolute sector VTOC.

This commit is contained in:
2017-09-17 05:27:59 +01:00
parent 486d87d384
commit 367fdc8472
2 changed files with 29 additions and 17 deletions

View File

@@ -62,6 +62,7 @@ namespace DiscImageChef.PartPlugins
ulong pdloc = 0;
byte[] pdsector = null;
bool magic_found = false;
bool absolute = false;
foreach(ulong i in new ulong[] {0, 1, 8, 29})
{
@@ -305,6 +306,17 @@ namespace DiscImageChef.PartPlugins
timestamps = vtoc.timestamp;
}
// Check for a partition describing the VTOC whose start is the same as the start we know.
// This means partition starts are absolute, not relative, to the VTOC position
for(int i = 0; i < V_NUMPAR; i++)
{
if(parts[i].p_tag == pTag.V_BACKUP && (ulong)parts[i].p_start == sectorOffset)
{
absolute = true;
break;
}
}
for(int i = 0; i < V_NUMPAR; i++)
{
if(parts[i].p_tag != pTag.V_UNUSED)
@@ -322,7 +334,7 @@ namespace DiscImageChef.PartPlugins
string info = "";
// Apparently old ones are absolute :?
if(!useOld)
if(!useOld && !absolute)
{
part.Start += sectorOffset;
part.Offset += sectorOffset * imagePlugin.GetSectorSize();

View File

@@ -57,22 +57,22 @@ namespace DiscImageChef.Tests.Partitions
readonly Partition[][] wanted = {
// AT&T UNIX System V Release 4 Version 2.1 for 386
new []{
new Partition{ Description = null, Name = null, Type = "UNIX: Boot", Length = 34, Sequence = 0, Start = 2 },
new Partition{ Description = null, Name = null, Type = "UNIX: Whole disk", Length = 1023119, Sequence = 1, Start = 2 },
new Partition{ Description = null, Name = null, Type = "UNIX: Stand", Length = 253, Sequence = 2, Start = 64 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 3, Start = 379 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 4, Start = 79003 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 5, Start = 157627 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 6, Start = 236251 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 7, Start = 314875 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 8, Start = 393499 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 9, Start = 472123 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 10, Start = 550747 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 11, Start = 629371 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 76608, Sequence = 12, Start = 707995 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 77616, Sequence = 13, Start = 784603 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 75600, Sequence = 14, Start = 862219 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 84672, Sequence = 15, Start = 937819 },
new Partition{ Description = null, Name = null, Type = "UNIX: Boot", Length = 34, Sequence = 0, Start = 1 },
new Partition{ Description = null, Name = null, Type = "UNIX: Whole disk", Length = 1023119, Sequence = 1, Start = 1 },
new Partition{ Description = null, Name = null, Type = "UNIX: Stand", Length = 253, Sequence = 2, Start = 63 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 3, Start = 378 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 4, Start = 79002 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 5, Start = 157626 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 6, Start = 236250 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 7, Start = 314874 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 8, Start = 393498 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 9, Start = 472122 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 10, Start = 550746 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 78624, Sequence = 11, Start = 629370 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 76608, Sequence = 12, Start = 707994 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 77616, Sequence = 13, Start = 784602 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 75600, Sequence = 14, Start = 862218 },
new Partition{ Description = null, Name = null, Type = "UNIX: /usr", Length = 84672, Sequence = 15, Start = 937818 },
},
};