Decode "PX" system area.

This commit is contained in:
2019-07-28 17:46:09 +01:00
parent ebc775fec2
commit 3c09d6873b
6 changed files with 149 additions and 74 deletions

View File

@@ -147,7 +147,9 @@ namespace DiscImageChef.CommonTypes.Structs
/// <summary>If file is deleted, contents should be stored, for a possible future undeletion</summary> /// <summary>If file is deleted, contents should be stored, for a possible future undeletion</summary>
Undeletable = 0x800000000000, Undeletable = 0x800000000000,
/// <summary>File is a pipe</summary> /// <summary>File is a pipe</summary>
Pipe = 0x1000000000000 Pipe = 0x1000000000000,
/// <summary>File is a socket</summary>
Socket = 0x2000000000000
} }
/// <summary> /// <summary>

View File

@@ -50,18 +50,18 @@ namespace DiscImageChef.Filesystems.ISO9660
[Flags] [Flags]
enum PosixMode : uint enum PosixMode : uint
{ {
OwnerRead = 0x100, OwnerRead = 0x0100,
OwnerWrite = 0x80, OwnerWrite = 0x0080,
OwnerExecute = 0x40, OwnerExecute = 0x0040,
GroupRead = 0x20, GroupRead = 0x0020,
GroupWrite = 0x10, GroupWrite = 0x0010,
GroupExecute = 0x8, GroupExecute = 0x0008,
OtherRead = 0x4, OtherRead = 0x0004,
OtherWrite = 0x2, OtherWrite = 0x0002,
OtherExecute = 0x1, OtherExecute = 0x0001,
SetUID = 0x800, SetUID = 0x0800,
SetGid = 0x400, SetGid = 0x0400,
IsVTX = 0x200, IsVTX = 0x0200,
Socket = 0xC000, Socket = 0xC000,
Symlink = 0xA000, Symlink = 0xA000,
Regular = 0x8000, Regular = 0x8000,

View File

@@ -435,6 +435,24 @@ namespace DiscImageChef.Filesystems.ISO9660
break; break;
case RRIP_POSIX_ATTRIBUTES: case RRIP_POSIX_ATTRIBUTES:
byte pxLength = data[systemAreaOff + 2];
if(pxLength == 36)
entry.PosixAttributesOld =
Marshal.ByteArrayToStructureLittleEndian<PosixAttributesOld>(data, systemAreaOff,
Marshal
.SizeOf<
PosixAttributesOld
>());
else if(pxLength >= 44)
entry.PosixAttributes =
Marshal.ByteArrayToStructureLittleEndian<PosixAttributes>(data, systemAreaOff,
Marshal
.SizeOf<PosixAttributes
>());
systemAreaOff += pxLength;
break;
case RRIP_POSIX_DEV_NO: case RRIP_POSIX_DEV_NO:
case RRIP_SYMLINK: case RRIP_SYMLINK:
case RRIP_NAME: case RRIP_NAME:

View File

@@ -132,6 +132,41 @@ namespace DiscImageChef.Filesystems.ISO9660
stat.Inode = entry.XA.Value.filenumber; stat.Inode = entry.XA.Value.filenumber;
} }
if(entry.PosixAttributes != null)
{
stat.Mode = (uint?)entry.PosixAttributes.Value.st_mode & 0x0FFF;
if(entry.PosixAttributes.Value.st_mode.HasFlag(PosixMode.Block))
stat.Attributes |= FileAttributes.BlockDevice;
if(entry.PosixAttributes.Value.st_mode.HasFlag(PosixMode.Character))
stat.Attributes |= FileAttributes.CharDevice;
if(entry.PosixAttributes.Value.st_mode.HasFlag(PosixMode.Pipe)) stat.Attributes |= FileAttributes.Pipe;
if(entry.PosixAttributes.Value.st_mode.HasFlag(PosixMode.Socket))
stat.Attributes |= FileAttributes.Socket;
if(entry.PosixAttributes.Value.st_mode.HasFlag(PosixMode.Symlink))
stat.Attributes |= FileAttributes.Symlink;
stat.Links = entry.PosixAttributes.Value.st_nlink;
stat.UID = entry.PosixAttributes.Value.st_uid;
stat.GID = entry.PosixAttributes.Value.st_gid;
stat.Inode = entry.PosixAttributes.Value.st_ino;
}
else if(entry.PosixAttributesOld != null)
{
stat.Mode = (uint?)entry.PosixAttributesOld.Value.st_mode & 0x0FFF;
if(entry.PosixAttributesOld.Value.st_mode.HasFlag(PosixMode.Block))
stat.Attributes |= FileAttributes.BlockDevice;
if(entry.PosixAttributesOld.Value.st_mode.HasFlag(PosixMode.Character))
stat.Attributes |= FileAttributes.CharDevice;
if(entry.PosixAttributesOld.Value.st_mode.HasFlag(PosixMode.Pipe))
stat.Attributes |= FileAttributes.Pipe;
if(entry.PosixAttributesOld.Value.st_mode.HasFlag(PosixMode.Socket))
stat.Attributes |= FileAttributes.Socket;
if(entry.PosixAttributesOld.Value.st_mode.HasFlag(PosixMode.Symlink))
stat.Attributes |= FileAttributes.Symlink;
stat.Links = entry.PosixAttributesOld.Value.st_nlink;
stat.UID = entry.PosixAttributesOld.Value.st_uid;
stat.GID = entry.PosixAttributesOld.Value.st_gid;
}
if(entry.AmigaProtection != null) if(entry.AmigaProtection != null)
{ {
if(entry.AmigaProtection.Value.Multiuser.HasFlag(AmigaMultiuser.GroupExec)) stat.Mode |= 8; if(entry.AmigaProtection.Value.Multiuser.HasFlag(AmigaMultiuser.GroupExec)) stat.Mode |= 8;

View File

@@ -69,6 +69,8 @@ namespace DiscImageChef.Filesystems.ISO9660
public FinderInfo FinderInfo; public FinderInfo FinderInfo;
public FileFlags Flags; public FileFlags Flags;
public byte Interleave; public byte Interleave;
public PosixAttributes? PosixAttributes;
public PosixAttributesOld? PosixAttributesOld;
public DecodedDirectoryEntry ResourceFork; public DecodedDirectoryEntry ResourceFork;
public uint Size; public uint Size;
public DateTime? Timestamp; public DateTime? Timestamp;

View File

@@ -36,99 +36,117 @@ namespace DiscImageChef.Filesystems.ISO9660
{ {
public partial class ISO9660 public partial class ISO9660
{ {
// RRIP 1.10
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct PosixAttributesOld
{
public readonly ushort signature;
public readonly byte length;
public readonly byte version;
public readonly PosixMode st_mode;
public readonly PosixMode st_mode_be;
public readonly uint st_nlink;
public readonly uint st_nlink_be;
public readonly uint st_uid;
public readonly uint st_uid_be;
public readonly uint st_gid;
public readonly uint st_gid_be;
}
// RRIP 1.12
[StructLayout(LayoutKind.Sequential, Pack = 1)] [StructLayout(LayoutKind.Sequential, Pack = 1)]
struct PosixAttributes struct PosixAttributes
{ {
public ushort signature; public readonly ushort signature;
public byte length; public readonly byte length;
public byte version; public readonly byte version;
public PosixMode st_mode; public readonly PosixMode st_mode;
public PosixMode st_mode_be; public readonly PosixMode st_mode_be;
public uint st_nlink; public readonly uint st_nlink;
public uint st_nlink_be; public readonly uint st_nlink_be;
public uint st_uid; public readonly uint st_uid;
public uint st_uid_be; public readonly uint st_uid_be;
public uint st_gid; public readonly uint st_gid;
public uint st_gid_be; public readonly uint st_gid_be;
public uint st_ino; public readonly uint st_ino;
public uint st_ino_be; public readonly uint st_ino_be;
} }
[StructLayout(LayoutKind.Sequential, Pack = 1)] [StructLayout(LayoutKind.Sequential, Pack = 1)]
struct PosixDeviceNumber struct PosixDeviceNumber
{ {
public ushort signature; public readonly ushort signature;
public byte length; public readonly byte length;
public byte version; public readonly byte version;
public uint dev_t_high; public readonly uint dev_t_high;
public uint dev_t_high_be; public readonly uint dev_t_high_be;
public uint dev_t_low; public readonly uint dev_t_low;
public uint dev_t_low_be; public readonly uint dev_t_low_be;
} }
[StructLayout(LayoutKind.Sequential, Pack = 1)] [StructLayout(LayoutKind.Sequential, Pack = 1)]
struct SymbolicLink struct SymbolicLink
{ {
public ushort signature; public readonly ushort signature;
public byte length; public readonly byte length;
public byte version; public readonly byte version;
public SymlinkFlags flags; public readonly SymlinkFlags flags;
// Followed by SymbolicLinkComponent (link to /bar/foo uses at least two of these structs) // Followed by SymbolicLinkComponent (link to /bar/foo uses at least two of these structs)
} }
[StructLayout(LayoutKind.Sequential, Pack = 1)] [StructLayout(LayoutKind.Sequential, Pack = 1)]
struct SymbolicLinkComponent struct SymbolicLinkComponent
{ {
public SymlinkComponentFlags flags; public readonly SymlinkComponentFlags flags;
public byte length; public readonly byte length;
// Followed by component content // Followed by component content
} }
[StructLayout(LayoutKind.Sequential, Pack = 1)] [StructLayout(LayoutKind.Sequential, Pack = 1)]
struct AlternateName struct AlternateName
{ {
public ushort signature; public readonly ushort signature;
public byte length; public readonly byte length;
public byte version; public readonly byte version;
public AlternateNameFlags flags; public readonly AlternateNameFlags flags;
// Folowed by name, can be divided in pieces // Folowed by name, can be divided in pieces
} }
[StructLayout(LayoutKind.Sequential, Pack = 1)] [StructLayout(LayoutKind.Sequential, Pack = 1)]
struct ChildLink struct ChildLink
{ {
public ushort signature; public readonly ushort signature;
public byte length; public readonly byte length;
public byte version; public readonly byte version;
public uint child_dir_lba; public readonly uint child_dir_lba;
public uint child_dir_lba_be; public readonly uint child_dir_lba_be;
} }
[StructLayout(LayoutKind.Sequential, Pack = 1)] [StructLayout(LayoutKind.Sequential, Pack = 1)]
struct ParentLink struct ParentLink
{ {
public ushort signature; public readonly ushort signature;
public byte length; public readonly byte length;
public byte version; public readonly byte version;
public uint parent_dir_lba; public readonly uint parent_dir_lba;
public uint parent_dir_lba_be; public readonly uint parent_dir_lba_be;
} }
[StructLayout(LayoutKind.Sequential, Pack = 1)] [StructLayout(LayoutKind.Sequential, Pack = 1)]
struct RelocatedDirectory struct RelocatedDirectory
{ {
public ushort signature; public readonly ushort signature;
public byte length; public readonly byte length;
public byte version; public readonly byte version;
} }
[StructLayout(LayoutKind.Sequential, Pack = 1)] [StructLayout(LayoutKind.Sequential, Pack = 1)]
struct Timestamps struct Timestamps
{ {
public ushort signature; public readonly ushort signature;
public byte length; public readonly byte length;
public byte version; public readonly byte version;
public TimestampFlags flags; public readonly TimestampFlags flags;
// If flags indicate long format, timestamps are 17 bytes, if not, 7 bytes // If flags indicate long format, timestamps are 17 bytes, if not, 7 bytes
// Followed by creation time if present // Followed by creation time if present
// Followed by modification time if present // Followed by modification time if present
@@ -142,14 +160,14 @@ namespace DiscImageChef.Filesystems.ISO9660
[StructLayout(LayoutKind.Sequential, Pack = 1)] [StructLayout(LayoutKind.Sequential, Pack = 1)]
struct SparseFile struct SparseFile
{ {
public ushort signature; public readonly ushort signature;
public byte length; public readonly byte length;
public byte version; public readonly byte version;
public uint virtual_size_high; public readonly uint virtual_size_high;
public uint virtual_size_high_be; public readonly uint virtual_size_high_be;
public uint virtual_size_low; public readonly uint virtual_size_low;
public uint virtual_size_low_be; public readonly uint virtual_size_low_be;
public byte table_depth; public readonly byte table_depth;
} }
} }
} }