From ecc1613f49b3075a05efb4e4a027123f6212fa41 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 10 Jan 2023 11:59:33 -0800 Subject: [PATCH] Start adding some MSI-specific things --- BurnOutSharp.Models/CFB/Constants.cs | 32 +- BurnOutSharp.Models/CFB/Enums.cs | 404 +++++++++++++++++- BurnOutSharp.Models/CFB/FileHeader.cs | 2 +- BurnOutSharp.Models/CFB/SummaryInformation.cs | 46 ++ BurnOutSharp.Models/CFB/Variant.cs | 45 ++ 5 files changed, 526 insertions(+), 3 deletions(-) create mode 100644 BurnOutSharp.Models/CFB/SummaryInformation.cs create mode 100644 BurnOutSharp.Models/CFB/Variant.cs diff --git a/BurnOutSharp.Models/CFB/Constants.cs b/BurnOutSharp.Models/CFB/Constants.cs index 4f6b9435..9983a772 100644 --- a/BurnOutSharp.Models/CFB/Constants.cs +++ b/BurnOutSharp.Models/CFB/Constants.cs @@ -8,15 +8,45 @@ namespace BurnOutSharp.Models.CFB public const ulong SignatureUInt64 = 0xE11AB1A1E011CFD0; + + /// #region Class IDs - // Shares a value with Merge Module and Patch Creation Properties + /// + /// Installer Package (msi), Merge Module (msm), Patch Creation Properties (pcp) + /// public static readonly Guid InstallerPackage = new Guid("000c1084-0000-0000-c000-000000000046"); + /// + /// Patch Package (msp) + /// public static readonly Guid PatchPackage = new Guid("000C1086-0000-0000-C000-000000000046"); + /// + /// Transform (mst) + /// public static readonly Guid Transform = new Guid("000C1082-0000-0000-C000-000000000046"); #endregion + + /// + #region Property Set Format IDs + + /// + /// The Summary Information Property Set + /// + public static readonly Guid FMTID_SummaryInformation = new Guid("F29F85E0-4FF9-1068-AB91-08002B27B3D9"); + + /// + /// The DocumentSummaryInformation and UserDefined Property Sets + /// + public static readonly Guid FMTID_DocSummaryInformation = new Guid("D5CDD502-2E9C-101B-9397-08002B2CF9AE"); + + /// + /// The DocumentSummaryInformation and UserDefined Property Sets + /// + public static readonly Guid FMTID_UserDefinedProperties = new Guid("D5CDD505-2E9C-101B-9397-08002B2CF9AE"); + + #endregion } } \ No newline at end of file diff --git a/BurnOutSharp.Models/CFB/Enums.cs b/BurnOutSharp.Models/CFB/Enums.cs index 8b10211c..b46cc1ad 100644 --- a/BurnOutSharp.Models/CFB/Enums.cs +++ b/BurnOutSharp.Models/CFB/Enums.cs @@ -5,7 +5,7 @@ namespace BurnOutSharp.Models.CFB Red = 0x00, Black = 0x01, } - + public enum ObjectType : byte { Unknown = 0x00, @@ -69,4 +69,406 @@ namespace BurnOutSharp.Models.CFB /// NOSTREAM = 0xFFFFFFFF, } + + /// + public enum SummaryInformationProperty : uint + { + /// + /// Title + /// + PIDSI_TITLE = 0x00000002, + + /// + /// Subject + /// + PIDSI_SUBJECT = 0x00000003, + + /// + /// Author + /// + PIDSI_AUTHOR = 0x00000004, + + /// + /// Keywords + /// + PIDSI_KEYWORDS = 0x00000005, + + /// + /// Comments + /// + PIDSI_COMMENTS = 0x00000006, + + /// + /// Template + /// + PIDSI_TEMPLATE = 0x00000007, + + /// + /// Last Saved By + /// + PIDSI_LASTAUTHOR = 0x00000008, + + /// + /// Revision Number + /// + PIDSI_REVNUMBER = 0x00000009, + + /// + /// Total Editing Time + /// + PIDSI_EDITTIME = 0x0000000A, + + /// + /// Last Printed + /// + PIDSI_LASTPRINTED = 0x0000000B, + + /// + /// Create Time/Date + /// + PIDSI_CREATE_DTM = 0x0000000C, + + /// + /// Last saved Time/Date + /// + PIDSI_LASTSAVE_DTM = 0x0000000D, + + /// + /// Number of Pages + /// + PIDSI_PAGECOUNT = 0x0000000E, + + /// + /// Number of Words + /// + PIDSI_WORDCOUNT = 0x0000000F, + + /// + /// Number of Characters + /// + PIDSI_CHARCOUNT = 0x00000010, + + /// + /// Thumbnail + /// + PIDSI_THUMBNAIL = 0x00000011, + + /// + /// Name of Creating Application + /// + PIDSI_APPNAME = 0x00000012, + + /// + /// Security + /// + PIDSI_SECURITY = 0x00000013, + } + + /// Also includes the DocumentSummaryInformation set + /// + public enum UserDefinedProperty : uint + { + /// + /// Category - A text string typed by the user that indicates what + /// category the file belongs to (memo, proposal, and so on). It + /// is useful for finding files of same type. + /// + PIDDSI_CATEGORY = 0x00000002, + + /// + /// PresentationTarget - Target format for presentation (35mm, + /// printer, video, and so on). + /// + PIDDSI_PRESFORMAT = 0x00000003, + + /// + /// Bytes - Number of bytes. + /// + PIDDSI_BYTECOUNT = 0x00000004, + + /// + /// Lines - Number of lines. + /// + PIDDSI_LINECOUNT = 0x00000005, + + /// + /// Paragraphs - Number of paragraphs. + /// + PIDDSI_PARCOUNT = 0x00000006, + + /// + /// Slides - Number of slides. + /// + PIDDSI_SLIDECOUNT = 0x00000007, + + /// + /// Notes - Number of pages that contain notes. + /// + PIDDSI_NOTECOUNT = 0x00000008, + + /// + /// HiddenSlides - Number of slides that are hidden. + /// + PIDDSI_HIDDENCOUNT = 0x00000009, + + /// + /// MMClips - Number of sound or video clips. + /// + PIDDSI_MMCLIPCOUNT = 0x0000000A, + + /// + /// ScaleCrop - Set to True (-1) when scaling of the thumbnail + + /// is desired. If not set, cropping is desired. + /// + PIDDSI_SCALE = 0x0000000B, + + /// + /// HeadingPairs - Internally used property indicating the + /// grouping of different document parts and the number of + /// items in each group. The titles of the document parts are + /// stored in the TitlesofParts property. The HeadingPairs + /// property is stored as a vector of variants, in repeating + /// pairs of VT_LPSTR (or VT_LPWSTR) and VT_I4 values. The + /// VT_LPSTR value represents a heading name, and the VT_I4 + /// value indicates the count of document parts under that heading. + /// + PIDDSI_HEADINGPAIR = 0x0000000C, + + /// + /// TitlesofParts - Names of document parts. + /// + PIDDSI_DOCPARTS = 0x0000000D, + + /// + /// Manager - Manager of the project. + /// + PIDDSI_MANAGER = 0x0000000E, + + /// + /// Company - Company name. + /// + PIDDSI_COMPANY = 0x0000000F, + + /// + /// LinksUpToDate - Boolean value to indicate whether the custom + /// links are hampered by excessive noise, for all applications. + /// + PIDDSI_LINKSDIRTY = 0x00000010, + } + + /// + public enum VariantType : ushort + { + /// + /// The type of the contained field is undefined. When this flag is + /// specified, the VARIANT MUST NOT contain a data field. + /// + VT_EMPTY = 0x0000, + + /// + /// The type of the contained field is NULL. When this flag is + /// specified, the VARIANT MUST NOT contain a data field. + /// + VT_NULL = 0x0001, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be a 2-byte signed integer. + /// + VT_I2 = 0x0002, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be a 4-byte signed integer. + /// + VT_I4 = 0x0003, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be a 4-byte IEEE floating-point number. + /// + VT_R4 = 0x0004, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be an 8-byte IEEE floating-point number. + /// + VT_R8 = 0x0005, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be CURRENCY. + /// + VT_CY = 0x0006, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be DATE. + /// + VT_DATE = 0x0007, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be BSTR. + /// + VT_BSTR = 0x0008, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be a pointer to IDispatch. + /// + VT_DISPATCH = 0x0009, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be HRESULT. + /// + VT_ERROR = 0x000A, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be VARIANT_BOOL. + /// + VT_BOOL = 0x000B, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be VARIANT. It MUST appear with the bit flag VT_BYREF. + /// + VT_VARIANT = 0x000C, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be a pointer to IUnknown. + /// + VT_UNKNOWN = 0x000D, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be DECIMAL. + /// + VT_DECIMAL = 0x000E, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be a 1-byte integer. + /// + VT_I1 = 0x0010, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be a 1-byte unsigned integer. + /// + VT_UI1 = 0x0011, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be a 2-byte unsigned integer. + /// + VT_UI2 = 0x0012, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be a 4-byte unsigned integer. + /// + VT_UI4 = 0x0013, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be an 8-byte signed integer. + /// + VT_I8 = 0x0014, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be an 8-byte unsigned integer. + /// + VT_UI8 = 0x0015, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be a 4-byte signed integer. + /// + VT_INT = 0x0016, + + /// + /// Either the specified type, or the type of the element or contained + /// field MUST be a 4-byte unsigned integer. + /// + VT_UINT = 0x0017, + + /// + /// The specified type MUST be void. + /// + VT_VOID = 0x0018, + + /// + /// The specified type MUST be HRESULT. + /// + VT_HRESULT = 0x0019, + + /// + /// The specified type MUST be a unique pointer. + /// + VT_PTR = 0x001A, + + /// + /// The specified type MUST be SAFEARRAY. + /// + VT_SAFEARRAY = 0x001B, + + /// + /// The specified type MUST be a fixed-size array. + /// + VT_CARRAY = 0x001C, + + /// + /// The specified type MUST be user defined. + /// + VT_USERDEFINED = 0x001D, + + /// + /// The specified type MUST be a NULL-terminated string. + /// + VT_LPSTR = 0x001E, + + /// + /// The specified type MUST be a zero-terminated string of + /// UNICODE characters. + /// + VT_LPWSTR = 0x001F, + + /// + /// The type of the element or contained field MUST be a BRECORD. + /// + VT_RECORD = 0x0024, + + /// + /// The specified type MUST be either a 4-byte or an 8-byte signed + /// integer. The size of the integer is platform specific and + /// determines the system pointer size value. + /// + VT_INT_PTR = 0x0025, + + /// + /// The specified type MUST be either a 4 byte or an 8 byte unsigned + /// integer. The size of the integer is platform specific and + /// determines the system pointer size value + /// + VT_UINT_PTR = 0x0026, + + /// + /// The type of the element or contained field MUST be a SAFEARRAY. + /// + VT_ARRAY = 0x2000, + + /// + /// The type of the element or contained field MUST be a pointer to + /// one of the types listed in the previous rows of this table. If + /// present, this bit flag MUST appear in a VARIANT discriminant + /// with one of the previous flags. + /// + VT_BYREF = 0x4000 + } } \ No newline at end of file diff --git a/BurnOutSharp.Models/CFB/FileHeader.cs b/BurnOutSharp.Models/CFB/FileHeader.cs index a772ed98..05af97ed 100644 --- a/BurnOutSharp.Models/CFB/FileHeader.cs +++ b/BurnOutSharp.Models/CFB/FileHeader.cs @@ -6,7 +6,7 @@ namespace BurnOutSharp.Models.CFB public sealed class FileHeader { /// - /// IOdentification signature for the compound file structure, and MUST be + /// Iddentification signature for the compound file structure, and MUST be /// set to the value 0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1. /// public ulong Signature; diff --git a/BurnOutSharp.Models/CFB/SummaryInformation.cs b/BurnOutSharp.Models/CFB/SummaryInformation.cs new file mode 100644 index 00000000..8b8edba7 --- /dev/null +++ b/BurnOutSharp.Models/CFB/SummaryInformation.cs @@ -0,0 +1,46 @@ +using System; + +namespace BurnOutSharp.Models.CFB +{ + /// + public sealed class SummaryInformation + { + /// + /// This field MUST be set to 0xFFFE. This field is a byte order mark for + /// all integer fields, specifying little-endian byte order. + /// + public ushort ByteOrder; + + /// + /// 26 bytes of unknown data + /// + public byte[] Unknown1; + + /// + /// Format ID, should be + /// + public Guid FormatID; + + /// + /// 16 bytes of unknown data + /// + public byte[] Unknown2; + + /// + /// Location of the section + /// + public uint Offset; + + /// + /// Section count(?) + /// + public uint SectionCount; + + /// + /// Property count + /// + public uint PropertyCount; + + // Followed by an array of variants + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/CFB/Variant.cs b/BurnOutSharp.Models/CFB/Variant.cs new file mode 100644 index 00000000..94a151fe --- /dev/null +++ b/BurnOutSharp.Models/CFB/Variant.cs @@ -0,0 +1,45 @@ +namespace BurnOutSharp.Models.CFB +{ + /// + /// VARIANT is a container for a union that can hold many types of data. + /// + /// + public sealed class Variant + { + /// + /// MUST be set to the size, in quad words (64 bits), of the structure. + /// + public uint Size; + + /// + /// MUST be set to 0 and MUST be ignored by the recipient. + /// + public uint RpcReserved; + + /// + /// MUST be set to one of the values specified with a "V". + /// + public VariantType VariantType; + + /// + /// MAY be set to 0 and MUST be ignored by the recipient. + /// + public ushort Reserved1; + + /// + /// MAY be set to 0 and MUST be ignored by the recipient. + /// + public ushort Reserved2; + + /// + /// MAY be set to 0 and MUST be ignored by the recipient. + /// + public ushort Reserved3; + + /// + /// MUST contain an instance of the type, according to the value + /// in the field. + /// + public object Union; + } +} \ No newline at end of file