Implement decoding High Sierra path table.

This commit is contained in:
2019-07-29 05:37:46 +01:00
parent 18a3566fe7
commit 9b5e2092ef
2 changed files with 35 additions and 1 deletions

View File

@@ -35,5 +35,39 @@ namespace DiscImageChef.Filesystems.ISO9660
return table.ToArray(); return table.ToArray();
} }
PathTableEntryInternal[] DecodeHighSierraPathTable(byte[] data)
{
if(data is null) return null;
List<PathTableEntryInternal> table = new List<PathTableEntryInternal>();
int off = 0;
while(off < data.Length)
{
HighSierraPathTableEntry entry =
Marshal.ByteArrayToStructureBigEndian<HighSierraPathTableEntry>(data, off,
Marshal
.SizeOf<HighSierraPathTableEntry
>());
if(entry.name_len == 0) break;
off += Marshal.SizeOf<HighSierraPathTableEntry>();
string name = Encoding.GetString(data, off, entry.name_len);
table.Add(new PathTableEntryInternal
{
Extent = entry.start_lbn, Name = name, Parent = entry.parent_dirno
});
off += entry.name_len;
if(entry.name_len % 2 != 0) off++;
}
return table.ToArray();
}
} }
} }

View File

@@ -199,7 +199,7 @@ namespace DiscImageChef.Filesystems.ISO9660
fsFormat = "ISO9660"; fsFormat = "ISO9660";
} }
pathTable = DecodePathTable(pathTableData); pathTable = highSierra ? DecodeHighSierraPathTable(pathTableData) : DecodePathTable(pathTableData);
// High Sierra and CD-i do not support Joliet or RRIP // High Sierra and CD-i do not support Joliet or RRIP
if((highSierra || cdi) && this.@namespace != Namespace.Normal && this.@namespace != Namespace.Vms) if((highSierra || cdi) && this.@namespace != Namespace.Normal && this.@namespace != Namespace.Vms)