From e1c4d762286bcdd58c2fdac4098c9a5846398920 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 11 Apr 2021 12:20:10 -0700 Subject: Move SecureObj attributes to symbol --- src/wixext/Symbols/SecureObjectsSymbol.cs | 14 +++++++++++--- src/wixext/UtilCompiler.cs | 15 +++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/wixext/Symbols/SecureObjectsSymbol.cs b/src/wixext/Symbols/SecureObjectsSymbol.cs index b90df521..25fc6dca 100644 --- a/src/wixext/Symbols/SecureObjectsSymbol.cs +++ b/src/wixext/Symbols/SecureObjectsSymbol.cs @@ -25,6 +25,7 @@ namespace WixToolset.Util namespace WixToolset.Util.Symbols { + using System; using WixToolset.Data; public enum SecureObjectsSymbolFields @@ -38,6 +39,13 @@ namespace WixToolset.Util.Symbols ComponentRef, } + [Flags] + public enum WixPermissionExAttributes + { + None = 0x0, + Inheritable = 0x01 + } + public class SecureObjectsSymbol : IntermediateSymbol { public SecureObjectsSymbol() : base(UtilSymbolDefinitions.SecureObjects, null, null) @@ -74,10 +82,10 @@ namespace WixToolset.Util.Symbols set => this.Set((int)SecureObjectsSymbolFields.User, value); } - public int Attributes + public WixPermissionExAttributes Attributes { - get => this.Fields[(int)SecureObjectsSymbolFields.Attributes].AsNumber(); - set => this.Set((int)SecureObjectsSymbolFields.Attributes, value); + get => (WixPermissionExAttributes)this.Fields[(int)SecureObjectsSymbolFields.Attributes].AsNumber(); + set => this.Set((int)SecureObjectsSymbolFields.Attributes, (int)value); } public int? Permission diff --git a/src/wixext/UtilCompiler.cs b/src/wixext/UtilCompiler.cs index f1faf4a8..c0312f48 100644 --- a/src/wixext/UtilCompiler.cs +++ b/src/wixext/UtilCompiler.cs @@ -49,11 +49,6 @@ namespace WixToolset.Util TypeMask = 0xf, } - internal enum WixPermissionExAttributes - { - Inheritable = 0x01 - } - internal enum WixRemoveFolderExOn { Install = 1, @@ -2465,8 +2460,7 @@ namespace WixToolset.Util string domain = null; string[] specialPermissions = null; string user = null; - var inheritable = YesNoType.NotSet; - int attributes = 0; + var attributes = WixPermissionExAttributes.Inheritable; // default to inheritable. var permissionType = PermissionType.SecureObjects; @@ -2508,7 +2502,10 @@ namespace WixToolset.Util domain = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); break; case "Inheritable": - inheritable = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); + if (this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib) == YesNoType.No) + { + attributes &= ~WixPermissionExAttributes.Inheritable; + } break; case "User": user = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); @@ -2547,8 +2544,6 @@ namespace WixToolset.Util this.Messaging.Write(ErrorMessages.GenericReadNotAllowed(sourceLineNumbers)); } - attributes |= inheritable == YesNoType.No ? 0 : (int)WixPermissionExAttributes.Inheritable; // default to inheritable. - this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); if (!this.Messaging.EncounteredError) -- cgit v1.2.3-55-g6feb