Skip to content

Commit

Permalink
Fix Profile column definition.
Browse files Browse the repository at this point in the history
It's a formatted field but was too short.

Fixes wixtoolset/issues#8043.
  • Loading branch information
barnson committed Mar 18, 2024
1 parent 3b842ae commit db7727a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ private static AttributeVerifier BuildAndDecompileAndBuild(string nameSpace, str
var build = new Builder(folder, typeof(FirewallExtensionFactory), new[] { folder });
var output = Path.Combine(folder, $"Firewall{ruleName}.xml");

build.BuildAndDecompileAndBuild(Build, Decompile, output);
build.BuildAndDecompileAndBuild(Build, Decompile, output, validate: true);

var doc = XDocument.Load(output);
var actual = doc.Descendants()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="FirewallComponent" Guid="28DF3387-F30E-4DBE-90E2-D2C760CB4DD9">
<File Source="$(sys.SOURCEFILEPATH)" />
<fw:FirewallException
Name="[NAME]"
Port="[LOCALPORT]"
Expand Down Expand Up @@ -31,8 +32,8 @@
/>

<fw:FirewallException Name="Single Nested properties" >
<fw:RemoteAddress Value="[REMOTEADDRESS]" />
<fw:LocalAddress Value="[LOCALADDRESS]" />
<fw:RemoteAddress Value="[REMOTEADDRESS]" />
<fw:LocalAddress Value="[LOCALADDRESS]" />
<fw:InterfaceType Value="[INTERFACETYPE]" />
<fw:Interface Name="[INTERFACE]" />
</fw:FirewallException>
Expand Down
4 changes: 2 additions & 2 deletions src/ext/Firewall/wixext/FirewallTableDefinitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public static class FirewallTableDefinitions
new ColumnDefinition("Protocol", ColumnType.String, 0, primaryKey: false, nullable: true, ColumnCategory.Formatted, minValue: 0, maxValue: 255, description: "Protocol (6=TCP; 17=UDP). https://www.iana.org/assignments/protocol-numbers", modularizeType: ColumnModularizeType.Property),
new ColumnDefinition("Program", ColumnType.String, 255, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "Exception for a program (formatted path name).", modularizeType: ColumnModularizeType.Property),
new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: true, ColumnCategory.Unknown, description: "Vital=1; IgnoreUpdates=2; EnableOnChange=4; INetFwRule2=8; INetFwRule3=16"),
new ColumnDefinition("Profile", ColumnType.String, 4, primaryKey: false, nullable: true, ColumnCategory.Formatted, minValue: 1, maxValue: 2147483647, description: "Profile (1=domain; 2=private; 4=public; 2147483647=all).", modularizeType: ColumnModularizeType.Property),
new ColumnDefinition("Profile", ColumnType.String, 0, primaryKey: false, nullable: true, ColumnCategory.Formatted, minValue: 1, maxValue: 2147483647, description: "Profile (1=domain; 2=private; 4=public; 2147483647=all).", modularizeType: ColumnModularizeType.Property),
new ColumnDefinition("Component_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "Component", keyColumn: 1, description: "Foreign key into the Component table referencing component that controls the firewall configuration.", modularizeType: ColumnModularizeType.Column),
new ColumnDefinition("Description", ColumnType.String, 255, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "Description displayed in Windows Firewall manager for this firewall rule."),
new ColumnDefinition("Direction", ColumnType.Number, 1, primaryKey: false, nullable: false, ColumnCategory.Integer, minValue: 1, maxValue: 2, description: "Direction (1=in; 2=out)"),
new ColumnDefinition("Direction", ColumnType.Number, 1, primaryKey: false, nullable: false, ColumnCategory.Unknown, minValue: 1, maxValue: 2, description: "Direction (1=in; 2=out)"),
new ColumnDefinition("Action", ColumnType.String, 0, primaryKey: false, nullable: true, ColumnCategory.Formatted, minValue: 0, maxValue: 1, description: "Action (0=Block; 1=Allow).", modularizeType: ColumnModularizeType.Property),
new ColumnDefinition("EdgeTraversal", ColumnType.String, 0, primaryKey: false, nullable: true, ColumnCategory.Formatted, minValue: 0, maxValue: 3, description: "Edge traversal (0=Deny; 1=Allow; 2=DeferToApp; 3=DeferToUser).", modularizeType: ColumnModularizeType.Property),
new ColumnDefinition("Enabled", ColumnType.String, 0, primaryKey: false, nullable: true, ColumnCategory.Formatted, minValue: 0, maxValue: 1, description: "Enabled (0=Disabled; 1=Enabled).", modularizeType: ColumnModularizeType.Property),
Expand Down
15 changes: 14 additions & 1 deletion src/internal/WixInternal.TestSupport/Builder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public string[] BuildAndQuery(Action<string[]> buildFunc, bool validate, params
}
}

public void BuildAndDecompileAndBuild(Action<string[]> buildFunc, Action<string[]> decompileFunc, string decompilePath)
public void BuildAndDecompileAndBuild(Action<string[]> buildFunc, Action<string[]> decompileFunc, string decompilePath, bool validate = false)
{
var sourceFiles = Directory.GetFiles(this.SourceFolder, "*.wxs");
var wxlFiles = Directory.GetFiles(this.SourceFolder, "*.wxl");
Expand Down Expand Up @@ -145,6 +145,19 @@ public void BuildAndDecompileAndBuild(Action<string[]> buildFunc, Action<string[

buildFunc(firstBuildArgs.ToArray());

if (validate)
{
firstBuildArgs = new List<string>
{
"msi",
"validate",
"-intermediateFolder", intermediateFolder,
outputPath,
};

buildFunc(firstBuildArgs.ToArray());
}

// Decompile built output.
var decompileArgs = new List<string>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ namespace WixInternal.TestSupport
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
Expand Down

0 comments on commit db7727a

Please sign in to comment.