@joebigelow / wix / commits / a20bee47

Add Wix4 prefix Http CA binary and make HandleExisting an enum

Rob Mensching committed Apr 12, 2021 at 07:43 UTC a20bee47c43861dd9f38adb88e74a6417292732b
7 files changed +38 -32
src/test/WixToolsetTest.Http/HttpExtensionFixture.cs
+7 -8
@@ -2,7 +2,6 @@
2
3 namespace WixToolsetTest.Http
4 {
5 - using System.Linq;
5 using WixBuildTools.TestSupport;
6 using WixToolset.Core.TestPackage;
7 using WixToolset.Http;
@@ -17,14 +16,14 @@ namespace WixToolsetTest.Http
16 var build = new Builder(folder, typeof(HttpExtensionFactory), new[] { folder });
17
18 var results = build.BuildAndQuery(Build, "CustomAction", "WixHttpUrlAce", "WixHttpUrlReservation");
20 - Assert.Equal(new[]
19 + WixAssert.CompareLineByLine(new[]
20 {
22 - "CustomAction:Wix4ExecHttpUrlReservationsInstall_X86\t3073\tHttpCA_X86\tExecHttpUrlReservations\t",
23 - "CustomAction:Wix4ExecHttpUrlReservationsUninstall_X86\t3073\tHttpCA_X86\tExecHttpUrlReservations\t",
24 - "CustomAction:Wix4RollbackHttpUrlReservationsInstall_X86\t3329\tHttpCA_X86\tExecHttpUrlReservations\t",
25 - "CustomAction:Wix4RollbackHttpUrlReservationsUninstall_X86\t3329\tHttpCA_X86\tExecHttpUrlReservations\t",
26 - "CustomAction:Wix4SchedHttpUrlReservationsInstall_X86\t1\tHttpCA_X86\tSchedHttpUrlReservationsInstall\t",
27 - "CustomAction:Wix4SchedHttpUrlReservationsUninstall_X86\t1\tHttpCA_X86\tSchedHttpUrlReservationsUninstall\t",
21 + "CustomAction:Wix4ExecHttpUrlReservationsInstall_X86\t3073\tWix4HttpCA_X86\tExecHttpUrlReservations\t",
22 + "CustomAction:Wix4ExecHttpUrlReservationsUninstall_X86\t3073\tWix4HttpCA_X86\tExecHttpUrlReservations\t",
23 + "CustomAction:Wix4RollbackHttpUrlReservationsInstall_X86\t3329\tWix4HttpCA_X86\tExecHttpUrlReservations\t",
24 + "CustomAction:Wix4RollbackHttpUrlReservationsUninstall_X86\t3329\tWix4HttpCA_X86\tExecHttpUrlReservations\t",
25 + "CustomAction:Wix4SchedHttpUrlReservationsInstall_X86\t1\tWix4HttpCA_X86\tSchedHttpUrlReservationsInstall\t",
26 + "CustomAction:Wix4SchedHttpUrlReservationsUninstall_X86\t1\tWix4HttpCA_X86\tSchedHttpUrlReservationsUninstall\t",
27 "WixHttpUrlAce:aceu5os2gQoblRmzwjt85LQf997uD4\turlO23FkY2xzEY54lY6E6sXFW6glXc\tNT SERVICE\\TestService\t268435456",
28 "WixHttpUrlReservation:urlO23FkY2xzEY54lY6E6sXFW6glXc\t0\t\thttp://+:80/vroot/\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo",
29 }, results);
src/test/WixToolsetTest.Http/WixToolsetTest.Http.csproj
+1 -4
@@ -12,10 +12,7 @@
12 </PropertyGroup>
13
14 <ItemGroup>
15 - <Content Include="TestData\UsingUrlReservation\example.txt" CopyToOutputDirectory="PreserveNewest" />
16 - <Content Include="TestData\UsingUrlReservation\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
17 - <Content Include="TestData\UsingUrlReservation\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
18 - <Content Include="TestData\UsingUrlReservation\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
15 + <Content Include="TestData\**" CopyToOutputDirectory="PreserveNewest" />
16 </ItemGroup>
17
18 <ItemGroup>
src/wixext/HttpCompiler.cs
+4 -4
@@ -72,7 +72,7 @@ namespace WixToolset.Http
72 {
73 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node);
74 Identifier id = null;
75 - var handleExisting = HttpConstants.heReplace;
75 + var handleExisting = HandleExisting.Replace;
76 string sddl = null;
77 string url = null;
78 var foundACE = false;
@@ -91,13 +91,13 @@ namespace WixToolset.Http
91 switch (handleExistingValue)
92 {
93 case "replace":
94 - handleExisting = HttpConstants.heReplace;
94 + handleExisting = HandleExisting.Replace;
95 break;
96 case "ignore":
97 - handleExisting = HttpConstants.heIgnore;
97 + handleExisting = HandleExisting.Ignore;
98 break;
99 case "fail":
100 - handleExisting = HttpConstants.heFail;
100 + handleExisting = HandleExisting.Fail;
101 break;
102 default:
103 this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "HandleExisting", handleExistingValue, "replace", "ignore", "fail"));
src/wixext/HttpConstants.cs
-4
@@ -11,9 +11,5 @@ namespace WixToolset.Http
11 public const int GENERIC_EXECUTE = 0x20000000;
12 public const int GENERIC_WRITE = 0x40000000;
13
14 - // from wixhttpca.cpp
15 - public const int heReplace = 0;
16 - public const int heIgnore = 1;
17 - public const int heFail = 2;
14 }
15 }
src/wixext/Symbols/HandleExisting.cs new
+14
@@ -0,0 +1,14 @@
1 +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2 +
3 +namespace WixToolset.Http.Symbols
4 +{
5 + /// <summary>
6 + /// Must match constants in wixhttpca.cpp
7 + /// </summary>
8 + public enum HandleExisting
9 + {
10 + Replace = 0,
11 + Ignore = 1,
12 + Fail = 2,
13 + }
14 +}
src/wixext/Symbols/WixHttpUrlReservationSymbol.cs
+3 -3
@@ -44,10 +44,10 @@ namespace WixToolset.Http.Symbols
44
45 public IntermediateField this[WixHttpUrlReservationSymbolFields index] => this.Fields[(int)index];
46
47 - public int HandleExisting
47 + public HandleExisting HandleExisting
48 {
49 - get => this.Fields[(int)WixHttpUrlReservationSymbolFields.HandleExisting].AsNumber();
50 - set => this.Set((int)WixHttpUrlReservationSymbolFields.HandleExisting, value);
49 + get => (HandleExisting)this.Fields[(int)WixHttpUrlReservationSymbolFields.HandleExisting].AsNumber();
50 + set => this.Set((int)WixHttpUrlReservationSymbolFields.HandleExisting, (int)value);
51 }
52
53 public string Sddl
src/wixlib/HttpExtension_Platform.wxi
+9 -9
@@ -3,7 +3,7 @@
3
4 <Include xmlns="http://wixtoolset.org/schemas/v4/wxs">
5 <?include caDecor.wxi ?>
6 -
6 +
7 <Fragment>
8 <UIRef Id="WixHttpErrors" />
9 <UI>
@@ -15,12 +15,12 @@
15 <ProgressText Action="$(var.Prefix)ExecHttpUrlReservationsUninstall$(var.Suffix)" Message="!(loc.WixExecHttpUrlReservationsUninstall)" />
16 </UI>
17
18 - <CustomAction Id="$(var.Prefix)SchedHttpUrlReservationsInstall$(var.Suffix)" DllEntry="SchedHttpUrlReservationsInstall" Execute="immediate" Return="check" SuppressModularization="yes" BinaryRef="HttpCA$(var.Suffix)" />
19 - <CustomAction Id="$(var.Prefix)SchedHttpUrlReservationsUninstall$(var.Suffix)" DllEntry="SchedHttpUrlReservationsUninstall" Execute="immediate" Return="check" SuppressModularization="yes" BinaryRef="HttpCA$(var.Suffix)" />
20 - <CustomAction Id="$(var.Prefix)RollbackHttpUrlReservationsInstall$(var.Suffix)" DllEntry="ExecHttpUrlReservations" Execute="rollback" Impersonate="no" Return="check" SuppressModularization="yes" BinaryRef="HttpCA$(var.Suffix)" />
21 - <CustomAction Id="$(var.Prefix)ExecHttpUrlReservationsInstall$(var.Suffix)" DllEntry="ExecHttpUrlReservations" Execute="deferred" Impersonate="no" Return="check" SuppressModularization="yes" BinaryRef="HttpCA$(var.Suffix)" />
22 - <CustomAction Id="$(var.Prefix)RollbackHttpUrlReservationsUninstall$(var.Suffix)" DllEntry="ExecHttpUrlReservations" Execute="rollback" Impersonate="no" Return="check" SuppressModularization="yes" BinaryRef="HttpCA$(var.Suffix)" />
23 - <CustomAction Id="$(var.Prefix)ExecHttpUrlReservationsUninstall$(var.Suffix)" DllEntry="ExecHttpUrlReservations" Execute="deferred" Impersonate="no" Return="check" SuppressModularization="yes" BinaryRef="HttpCA$(var.Suffix)" />
18 + <CustomAction Id="$(var.Prefix)SchedHttpUrlReservationsInstall$(var.Suffix)" DllEntry="SchedHttpUrlReservationsInstall" Execute="immediate" Return="check" SuppressModularization="yes" BinaryRef="$(var.Prefix)HttpCA$(var.Suffix)" />
19 + <CustomAction Id="$(var.Prefix)SchedHttpUrlReservationsUninstall$(var.Suffix)" DllEntry="SchedHttpUrlReservationsUninstall" Execute="immediate" Return="check" SuppressModularization="yes" BinaryRef="$(var.Prefix)HttpCA$(var.Suffix)" />
20 + <CustomAction Id="$(var.Prefix)RollbackHttpUrlReservationsInstall$(var.Suffix)" DllEntry="ExecHttpUrlReservations" Execute="rollback" Impersonate="no" Return="check" SuppressModularization="yes" BinaryRef="$(var.Prefix)HttpCA$(var.Suffix)" />
21 + <CustomAction Id="$(var.Prefix)ExecHttpUrlReservationsInstall$(var.Suffix)" DllEntry="ExecHttpUrlReservations" Execute="deferred" Impersonate="no" Return="check" SuppressModularization="yes" BinaryRef="$(var.Prefix)HttpCA$(var.Suffix)" />
22 + <CustomAction Id="$(var.Prefix)RollbackHttpUrlReservationsUninstall$(var.Suffix)" DllEntry="ExecHttpUrlReservations" Execute="rollback" Impersonate="no" Return="check" SuppressModularization="yes" BinaryRef="$(var.Prefix)HttpCA$(var.Suffix)" />
23 + <CustomAction Id="$(var.Prefix)ExecHttpUrlReservationsUninstall$(var.Suffix)" DllEntry="ExecHttpUrlReservations" Execute="deferred" Impersonate="no" Return="check" SuppressModularization="yes" BinaryRef="$(var.Prefix)HttpCA$(var.Suffix)" />
24
25 <!--
26 We need the HTTP server on Windows XP SP2 or later.
@@ -30,8 +30,8 @@
30 <Custom Action="$(var.Prefix)SchedHttpUrlReservationsInstall$(var.Suffix)" After="InstallFiles" Overridable="yes" Condition="VersionNT &gt;= 600 OR (VersionNT &gt;= 501 AND ((MsiNTProductType = 1 AND ServicePackLevel &gt;= 2) OR (MsiNTProductType &gt; 1)))" />
31 </InstallExecuteSequence>
32 </Fragment>
33 -
33 +
34 <Fragment>
35 - <Binary Id="HttpCA$(var.Suffix)" SourceFile="!(bindpath.$(var.platform))httpca.dll" />
35 + <Binary Id="$(var.Prefix)HttpCA$(var.Suffix)" SourceFile="!(bindpath.$(var.platform))httpca.dll" />
36 </Fragment>
37 </Include>