From 0fcd544b7d2fbdf37227df055122b17428d9a524 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Thu, 21 Jul 2022 15:45:16 -0500 Subject: Expose and use methods to parse attributes with Burn variable names. Fixes 6819 --- src/api/wix/WixToolset.Data/ErrorMessages.cs | 5 +++++ .../WixToolset.Data/Symbols/WixBundleVariableSymbol.cs | 17 +++++++++++++++++ .../Services/IBundleValidator.cs | 3 ++- .../WixToolset.Extensibility/Services/IParseHelper.cs | 16 ++++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) (limited to 'src/api') diff --git a/src/api/wix/WixToolset.Data/ErrorMessages.cs b/src/api/wix/WixToolset.Data/ErrorMessages.cs index c28812f7..4826e7c9 100644 --- a/src/api/wix/WixToolset.Data/ErrorMessages.cs +++ b/src/api/wix/WixToolset.Data/ErrorMessages.cs @@ -1804,6 +1804,11 @@ namespace WixToolset.Data return Message(sourceLineNumbers, Ids.RelativePathForRegistryElement, "Cannot convert RelativePath into Registry elements."); } + public static Message ReservedBurnNamespaceViolation(SourceLineNumber sourceLineNumbers, string element, string attribute, string prefix) + { + return Message(sourceLineNumbers, Ids.ReservedNamespaceViolation, "The {0}/@{1} attribute's value begins with the reserved prefix '{2}'. Some prefixes are reserved by the WiX toolset for well-known values. Change your attribute's value to not begin with the same prefix.", element, attribute, prefix); + } + public static Message ReservedNamespaceViolation(SourceLineNumber sourceLineNumbers, string element, string attribute, string prefix) { return Message(sourceLineNumbers, Ids.ReservedNamespaceViolation, "The {0}/@{1} attribute's value begins with the reserved prefix '{2}'. Some prefixes are reserved by the Windows Installer and WiX toolset for well-known values. Change your attribute's value to not begin with the same prefix.", element, attribute, prefix); diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundleVariableSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundleVariableSymbol.cs index b8a1923d..ea49da8d 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundleVariableSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundleVariableSymbol.cs @@ -35,6 +35,7 @@ namespace WixToolset.Data.Symbols None = 0x0, Hidden = 0x1, Persisted = 0x2, + BuiltIn = 0x4, } public enum WixBundleVariableType @@ -107,5 +108,21 @@ namespace WixToolset.Data.Symbols } } } + + public bool BuiltIn + { + get { return this.Attributes.HasFlag(WixBundleVariableAttributes.BuiltIn); } + set + { + if (value) + { + this.Attributes |= WixBundleVariableAttributes.BuiltIn; + } + else + { + this.Attributes &= ~WixBundleVariableAttributes.BuiltIn; + } + } + } } } diff --git a/src/api/wix/WixToolset.Extensibility/Services/IBundleValidator.cs b/src/api/wix/WixToolset.Extensibility/Services/IBundleValidator.cs index fc88a443..43f65fc8 100644 --- a/src/api/wix/WixToolset.Extensibility/Services/IBundleValidator.cs +++ b/src/api/wix/WixToolset.Extensibility/Services/IBundleValidator.cs @@ -39,8 +39,9 @@ namespace WixToolset.Extensibility.Services /// /// /// + /// Whether to bypass checks for reserved values. /// Whether the name is valid. - bool ValidateBundleVariableName(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName); + bool ValidateBundleVariableName(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName, bool allowBuiltIn); /// /// Validates a bundle condition and displays an error for an illegal value. diff --git a/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs b/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs index 546a43a7..a8246b9b 100644 --- a/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs +++ b/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs @@ -233,6 +233,22 @@ namespace WixToolset.Extensibility.Services /// The attribute's value. string GetAttributeValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, EmptyRule emptyRule = EmptyRule.CanBeWhitespaceOnly); + /// + /// Gets a bundle variable name identifier and displays an error for an illegal value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The attribute's identifier value or a special value if an error occurred. + Identifier GetAttributeBundleVariableNameIdentifier(SourceLineNumber sourceLineNumbers, XAttribute attribute); + + /// + /// Gets a bundle variable name value and displays an error for an illegal value. + /// + /// Source line information about the owner element. + /// The attribute containing the value to get. + /// The attribute's value. + string GetAttributeBundleVariableNameValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); + /// /// Get a guid attribute value and displays an error for an illegal guid value. /// -- cgit v1.2.3-55-g6feb