ms_oforms/common/
mod.rs

1pub mod parser;
2
3use std::fmt::{Debug, Formatter, Error as FmtError};
4
5#[derive(Copy, Clone, PartialEq, Eq)]
6pub struct GUID(pub u32, pub u16, pub u16, pub u64);
7
8impl GUID {
9    pub const EMPTY         : Self = Self(0,0,0,0);
10    /// {0BE35203-8F91-11CE-9DE3-00AA004BB851}
11    pub const STD_FONT      : Self = Self(0x0352E30B, 0x918F, 0xCE11, 0x51B84B00AA00E39D);
12    /// {AFC20920-DA4E-11CE-B943-00AA006887B4}
13    pub const TEXT_PROPS    : Self = Self(0x2009C2AF, 0x4EDA, 0xCE11, 0xB4876800AA0043B9);
14    /// {0BE35204-8F91-11CE-9DE3-00AA004BB851}
15    pub const STD_PICTURE   : Self = Self(0x0452E30B, 0x918F, 0xCE11, 0x51B84B00AA00E39D);
16    /// What is this font?
17    pub const WTF_FONT      : Self = Self(0x105B80DE, 0x95F1, 0x11D0, 0x5CCBBD00AA00A0B0);
18    /// {00020400-0000-0000-C000-000000000046}
19    pub const DEFAULT       : Self = Self(0x00020400, 0x0000, 0x0000, 0x000000000046C000);
20}
21
22impl Debug for GUID {
23    fn fmt<'a>(&self, fmt: &mut Formatter<'a>) -> Result<(), FmtError> {
24        write!(fmt, "{{{:x}-{:x}-{:x}-{:x}}}", self.0, self.1, self.2, self.3)
25    }
26}
27
28bitflags! {
29    /// ## [MS-OAUT] VARFLAGS
30    ///
31    /// The VARFLAGS enumeration values are used in the wVarFlags field of a VARDESC to specify the
32    /// features of a field, constant, or ODL dispinterface property, as specified in section 2.2.43.
33    pub struct VarFlags: u16 {
34        /// MUST be set if the variable is an ODL dispinterface property that was declared with the [readonly] attribute (see section 2.2.49.5.3).
35        const READONLY = 0x1;
36        /// MUST be set if the variable is a property member of an ODL interface that was declared with the [source] attribute (see section 2.2.49.8).
37        const SOURCE = 0x2;
38        /// MUST be set if the variable is an ODL dispinterface property that was declared with the [bindable] attribute (see section 2.2.49.5.2).
39        const BINDABLE = 0x4;
40        /// MUST be set if the variable is an ODL dispinterface property that was declared with the [requestedit] attribute (see section 2.2.49.5.2).
41        const REQUEST_EDIT = 0x8;
42        /// MUST be set if the variable is an ODL dispinterface property that was declared with the [displaybind] attribute (see section 2.2.49.5.2).
43        const DISPLAY_BIND = 0x10;
44        /// MUST be set if the variable is an ODL dispinterface property that was declared with the [defaultbind] attribute (see section 2.2.49.5.2).
45        const DEFAULT_BIND = 0x20;
46        /// MUST be set if the variable is a member of a type that was declared with the [hidden] attribute (see section 2.2.49.5.1).
47        const HIDDEN = 0x40;
48        /// MUST be set if the variable is a member of a type that was declared with the [restricted] attribute (see section 2.2.49.5.1).
49        const RESTRICTED = 0x80;
50        /// MUST be set if the variable is an ODL dispinterface property that was declared with the [defaultcollelem] attribute (see section 2.2.49.5.1).
51        const DEFAULT_COLL_ELEM = 0x100;
52        /// MUST be set if the variable is an ODL dispinterface property that was declared with the [uidefault] attribute (see section 2.2.49.5.1).
53        const UI_DEFAULT = 0x200;
54        /// MUST be set if the variable is an ODL dispinterface property that was declared with the [nonbrowsable] attribute (see section 2.2.49.5.1).
55        const NON_BROWSABLE = 0x400;
56        /// MUST be set if the variable is an ODL dispinterface property that was declared with the [replaceable] attribute (see section 2.2.49.5.1). MUST be ignored on receipt.
57        const REPLACEABLE = 0x800;
58        /// MUST be set if the variable is an ODL dispinterface property that was declared with the [immediatebind] attribute (see section 2.2.49.5.2).
59        const IMMEDIATE_BIND = 0x1000;
60    }
61}
62
63#[repr(u16)]
64#[derive(Debug, FromPrimitive, ToPrimitive, PartialEq, Eq)]
65pub enum VarType {
66    Empty = 0x0000,
67    Null = 0x0001,
68    I2 = 0x0002,
69    I4 = 0x0003,
70    R4 = 0x0004,
71    R8 = 0x0005,
72    Cy = 0x0006,
73    Date = 0x0007,
74    BStr = 0x0008,
75    Dispatch = 0x0009,
76    Error = 0x000A,
77    Bool = 0x000B,
78    Variant = 0x000C,
79    Unknown = 0x000D,
80    Decimal = 0x000E,
81    I1 = 0x0010,
82    UI1 = 0x0011,
83    UI2 = 0x0012,
84    UI4 = 0x0013,
85    I8 = 0x0014,
86    UI8 = 0x0015,
87    Int = 0x0016,
88    UInt = 0x0017,
89    Void = 0x0018,
90    HResult = 0x0019,
91    Ptr = 0x001A,
92    Safearray = 0x001B,
93    CArray = 0x001C,
94    UserDefined = 0x001D,
95    LPStr = 0x001E,
96    LPWStr = 0x001F,
97    Record = 0x0024,
98    IntPtr = 0x0025,
99    UIntPtr = 0x0026,
100    Array = 0x2000,
101    ByRef = 0x4000,
102}