From db5c1dd657a495d9ff33b42b4f1d6c8f53c0fc00 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 14 Mar 2021 07:30:11 -0700 Subject: Extract data out of Core to minimize public surface area Part of wixtoolset/issues#6374 --- src/WixToolset.Data/Localization.cs | 4 +- .../Symbols/LockPermissionsSymbol.cs | 81 ++++++++++++++++++++++ src/WixToolset.Data/Symbols/PatchMetadataSymbol.cs | 31 ++++++++- src/WixToolset.Data/Symbols/UpgradeSymbol.cs | 23 ++++++ src/WixToolset.Data/Symbols/WixPatchIdSymbol.cs | 30 ++++++++ 5 files changed, 166 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/WixToolset.Data/Localization.cs b/src/WixToolset.Data/Localization.cs index ccc531f3..7ce765f4 100644 --- a/src/WixToolset.Data/Localization.cs +++ b/src/WixToolset.Data/Localization.cs @@ -12,8 +12,8 @@ namespace WixToolset.Data /// public sealed class Localization { - private Dictionary variables = new Dictionary(); - private Dictionary localizedControls = new Dictionary(); + private readonly Dictionary variables = new Dictionary(); + private readonly Dictionary localizedControls = new Dictionary(); /// /// Instantiates a new localization object. diff --git a/src/WixToolset.Data/Symbols/LockPermissionsSymbol.cs b/src/WixToolset.Data/Symbols/LockPermissionsSymbol.cs index 12562fd1..b9337446 100644 --- a/src/WixToolset.Data/Symbols/LockPermissionsSymbol.cs +++ b/src/WixToolset.Data/Symbols/LockPermissionsSymbol.cs @@ -31,6 +31,87 @@ namespace WixToolset.Data.Symbols Permission, } + /// + ///------------------------------------------------------------------------------------------------- + /// Layout of an Access Mask (from http://technet.microsoft.com/en-us/library/cc783530(WS.10).aspx) + /// + /// ------------------------------------------------------------------------------------------------- + /// |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| + /// ------------------------------------------------------------------------------------------------- + /// |GR|GW|GE|GA| Reserved |AS|StandardAccessRights| Object-Specific Access Rights | + /// + /// Key + /// GR = Generic Read + /// GW = Generic Write + /// GE = Generic Execute + /// GA = Generic All + /// AS = Right to access SACL + /// + public static class LockPermissionConstants + { + /// + /// Generic Access Rights (per WinNT.h) + /// --------------------- + /// GENERIC_ALL (0x10000000L) + /// GENERIC_EXECUTE (0x20000000L) + /// GENERIC_WRITE (0x40000000L) + /// GENERIC_READ (0x80000000L) + /// + public static readonly string[] GenericPermissions = { "GenericAll", "GenericExecute", "GenericWrite", "GenericRead" }; + + /// + /// Standard Access Rights (per WinNT.h) + /// ---------------------- + /// DELETE (0x00010000L) + /// READ_CONTROL (0x00020000L) + /// WRITE_DAC (0x00040000L) + /// WRITE_OWNER (0x00080000L) + /// SYNCHRONIZE (0x00100000L) + /// + public static readonly string[] StandardPermissions = { "Delete", "ReadPermission", "ChangePermission", "TakeOwnership", "Synchronize" }; + + /// + /// Object-Specific Access Rights + /// ============================= + /// Directory Access Rights (per WinNT.h) + /// ----------------------- + /// FILE_LIST_DIRECTORY ( 0x0001 ) + /// FILE_ADD_FILE ( 0x0002 ) + /// FILE_ADD_SUBDIRECTORY ( 0x0004 ) + /// FILE_READ_EA ( 0x0008 ) + /// FILE_WRITE_EA ( 0x0010 ) + /// FILE_TRAVERSE ( 0x0020 ) + /// FILE_DELETE_CHILD ( 0x0040 ) + /// FILE_READ_ATTRIBUTES ( 0x0080 ) + /// FILE_WRITE_ATTRIBUTES ( 0x0100 ) + /// + public static readonly string[] FolderPermissions = { "Read", "CreateFile", "CreateChild", "ReadExtendedAttributes", "WriteExtendedAttributes", "Traverse", "DeleteChild", "ReadAttributes", "WriteAttributes" }; + + /// + /// Registry Access Rights + /// ---------------------- + /// + public static readonly string[] RegistryPermissions = { "Read", "Write", "CreateSubkeys", "EnumerateSubkeys", "Notify", "CreateLink" }; + + /// + /// File Access Rights (per WinNT.h) + /// ------------------ + /// FILE_READ_DATA ( 0x0001 ) + /// FILE_WRITE_DATA ( 0x0002 ) + /// FILE_APPEND_DATA ( 0x0004 ) + /// FILE_READ_EA ( 0x0008 ) + /// FILE_WRITE_EA ( 0x0010 ) + /// FILE_EXECUTE ( 0x0020 ) + /// via mask FILE_ALL_ACCESS ( 0x0040 ) + /// FILE_READ_ATTRIBUTES ( 0x0080 ) + /// FILE_WRITE_ATTRIBUTES ( 0x0100 ) + /// + /// STANDARD_RIGHTS_REQUIRED (0x000F0000L) + /// FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF) + /// + public static readonly string[] FilePermissions = { "Read", "Write", "Append", "ReadExtendedAttributes", "WriteExtendedAttributes", "Execute", "FileAllRights", "ReadAttributes", "WriteAttributes" }; + } + public class LockPermissionsSymbol : IntermediateSymbol { public LockPermissionsSymbol() : base(SymbolDefinitions.LockPermissions, null, null) diff --git a/src/WixToolset.Data/Symbols/PatchMetadataSymbol.cs b/src/WixToolset.Data/Symbols/PatchMetadataSymbol.cs index 3f67aef7..201b8444 100644 --- a/src/WixToolset.Data/Symbols/PatchMetadataSymbol.cs +++ b/src/WixToolset.Data/Symbols/PatchMetadataSymbol.cs @@ -20,6 +20,8 @@ namespace WixToolset.Data namespace WixToolset.Data.Symbols { + using System; + public enum PatchMetadataSymbolFields { Company, @@ -27,6 +29,33 @@ namespace WixToolset.Data.Symbols Value, } + /// + /// Values for the OptimizeCA MsiPatchMetdata property, which indicates whether custom actions can be skipped when applying the patch. + /// + [Flags] + public enum OptimizeCAFlags + { + /// + /// No custom actions are skipped. + /// + None = 0, + + /// + /// Skip property (type 51) and directory (type 35) assignment custom actions. + /// + SkipAssignment = 1, + + /// + /// Skip immediate custom actions that are not property or directory assignment custom actions. + /// + SkipImmediate = 2, + + /// + /// Skip custom actions that run within the script. + /// + SkipDeferred = 4 + } + public class PatchMetadataSymbol : IntermediateSymbol { public PatchMetadataSymbol() : base(SymbolDefinitions.PatchMetadata, null, null) @@ -57,4 +86,4 @@ namespace WixToolset.Data.Symbols set => this.Set((int)PatchMetadataSymbolFields.Value, value); } } -} \ No newline at end of file +} diff --git a/src/WixToolset.Data/Symbols/UpgradeSymbol.cs b/src/WixToolset.Data/Symbols/UpgradeSymbol.cs index d8deee73..51eb74ef 100644 --- a/src/WixToolset.Data/Symbols/UpgradeSymbol.cs +++ b/src/WixToolset.Data/Symbols/UpgradeSymbol.cs @@ -45,6 +45,29 @@ namespace WixToolset.Data.Symbols ActionProperty, } + public static class WixUpgradeConstants + { + /// + /// Standard property for detecting upgrades. + /// + public const string UpgradeDetectedProperty = "WIX_UPGRADE_DETECTED"; + + /// + /// Standard condition to prevent upgrades. + /// + public const string UpgradePreventedCondition = "NOT WIX_UPGRADE_DETECTED"; + + /// + /// Standard property for downgrade detected. + /// + public const string DowngradeDetectedProperty = "WIX_DOWNGRADE_DETECTED"; + + /// + /// Standard condition to prevent downgrades. + /// + public const string DowngradePreventedCondition = "NOT WIX_DOWNGRADE_DETECTED"; + } + public class UpgradeSymbol : IntermediateSymbol { public UpgradeSymbol() : base(SymbolDefinitions.Upgrade, null, null) diff --git a/src/WixToolset.Data/Symbols/WixPatchIdSymbol.cs b/src/WixToolset.Data/Symbols/WixPatchIdSymbol.cs index c4f4324d..344fc058 100644 --- a/src/WixToolset.Data/Symbols/WixPatchIdSymbol.cs +++ b/src/WixToolset.Data/Symbols/WixPatchIdSymbol.cs @@ -20,6 +20,8 @@ namespace WixToolset.Data namespace WixToolset.Data.Symbols { + using System; + public enum WixPatchIdSymbolFields { ClientPatchId, @@ -27,6 +29,34 @@ namespace WixToolset.Data.Symbols ApiPatchingSymbolFlags, } + /// + /// The following flags are used with PATCH_OPTION_DATA SymbolOptionFlags: + /// + [Flags] + [CLSCompliant(false)] + public enum PatchSymbolFlags : uint + { + /// + /// Don't use imagehlp.dll + /// + PatchSymbolNoImagehlp = 0x00000001, + + /// + /// Don't fail patch due to imagehlp failures. + /// + PatchSymbolNoFailures = 0x00000002, + + /// + /// After matching decorated symbols, try to match remaining by undecorated names. + /// + PatchSymbolUndecoratedToo = 0x00000004, + + /// + /// (used internally) + /// + PatchSymbolReserved = 0x80000000, + } + public class WixPatchIdSymbol : IntermediateSymbol { public WixPatchIdSymbol() : base(SymbolDefinitions.WixPatchId, null, null) -- cgit v1.2.3-55-g6feb