Move SecureObj attributes to symbol
Rob Mensching committed
Apr 11, 2021 at 12:20 UTC
e1c4d762286bcdd58c2fdac4098c9a5846398920
2 files changed
+16
-13
src/wixext/Symbols/SecureObjectsSymbol.cs
+11
-3
@@ -25,6 +25,7 @@ namespace WixToolset.Util
25
26
namespace WixToolset.Util.Symbols
27
{
28
+ using System;
29
using WixToolset.Data;
30
31
public enum SecureObjectsSymbolFields
@@ -38,6 +39,13 @@ namespace WixToolset.Util.Symbols
39
ComponentRef,
40
}
41
42
+ [Flags]
43
+ public enum WixPermissionExAttributes
44
+ {
45
+ None = 0x0,
46
+ Inheritable = 0x01
47
+ }
48
+
49
public class SecureObjectsSymbol : IntermediateSymbol
50
{
51
public SecureObjectsSymbol() : base(UtilSymbolDefinitions.SecureObjects, null, null)
@@ -74,10 +82,10 @@ namespace WixToolset.Util.Symbols
82
set => this.Set((int)SecureObjectsSymbolFields.User, value);
83
}
84
77
- public int Attributes
85
+ public WixPermissionExAttributes Attributes
86
{
79
- get => this.Fields[(int)SecureObjectsSymbolFields.Attributes].AsNumber();
80
- set => this.Set((int)SecureObjectsSymbolFields.Attributes, value);
87
+ get => (WixPermissionExAttributes)this.Fields[(int)SecureObjectsSymbolFields.Attributes].AsNumber();
88
+ set => this.Set((int)SecureObjectsSymbolFields.Attributes, (int)value);
89
}
90
91
public int? Permission
src/wixext/UtilCompiler.cs
+5
-10
@@ -49,11 +49,6 @@ namespace WixToolset.Util
49
TypeMask = 0xf,
50
}
51
52
- internal enum WixPermissionExAttributes
53
- {
54
- Inheritable = 0x01
55
- }
56
-
52
internal enum WixRemoveFolderExOn
53
{
54
Install = 1,
@@ -2465,8 +2460,7 @@ namespace WixToolset.Util
2460
string domain = null;
2461
string[] specialPermissions = null;
2462
string user = null;
2468
- var inheritable = YesNoType.NotSet;
2469
- int attributes = 0;
2463
+ var attributes = WixPermissionExAttributes.Inheritable; // default to inheritable.
2464
2465
var permissionType = PermissionType.SecureObjects;
2466
@@ -2508,7 +2502,10 @@ namespace WixToolset.Util
2502
domain = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
2503
break;
2504
case "Inheritable":
2511
- inheritable = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib);
2505
+ if (this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib) == YesNoType.No)
2506
+ {
2507
+ attributes &= ~WixPermissionExAttributes.Inheritable;
2508
+ }
2509
break;
2510
case "User":
2511
user = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
@@ -2547,8 +2544,6 @@ namespace WixToolset.Util
2544
this.Messaging.Write(ErrorMessages.GenericReadNotAllowed(sourceLineNumbers));
2545
}
2546
2550
- attributes |= inheritable == YesNoType.No ? 0 : (int)WixPermissionExAttributes.Inheritable; // default to inheritable.
2551
-
2547
this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
2548
2549
if (!this.Messaging.EncounteredError)