From 624eddc6397da3b1289f9055a1f152983243b889 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 7 Oct 2023 01:55:44 +0100 Subject: [PATCH] [Symbian Installer File] Add all known structures. --- Aaru.Archives/Symbian/Structs.cs | 368 +++++++++++++++++++++++++++++++ 1 file changed, 368 insertions(+) diff --git a/Aaru.Archives/Symbian/Structs.cs b/Aaru.Archives/Symbian/Structs.cs index 273ad710b..5f3084877 100644 --- a/Aaru.Archives/Symbian/Structs.cs +++ b/Aaru.Archives/Symbian/Structs.cs @@ -33,12 +33,361 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +#pragma warning disable CS0169 // Field is never used + +#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value + namespace Aaru.Archives; [SuppressMessage("ReSharper", "UnusedType.Global")] [SuppressMessage("ReSharper", "UnusedType.Local")] +[SuppressMessage("ReSharper", "InconsistentNaming")] +[SuppressMessage("ReSharper", "InheritdocConsiderUsage")] public partial class Symbian { +#region Nested type: AttributeConditionalExpression + + /// + /// Contains an attribute to be used as a parameter in a conditional expression + /// + class AttributeConditionalExpression : ConditionalExpression + { + public Attribute attribute; + public uint unused; + } + +#endregion + +#region Nested type: BaseFileRecord + + /// + /// Common fields to simple file record and multiple file record + /// + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct BaseFileRecord + { + /// + /// File record type, in this case or + /// + /// + public FileRecordType recordType; + /// + /// File type + /// + public FileType type; + /// + /// File details + /// + public FileDetails details; + /// + /// Length in bytes of the source name (filename on the machine that built the SIS) + /// + public uint sourceNameLen; + /// + /// Pointer to the source name + /// + public uint sourceNamePtr; + /// + /// Length in bytes of the destination name (filename+path it will be installed to. '!:' for drive means allow the user + /// to pick destination drive) + /// + public uint destinationNameLen; + /// + /// Pointer to the destination name + /// + public uint destinationNamePtr; + } + +#endregion + +#region Nested type: CapabilitiesRecord + + /// + /// TODO: Unclear, check on real files + /// + struct CapabilitiesRecord + { + public uint[] keys; + public uint[] values; + } + +#endregion + +#region Nested type: CertificatesRecord + + /// + /// Holds signature certifications, but the exact distribution of them is unclear + /// + struct CertificatesRecord + { + public ushort year; + public ushort month; + public ushort day; + public ushort hour; + public ushort minute; + public ushort second; + public uint numberOfCertificates; + } + +#endregion + +#region Nested type: ComponentRecord + + /// + /// Component record as pointed by the header + /// + struct ComponentRecord + { + /// + /// Lengths of the component names, array sorted as language records + /// + public uint[] namesLengths; + /// + /// Pointers to the component names, array sorted as language records + /// + public uint[] namesPointers; + } + +#endregion + +#region Nested type: ConditionalEndRecord + + /// + /// Contains an 'else' or 'endif' expression + /// + struct ConditionalEndRecord + { + /// + /// File record type in this case or + /// + public FileRecordType recordType; + } + +#endregion + +#region Nested type: ConditionalExpression + + /// + /// Conditional expression base + /// + class ConditionalExpression + { + /// + /// Conditional type + /// + public ConditionalType type; + } + +#endregion + +#region Nested type: ConditionalRecord + + /// + /// Contains an 'if' or 'else if' condition + /// + struct ConditionalRecord + { + /// + /// File record type in this case or + /// + public FileRecordType recordType; + /// + /// Length in bytes of the record and all contained expressions + /// + public uint length; + /// + /// Conditional expression(s) (chain) + /// + public ConditionalExpression expression; + } + +#endregion + +#region Nested type: MultipleFileRecord + + /// + /// Multiple language file record, cannot be marshalled + /// + struct MultipleFileRecord + { + /// + /// Common fields to simple file record and multiple file record + /// + BaseFileRecord record; + /// + /// Lengths in bytes of the (compressed or uncompressed) files, array sorted as language records + /// + public uint[] lengths; + /// + /// Pointers to the (compressed or uncompressed) files data, array sorted as language records + /// + public uint[] pointers; + /// + /// EPOC Release >= 6, uncompressed files lengths, array sorted as language records + /// + public uint[] originalLengths; + /// + /// EPOC Release >= 6, length in bytes of MIME type string + /// + public uint mimeLen; + /// + /// EPOC Release >= 6, pointer to MIME type string + /// + public uint mimePtr; + } + +#endregion + +#region Nested type: NumberConditionalExpression + + /// + /// Contains a number to be used as a parameter in a conditional expression + /// + class NumberConditionalExpression : ConditionalExpression + { + public uint number; + public uint unused; + } + +#endregion + +#region Nested type: OptionRecord + + struct OptionRecord + { + /// + /// Pointer to the option name lengths, array sorted as language records + /// + public uint[] lengths; + /// + /// Pointer to the option names, array sorted as language records + /// + public uint[] strings; + } + +#endregion + +#region Nested type: OptionsLineRecord + + struct OptionsLineRecord + { + /// + /// File record type in this case + /// + public FileRecordType recordType; + /// + /// How many options follow + /// + public uint numberOfOptions; + /// + /// Option records + /// + public OptionRecord[] options; + /// + /// 128-bit bitmap of selected options + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public ulong[] selectedOptions; + } + +#endregion + +#region Nested type: RequisiteRecord + + struct RequisiteRecord + { + /// + /// UID of the required component + /// + public uint uid; + /// + /// Major version of the required component + /// + public ushort majorVersion; + /// + /// Minor version of the required component + /// + public ushort minorVersion; + /// + /// Variant of the required component, usually set to 0 and not checked by installer + /// + public uint variant; + /// + /// Lengths of the requisite names, array sorted as language records + /// + public uint[] namesLengths; + /// + /// Pointers to the requisite names, array sorted as language records + /// + public uint[] namesPointers; + } + +#endregion + +#region Nested type: SimpleFileRecord + + /// + /// Simple file record, can be marshalled + /// + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct SimpleFileRecord + { + /// + /// Common fields to simple file record and multiple file record + /// + BaseFileRecord record; + /// + /// Length in bytes of the (compressed or uncompressed) file + /// + public uint length; + /// + /// Pointer to the (compressed or uncompressed) file data + /// + public uint pointer; + /// + /// EPOC Release >= 6, uncompressed file length + /// + public uint originalLength; + /// + /// EPOC Release >= 6, length in bytes of MIME type string + /// + public uint mimeLen; + /// + /// EPOC Release >= 6, pointer to MIME type string + /// + public uint mimePtr; + } + +#endregion + +#region Nested type: StringConditionalExpression + + /// + /// Points to a string used as a parameter in a conditional expression + /// + class StringConditionalExpression : ConditionalExpression + { + public uint length; + public uint pointer; + } + +#endregion + +#region Nested type: SubConditionalExpression + + /// + /// Conditional expression that contains a single sub-expression + /// + class SubConditionalExpression : ConditionalExpression + { + /// + /// Sub-expression + /// + public ConditionalExpression subExpression; + } + +#endregion + #region Nested type: SymbianHeader [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -163,5 +512,24 @@ public partial class Symbian public ulong reserved2; } +#endregion + +#region Nested type: TwoSubsConditionalExpression + + /// + /// Conditional expression that contains two sub-expressions + /// + class TwoSubsConditionalExpression : ConditionalExpression + { + /// + /// Left hand side sub-expression + /// + public ConditionalExpression leftOperand; + /// + /// Right hand side sub-expression + /// + public ConditionalExpression rightOperand; + } + #endregion } \ No newline at end of file