From 8fb732cc601fd9f9fdd8b25a21d4e939ce78b478 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Mon, 9 Oct 2017 12:31:39 +0100 Subject: [PATCH] Add support for Amiga extensions to ISO9660. --- DiscImageChef.Filesystems/ISO9660/Consts.cs | 35 ++++++++++++++++++++ DiscImageChef.Filesystems/ISO9660/Info.cs | 3 ++ DiscImageChef.Filesystems/ISO9660/Structs.cs | 20 +++++++++++ 3 files changed, 58 insertions(+) diff --git a/DiscImageChef.Filesystems/ISO9660/Consts.cs b/DiscImageChef.Filesystems/ISO9660/Consts.cs index d0c859701..6509dd3f1 100644 --- a/DiscImageChef.Filesystems/ISO9660/Consts.cs +++ b/DiscImageChef.Filesystems/ISO9660/Consts.cs @@ -63,6 +63,7 @@ namespace DiscImageChef.Filesystems.ISO9660 const ulong ziso_header_cigam = 0x07D6DBC99653E437; const ushort ziso_Magic = 0x5A46; // "ZF" const ushort ziso_PagedZlib = 0x707A; // "pz" + const ushort Amiga_Magic = 0x4153; // "AS" [Flags] enum FileFlags : byte @@ -232,5 +233,39 @@ namespace DiscImageChef.Filesystems.ISO9660 Effective = 1 << 6, LongFormat = 1 << 7, } + + [Flags] + enum AmigaFlags : byte + { + Protection = 1 << 0, + Comment = 1 << 1, + CommentContinues = 1 << 2 + } + + [Flags] + enum AmigaMultiuser : byte + { + GroupDelete = 1 << 0, + GroupExec = 1 << 1, + GroupWrite = 1 << 2, + GroupRead = 1 << 3, + OtherDelete = 1 << 4, + OtherExec = 1 << 5, + OtherWrite = 1 << 6, + OtherRead = 1 << 7, + } + + [Flags] + enum AmigaAttributes : byte + { + OwnerDelete = 1 << 0, + OwnerExec = 1 << 1, + OwnerWrite = 1 << 2, + OwnerRead = 1 << 3, + Archive = 1 << 4, + Reentrant = 1 << 5, + Script = 1 << 6, + Reserved = 1 << 7, + } } } diff --git a/DiscImageChef.Filesystems/ISO9660/Info.cs b/DiscImageChef.Filesystems/ISO9660/Info.cs index 8197f2b97..035869322 100644 --- a/DiscImageChef.Filesystems/ISO9660/Info.cs +++ b/DiscImageChef.Filesystems/ISO9660/Info.cs @@ -258,6 +258,7 @@ namespace DiscImageChef.Filesystems.ISO9660 bool SUSP = false; bool RRIP = false; bool ziso = false; + bool Amiga = false; List contareas = new List(); List refareas = new List(); StringBuilder suspInformation = new StringBuilder(); @@ -378,6 +379,7 @@ namespace DiscImageChef.Filesystems.ISO9660 nextSignature == RRIP_Timestamps || nextSignature == RRIP_Sparse; ziso |= nextSignature == ziso_Magic; + Amiga |= nextSignature == Amiga_Magic; sa_off += sa[sa_off + 2]; @@ -435,6 +437,7 @@ namespace DiscImageChef.Filesystems.ISO9660 nextSignature == RRIP_Timestamps || nextSignature == RRIP_Sparse; ziso |= nextSignature == ziso_Magic; + Amiga |= nextSignature == Amiga_Magic; ca_off += ca_data[ca_off + 2]; } diff --git a/DiscImageChef.Filesystems/ISO9660/Structs.cs b/DiscImageChef.Filesystems/ISO9660/Structs.cs index 35c63f90c..8537ce3f8 100644 --- a/DiscImageChef.Filesystems/ISO9660/Structs.cs +++ b/DiscImageChef.Filesystems/ISO9660/Structs.cs @@ -632,6 +632,26 @@ namespace DiscImageChef.Filesystems.ISO9660 public uint uncomp_len_be; } + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct AmigaEntry + { + public ushort signature; + public byte length; + public byte version; + public AmigaFlags flags; + // Followed by AmigaProtection if present + // Followed by length-prefixed string for comment if present + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct AmigaProtection + { + public byte User; + public byte Reserved; + public AmigaMultiuser Multiuser; + public AmigaAttributes Protection; + } + struct DecodedVolumeDescriptor { public string SystemIdentifier;