aboutsummaryrefslogtreecommitdiff
path: root/src/ext/Util/wixext/UtilCompiler.cs
diff options
context:
space:
mode:
authorRon Martin <cpuwzd@comcast.net>2022-08-29 18:38:07 -0400
committerRob Mensching <rob@firegiant.com>2022-10-21 19:08:08 -0700
commit08cdc6aa2b9dd0e273a3c3a22893616d26342a0e (patch)
tree1d0b9f7e21cec02abfda50b1a3c6d0c24308998b /src/ext/Util/wixext/UtilCompiler.cs
parent40bd65379768f99ec28bffe2691ba43c78c9e9c4 (diff)
downloadwix-08cdc6aa2b9dd0e273a3c3a22893616d26342a0e.tar.gz
wix-08cdc6aa2b9dd0e273a3c3a22893616d26342a0e.tar.bz2
wix-08cdc6aa2b9dd0e273a3c3a22893616d26342a0e.zip
Support add, modify and remove comments on user accounts
Fixes 5371
Diffstat (limited to 'src/ext/Util/wixext/UtilCompiler.cs')
-rw-r--r--src/ext/Util/wixext/UtilCompiler.cs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/ext/Util/wixext/UtilCompiler.cs b/src/ext/Util/wixext/UtilCompiler.cs
index a6e4b835..d937b4f1 100644
--- a/src/ext/Util/wixext/UtilCompiler.cs
+++ b/src/ext/Util/wixext/UtilCompiler.cs
@@ -34,6 +34,7 @@ namespace WixToolset.Util
34 internal const int UserDontRemoveOnUninstall = 0x00000100; 34 internal const int UserDontRemoveOnUninstall = 0x00000100;
35 internal const int UserDontCreateUser = 0x00000200; 35 internal const int UserDontCreateUser = 0x00000200;
36 internal const int UserNonVital = 0x00000400; 36 internal const int UserNonVital = 0x00000400;
37 internal const int UserRemoveComment = 0x00000800;
37 38
38 private static readonly Regex FindPropertyBrackets = new Regex(@"\[(?!\\|\])|(?<!\[\\\]|\[\\|\\\[)\]", RegexOptions.ExplicitCapture | RegexOptions.Compiled); 39 private static readonly Regex FindPropertyBrackets = new Regex(@"\[(?!\\|\])|(?<!\[\\\]|\[\\|\\\[)\]", RegexOptions.ExplicitCapture | RegexOptions.Compiled);
39 40
@@ -3251,6 +3252,7 @@ namespace WixToolset.Util
3251 int attributes = 0; 3252 int attributes = 0;
3252 string domain = null; 3253 string domain = null;
3253 string name = null; 3254 string name = null;
3255 string comment = null;
3254 string password = null; 3256 string password = null;
3255 3257
3256 foreach (var attrib in element.Attributes()) 3258 foreach (var attrib in element.Attributes())
@@ -3273,6 +3275,14 @@ namespace WixToolset.Util
3273 attributes |= UserPasswdCantChange; 3275 attributes |= UserPasswdCantChange;
3274 } 3276 }
3275 break; 3277 break;
3278 case "Comment":
3279 if (null == componentId)
3280 {
3281 this.Messaging.Write(UtilErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName));
3282 }
3283
3284 comment = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
3285 break;
3276 case "CreateUser": 3286 case "CreateUser":
3277 if (null == componentId) 3287 if (null == componentId)
3278 { 3288 {
@@ -3357,6 +3367,12 @@ namespace WixToolset.Util
3357 attributes |= UserDontExpirePasswrd; 3367 attributes |= UserDontExpirePasswrd;
3358 } 3368 }
3359 break; 3369 break;
3370 case "RemoveComment":
3371 if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
3372 {
3373 attributes |= UserRemoveComment;
3374 }
3375 break;
3360 case "RemoveOnUninstall": 3376 case "RemoveOnUninstall":
3361 if (null == componentId) 3377 if (null == componentId)
3362 { 3378 {
@@ -3411,6 +3427,11 @@ namespace WixToolset.Util
3411 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Name")); 3427 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Name"));
3412 } 3428 }
3413 3429
3430 if (null != comment && (UserRemoveComment & attributes) != 0)
3431 {
3432 this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, element.Name.LocalName, "Comment", "RemoveComment"));
3433 }
3434
3414 foreach (var child in element.Elements()) 3435 foreach (var child in element.Elements())
3415 { 3436 {
3416 if (this.Namespace == child.Name.Namespace) 3437 if (this.Namespace == child.Name.Namespace)
@@ -3450,6 +3471,7 @@ namespace WixToolset.Util
3450 Name = name, 3471 Name = name,
3451 Domain = domain, 3472 Domain = domain,
3452 Password = password, 3473 Password = password,
3474 Comment = comment,
3453 Attributes = attributes, 3475 Attributes = attributes,
3454 }); 3476 });
3455 } 3477 }