Fix the handling of ServiceConfig and ServiceConfigFailureActions
Fixes 7198
Rob Mensching committed
Feb 9, 2023 at 06:41 UTC
a6daf710eac9219e512c625b8fc03bee9172ad35
3 files changed
+11
-5
src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs
+2
-2
@@ -780,7 +780,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
780
events |= symbol.OnReinstall ? WindowsInstallerConstants.MsidbServiceConfigEventReinstall : 0;
781
events |= symbol.OnUninstall ? WindowsInstallerConstants.MsidbServiceConfigEventUninstall : 0;
782
783
- var row = this.CreateRow(symbol, "MsiServiceConfigFailureActions");
783
+ var row = this.CreateRow(symbol, "MsiServiceConfig");
784
row[0] = symbol.Id.Id;
785
row[1] = symbol.Name;
786
row[2] = events;
@@ -795,7 +795,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
795
events |= symbol.OnReinstall ? WindowsInstallerConstants.MsidbServiceConfigEventReinstall : 0;
796
events |= symbol.OnUninstall ? WindowsInstallerConstants.MsidbServiceConfigEventUninstall : 0;
797
798
- var row = this.CreateRow(symbol, "MsiServiceConfig");
798
+ var row = this.CreateRow(symbol, "MsiServiceConfigFailureActions");
799
row[0] = symbol.Id.Id;
800
row[1] = symbol.Name;
801
row[2] = events;
src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs
+5
-2
@@ -727,7 +727,7 @@ namespace WixToolsetTest.CoreIntegration
727
var intermediateFolder = Path.Combine(baseFolder, "obj");
728
var msiPath = Path.Combine(baseFolder, @"bin\test.msi");
729
730
- var result = WixRunner.Execute(new[]
730
+ var result = WixRunner.Execute(warningsAsErrors: false, new[]
731
{
732
"build",
733
Path.Combine(folder, "ServiceInstall", "OwnProcess.wxs"),
@@ -741,9 +741,12 @@ namespace WixToolsetTest.CoreIntegration
741
result.AssertSuccess();
742
743
Assert.True(File.Exists(msiPath));
744
- var results = Query.QueryDatabase(msiPath, new[] { "ServiceInstall", "ServiceControl" });
744
+ var results = Query.QueryDatabase(msiPath, new[] { "ServiceInstall", "ServiceControl", "MsiServiceConfig", "MsiServiceConfigFailureActions" });
745
WixAssert.CompareLineByLine(new[]
746
{
747
+ "MsiServiceConfig:SampleService.DS\tSampleService\t1\t3\t1\ttest.txt",
748
+ "MsiServiceConfig:SampleService.SS\tSampleService\t1\t5\t1\ttest.txt",
749
+ "MsiServiceConfigFailureActions:SampleService\tSampleService\t1\t120\tRestart required because service failed.\t[~]\t\t\ttest.txt",
750
"ServiceControl:SampleService\tSampleService\t161\t\t1\ttest.txt",
751
"ServiceInstall:SampleService\tSampleService\t\t16\t4\t0\t\t\t\t\t\ttest.txt\t",
752
}, results);
src/wix/test/WixToolsetTest.CoreIntegration/TestData/ServiceInstall/OwnProcess.wxs
+4
-1
@@ -4,7 +4,10 @@
4
<ComponentGroup Id="ProductComponents">
5
<Component Directory="INSTALLFOLDER">
6
<File Id="test.txt" Source="test.txt" />
7
- <ServiceInstall Name="SampleService" ErrorControl="ignore" Start="disabled" Type="ownProcess" />
7
+ <ServiceInstall Name="SampleService" ErrorControl="ignore" Start="disabled" Type="ownProcess">
8
+ <ServiceConfig DelayedAutoStart="yes" ServiceSid="unrestricted" OnInstall="yes" />
9
+ <ServiceConfigFailureActions RebootMessage="Restart required because service failed." ResetPeriod="120" OnInstall="yes" />
10
+ </ServiceInstall>
11
<ServiceControl Name="SampleService" Start="install" Stop="uninstall" Remove="uninstall" Wait="yes" />
12
</Component>
13
</ComponentGroup>