@joebigelow / wix / commits / db5c1dd6

Extract data out of Core to minimize public surface area

Part of wixtoolset/issues#6374

Rob Mensching committed Mar 14, 2021 at 07:30 UTC db5c1dd657a495d9ff33b42b4f1d6c8f53c0fc00
5 files changed +166 -3
src/WixToolset.Data/Localization.cs
+2 -2
@@ -12,8 +12,8 @@ namespace WixToolset.Data
12 /// </summary>
13 public sealed class Localization
14 {
15 - private Dictionary<string, BindVariable> variables = new Dictionary<string, BindVariable>();
16 - private Dictionary<string, LocalizedControl> localizedControls = new Dictionary<string, LocalizedControl>();
15 + private readonly Dictionary<string, BindVariable> variables = new Dictionary<string, BindVariable>();
16 + private readonly Dictionary<string, LocalizedControl> localizedControls = new Dictionary<string, LocalizedControl>();
17
18 /// <summary>
19 /// Instantiates a new localization object.
src/WixToolset.Data/Symbols/LockPermissionsSymbol.cs
+81
@@ -31,6 +31,87 @@ namespace WixToolset.Data.Symbols
31 Permission,
32 }
33
34 + /// <summary>
35 + ///-------------------------------------------------------------------------------------------------
36 + /// Layout of an Access Mask (from http://technet.microsoft.com/en-us/library/cc783530(WS.10).aspx)
37 + ///
38 + /// -------------------------------------------------------------------------------------------------
39 + /// |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|09|08|07|06|05|04|03|02|01|00|
40 + /// -------------------------------------------------------------------------------------------------
41 + /// |GR|GW|GE|GA| Reserved |AS|StandardAccessRights| Object-Specific Access Rights |
42 + ///
43 + /// Key
44 + /// GR = Generic Read
45 + /// GW = Generic Write
46 + /// GE = Generic Execute
47 + /// GA = Generic All
48 + /// AS = Right to access SACL
49 + /// </summary>
50 + public static class LockPermissionConstants
51 + {
52 + /// <summary>
53 + /// Generic Access Rights (per WinNT.h)
54 + /// ---------------------
55 + /// GENERIC_ALL (0x10000000L)
56 + /// GENERIC_EXECUTE (0x20000000L)
57 + /// GENERIC_WRITE (0x40000000L)
58 + /// GENERIC_READ (0x80000000L)
59 + /// </summary>
60 + public static readonly string[] GenericPermissions = { "GenericAll", "GenericExecute", "GenericWrite", "GenericRead" };
61 +
62 + /// <summary>
63 + /// Standard Access Rights (per WinNT.h)
64 + /// ----------------------
65 + /// DELETE (0x00010000L)
66 + /// READ_CONTROL (0x00020000L)
67 + /// WRITE_DAC (0x00040000L)
68 + /// WRITE_OWNER (0x00080000L)
69 + /// SYNCHRONIZE (0x00100000L)
70 + /// </summary>
71 + public static readonly string[] StandardPermissions = { "Delete", "ReadPermission", "ChangePermission", "TakeOwnership", "Synchronize" };
72 +
73 + /// <summary>
74 + /// Object-Specific Access Rights
75 + /// =============================
76 + /// Directory Access Rights (per WinNT.h)
77 + /// -----------------------
78 + /// FILE_LIST_DIRECTORY ( 0x0001 )
79 + /// FILE_ADD_FILE ( 0x0002 )
80 + /// FILE_ADD_SUBDIRECTORY ( 0x0004 )
81 + /// FILE_READ_EA ( 0x0008 )
82 + /// FILE_WRITE_EA ( 0x0010 )
83 + /// FILE_TRAVERSE ( 0x0020 )
84 + /// FILE_DELETE_CHILD ( 0x0040 )
85 + /// FILE_READ_ATTRIBUTES ( 0x0080 )
86 + /// FILE_WRITE_ATTRIBUTES ( 0x0100 )
87 + /// </summary>
88 + public static readonly string[] FolderPermissions = { "Read", "CreateFile", "CreateChild", "ReadExtendedAttributes", "WriteExtendedAttributes", "Traverse", "DeleteChild", "ReadAttributes", "WriteAttributes" };
89 +
90 + /// <summary>
91 + /// Registry Access Rights
92 + /// ----------------------
93 + /// </summary>
94 + public static readonly string[] RegistryPermissions = { "Read", "Write", "CreateSubkeys", "EnumerateSubkeys", "Notify", "CreateLink" };
95 +
96 + /// <summary>
97 + /// File Access Rights (per WinNT.h)
98 + /// ------------------
99 + /// FILE_READ_DATA ( 0x0001 )
100 + /// FILE_WRITE_DATA ( 0x0002 )
101 + /// FILE_APPEND_DATA ( 0x0004 )
102 + /// FILE_READ_EA ( 0x0008 )
103 + /// FILE_WRITE_EA ( 0x0010 )
104 + /// FILE_EXECUTE ( 0x0020 )
105 + /// via mask FILE_ALL_ACCESS ( 0x0040 )
106 + /// FILE_READ_ATTRIBUTES ( 0x0080 )
107 + /// FILE_WRITE_ATTRIBUTES ( 0x0100 )
108 + ///
109 + /// STANDARD_RIGHTS_REQUIRED (0x000F0000L)
110 + /// FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF)
111 + /// </summary>
112 + public static readonly string[] FilePermissions = { "Read", "Write", "Append", "ReadExtendedAttributes", "WriteExtendedAttributes", "Execute", "FileAllRights", "ReadAttributes", "WriteAttributes" };
113 + }
114 +
115 public class LockPermissionsSymbol : IntermediateSymbol
116 {
117 public LockPermissionsSymbol() : base(SymbolDefinitions.LockPermissions, null, null)
src/WixToolset.Data/Symbols/PatchMetadataSymbol.cs
+30 -1
@@ -20,6 +20,8 @@ namespace WixToolset.Data
20
21 namespace WixToolset.Data.Symbols
22 {
23 + using System;
24 +
25 public enum PatchMetadataSymbolFields
26 {
27 Company,
@@ -27,6 +29,33 @@ namespace WixToolset.Data.Symbols
29 Value,
30 }
31
32 + /// <summary>
33 + /// Values for the OptimizeCA MsiPatchMetdata property, which indicates whether custom actions can be skipped when applying the patch.
34 + /// </summary>
35 + [Flags]
36 + public enum OptimizeCAFlags
37 + {
38 + /// <summary>
39 + /// No custom actions are skipped.
40 + /// </summary>
41 + None = 0,
42 +
43 + /// <summary>
44 + /// Skip property (type 51) and directory (type 35) assignment custom actions.
45 + /// </summary>
46 + SkipAssignment = 1,
47 +
48 + /// <summary>
49 + /// Skip immediate custom actions that are not property or directory assignment custom actions.
50 + /// </summary>
51 + SkipImmediate = 2,
52 +
53 + /// <summary>
54 + /// Skip custom actions that run within the script.
55 + /// </summary>
56 + SkipDeferred = 4
57 + }
58 +
59 public class PatchMetadataSymbol : IntermediateSymbol
60 {
61 public PatchMetadataSymbol() : base(SymbolDefinitions.PatchMetadata, null, null)
@@ -57,4 +86,4 @@ namespace WixToolset.Data.Symbols
86 set => this.Set((int)PatchMetadataSymbolFields.Value, value);
87 }
88 }
60 -}
\ No newline at end of file
89 +}
src/WixToolset.Data/Symbols/UpgradeSymbol.cs
+23
@@ -45,6 +45,29 @@ namespace WixToolset.Data.Symbols
45 ActionProperty,
46 }
47
48 + public static class WixUpgradeConstants
49 + {
50 + /// <summary>
51 + /// Standard property for detecting upgrades.
52 + /// </summary>
53 + public const string UpgradeDetectedProperty = "WIX_UPGRADE_DETECTED";
54 +
55 + /// <summary>
56 + /// Standard condition to prevent upgrades.
57 + /// </summary>
58 + public const string UpgradePreventedCondition = "NOT WIX_UPGRADE_DETECTED";
59 +
60 + /// <summary>
61 + /// Standard property for downgrade detected.
62 + /// </summary>
63 + public const string DowngradeDetectedProperty = "WIX_DOWNGRADE_DETECTED";
64 +
65 + /// <summary>
66 + /// Standard condition to prevent downgrades.
67 + /// </summary>
68 + public const string DowngradePreventedCondition = "NOT WIX_DOWNGRADE_DETECTED";
69 + }
70 +
71 public class UpgradeSymbol : IntermediateSymbol
72 {
73 public UpgradeSymbol() : base(SymbolDefinitions.Upgrade, null, null)
src/WixToolset.Data/Symbols/WixPatchIdSymbol.cs
+30
@@ -20,6 +20,8 @@ namespace WixToolset.Data
20
21 namespace WixToolset.Data.Symbols
22 {
23 + using System;
24 +
25 public enum WixPatchIdSymbolFields
26 {
27 ClientPatchId,
@@ -27,6 +29,34 @@ namespace WixToolset.Data.Symbols
29 ApiPatchingSymbolFlags,
30 }
31
32 + /// <summary>
33 + /// The following flags are used with PATCH_OPTION_DATA SymbolOptionFlags:
34 + /// </summary>
35 + [Flags]
36 + [CLSCompliant(false)]
37 + public enum PatchSymbolFlags : uint
38 + {
39 + /// <summary>
40 + /// Don't use imagehlp.dll
41 + /// </summary>
42 + PatchSymbolNoImagehlp = 0x00000001,
43 +
44 + /// <summary>
45 + /// Don't fail patch due to imagehlp failures.
46 + /// </summary>
47 + PatchSymbolNoFailures = 0x00000002,
48 +
49 + /// <summary>
50 + /// After matching decorated symbols, try to match remaining by undecorated names.
51 + /// </summary>
52 + PatchSymbolUndecoratedToo = 0x00000004,
53 +
54 + /// <summary>
55 + /// (used internally)
56 + /// </summary>
57 + PatchSymbolReserved = 0x80000000,
58 + }
59 +
60 public class WixPatchIdSymbol : IntermediateSymbol
61 {
62 public WixPatchIdSymbol() : base(SymbolDefinitions.WixPatchId, null, null)