diff options
Diffstat (limited to '')
| -rw-r--r-- | src/ext/Util/ca/test.cpp | 15 | ||||
| -rw-r--r-- | src/ext/Util/ca/utilca.def | 1 | ||||
| -rw-r--r-- | src/ext/Util/test/WixToolsetTest.Util/TestData/Failures/Package.wxs | 9 | ||||
| -rw-r--r-- | src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs | 15 | ||||
| -rw-r--r-- | src/ext/Util/wixext/UtilCompiler.cs | 9 | ||||
| -rw-r--r-- | src/ext/Util/wixlib/UtilExtension_Platform.wxi | 8 | ||||
| -rw-r--r-- | src/ext/caDecor.h | 10 | ||||
| -rw-r--r-- | src/ext/caDecor.wxi | 6 | ||||
| -rw-r--r-- | src/wix/Directory.Build.targets | 2 | ||||
| -rw-r--r-- | src/xsd/util/CancelWhenDeferred.xsd | 11 | ||||
| -rw-r--r-- | src/xsd/util/order.txt | 1 |
11 files changed, 85 insertions, 2 deletions
diff --git a/src/ext/Util/ca/test.cpp b/src/ext/Util/ca/test.cpp index e9d02ed3..8f1c238b 100644 --- a/src/ext/Util/ca/test.cpp +++ b/src/ext/Util/ca/test.cpp | |||
| @@ -40,6 +40,21 @@ static LRESULT CALLBACK WndProc( | |||
| 40 | 40 | ||
| 41 | 41 | ||
| 42 | /****************************************************************** | 42 | /****************************************************************** |
| 43 | WixCancelWhenDeferred - entry point for WixCancelWhenDeferred | ||
| 44 | custom action which always cancels when running as a deferred | ||
| 45 | custom action (otherwise it blindly succeeds). It's useful when | ||
| 46 | testing the rollback of deferred custom actions: Schedule it | ||
| 47 | immediately after the rollback/deferred CA pair you're testing | ||
| 48 | and it will fail, causing your rollback CA to get invoked. | ||
| 49 | ********************************************************************/ | ||
| 50 | extern "C" UINT __stdcall WixCancelWhenDeferred( | ||
| 51 | __in MSIHANDLE hInstall | ||
| 52 | ) | ||
| 53 | { | ||
| 54 | return ::MsiGetMode(hInstall, MSIRUNMODE_SCHEDULED) ? ERROR_INSTALL_USEREXIT : ERROR_SUCCESS; | ||
| 55 | } | ||
| 56 | |||
| 57 | /****************************************************************** | ||
| 43 | WixFailWhenDeferred - entry point for WixFailWhenDeferred | 58 | WixFailWhenDeferred - entry point for WixFailWhenDeferred |
| 44 | custom action which always fails when running as a deferred | 59 | custom action which always fails when running as a deferred |
| 45 | custom action (otherwise it blindly succeeds). It's useful when | 60 | custom action (otherwise it blindly succeeds). It's useful when |
diff --git a/src/ext/Util/ca/utilca.def b/src/ext/Util/ca/utilca.def index 2aeb54f4..f525233d 100644 --- a/src/ext/Util/ca/utilca.def +++ b/src/ext/Util/ca/utilca.def | |||
| @@ -82,6 +82,7 @@ EXPORTS | |||
| 82 | WixShellExecBinary | 82 | WixShellExecBinary |
| 83 | WixUnelevatedShellExec | 83 | WixUnelevatedShellExec |
| 84 | ; test.cpp | 84 | ; test.cpp |
| 85 | WixCancelWhenDeferred | ||
| 85 | WixFailWhenDeferred | 86 | WixFailWhenDeferred |
| 86 | WixWaitForEvent | 87 | WixWaitForEvent |
| 87 | ; TouchFile.cpp | 88 | ; TouchFile.cpp |
diff --git a/src/ext/Util/test/WixToolsetTest.Util/TestData/Failures/Package.wxs b/src/ext/Util/test/WixToolsetTest.Util/TestData/Failures/Package.wxs new file mode 100644 index 00000000..76975b69 --- /dev/null +++ b/src/ext/Util/test/WixToolsetTest.Util/TestData/Failures/Package.wxs | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> | ||
| 2 | <Package Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a"> | ||
| 3 | <File Source="$(sys.SOURCEFILEPATH)" /> | ||
| 4 | |||
| 5 | <!-- Dead or alive, you're coming with me. --> | ||
| 6 | <util:FailWhenDeferred /> | ||
| 7 | <util:CancelWhenDeferred /> | ||
| 8 | </Package> | ||
| 9 | </Wix> | ||
diff --git a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs index b29607c7..1f39601d 100644 --- a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs +++ b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs | |||
| @@ -101,6 +101,21 @@ namespace WixToolsetTest.Util | |||
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | [TestMethod] | 103 | [TestMethod] |
| 104 | public void CanBuildWithFailures() | ||
| 105 | { | ||
| 106 | var folder = TestData.Get(@"TestData\Failures"); | ||
| 107 | var build = new Builder(folder, typeof(UtilExtensionFactory), new[] { folder }); | ||
| 108 | |||
| 109 | var results = build.BuildAndQuery(BuildX64, "Binary", "CustomAction"); | ||
| 110 | WixAssert.CompareLineByLine( | ||
| 111 | [ | ||
| 112 | "Binary:Wix4UtilCA_X64\t[Binary data]", | ||
| 113 | "CustomAction:Wix4FailWhenDeferred_X64\t1025\tWix4UtilCA_X64\tWixFailWhenDeferred\t", | ||
| 114 | "CustomAction:Wix8CancelWhenDeferred_X64\t1025\tWix4UtilCA_X64\tWixCancelWhenDeferred\t", | ||
| 115 | ], [.. results.OrderBy(s => s)]); | ||
| 116 | } | ||
| 117 | |||
| 118 | [TestMethod] | ||
| 104 | public void CanBuildInternetShortcutInProduct() | 119 | public void CanBuildInternetShortcutInProduct() |
| 105 | { | 120 | { |
| 106 | var folder = TestData.Get(@"TestData\InternetShortcut"); | 121 | var folder = TestData.Get(@"TestData\InternetShortcut"); |
diff --git a/src/ext/Util/wixext/UtilCompiler.cs b/src/ext/Util/wixext/UtilCompiler.cs index 919cc49b..1d11f37f 100644 --- a/src/ext/Util/wixext/UtilCompiler.cs +++ b/src/ext/Util/wixext/UtilCompiler.cs | |||
| @@ -210,6 +210,7 @@ namespace WixToolset.Util | |||
| 210 | break; | 210 | break; |
| 211 | case "BroadcastEnvironmentChange": | 211 | case "BroadcastEnvironmentChange": |
| 212 | case "BroadcastSettingChange": | 212 | case "BroadcastSettingChange": |
| 213 | case "CancelWhenDeferred": | ||
| 213 | case "CheckRebootRequired": | 214 | case "CheckRebootRequired": |
| 214 | case "ExitEarlyWithSuccess": | 215 | case "ExitEarlyWithSuccess": |
| 215 | case "FailWhenDeferred": | 216 | case "FailWhenDeferred": |
| @@ -328,6 +329,7 @@ namespace WixToolset.Util | |||
| 328 | { | 329 | { |
| 329 | case "BroadcastEnvironmentChange": | 330 | case "BroadcastEnvironmentChange": |
| 330 | case "BroadcastSettingChange": | 331 | case "BroadcastSettingChange": |
| 332 | case "CancelWhenDeferred": | ||
| 331 | case "CheckRebootRequired": | 333 | case "CheckRebootRequired": |
| 332 | case "ExitEarlyWithSuccess": | 334 | case "ExitEarlyWithSuccess": |
| 333 | case "FailWhenDeferred": | 335 | case "FailWhenDeferred": |
| @@ -358,6 +360,7 @@ namespace WixToolset.Util | |||
| 358 | return; | 360 | return; |
| 359 | } | 361 | } |
| 360 | 362 | ||
| 363 | var prefix = "Wix4"; | ||
| 361 | var customAction = element.Name.LocalName; | 364 | var customAction = element.Name.LocalName; |
| 362 | switch (element.Name.LocalName) | 365 | switch (element.Name.LocalName) |
| 363 | { | 366 | { |
| @@ -370,6 +373,10 @@ namespace WixToolset.Util | |||
| 370 | case "WaitForEventDeferred": | 373 | case "WaitForEventDeferred": |
| 371 | //default: customAction = element.Name.LocalName; | 374 | //default: customAction = element.Name.LocalName; |
| 372 | break; | 375 | break; |
| 376 | case "CancelWhenDeferred": | ||
| 377 | prefix = "Wix8"; | ||
| 378 | //default: customAction = element.Name.LocalName; | ||
| 379 | break; | ||
| 373 | case "QueryWindowsDirectories": | 380 | case "QueryWindowsDirectories": |
| 374 | customAction = "QueryOsDirs"; | 381 | customAction = "QueryOsDirs"; |
| 375 | break; | 382 | break; |
| @@ -400,7 +407,7 @@ namespace WixToolset.Util | |||
| 400 | 407 | ||
| 401 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); | 408 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); |
| 402 | 409 | ||
| 403 | this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4" + customAction, this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); | 410 | this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, prefix + customAction, this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); |
| 404 | } | 411 | } |
| 405 | 412 | ||
| 406 | /// <summary> | 413 | /// <summary> |
diff --git a/src/ext/Util/wixlib/UtilExtension_Platform.wxi b/src/ext/Util/wixlib/UtilExtension_Platform.wxi index d28c8df9..6316eaf1 100644 --- a/src/ext/Util/wixlib/UtilExtension_Platform.wxi +++ b/src/ext/Util/wixlib/UtilExtension_Platform.wxi | |||
| @@ -5,6 +5,14 @@ | |||
| 5 | <?include ..\..\caDecor.wxi ?> | 5 | <?include ..\..\caDecor.wxi ?> |
| 6 | 6 | ||
| 7 | <Fragment> | 7 | <Fragment> |
| 8 | <CustomAction Id="$(Prefix8)CancelWhenDeferred$(Suffix)" DllEntry="WixCancelWhenDeferred" Execute="deferred" Return="check" SuppressModularization="yes" BinaryRef="$(Prefix)UtilCA$(Suffix)" /> | ||
| 9 | |||
| 10 | <InstallExecuteSequence> | ||
| 11 | <Custom Action="virtual $(Prefix8)CancelWhenDeferred$(Suffix)" Before="InstallFinalize" Condition="WIXCANCELWHENDEFERRED=1 AND VersionNT > 400" /> | ||
| 12 | </InstallExecuteSequence> | ||
| 13 | </Fragment> | ||
| 14 | |||
| 15 | <Fragment> | ||
| 8 | <CustomAction Id="$(var.Prefix)FailWhenDeferred$(var.Suffix)" DllEntry="WixFailWhenDeferred" Execute="deferred" Return="check" SuppressModularization="yes" BinaryRef="$(var.Prefix)UtilCA$(var.Suffix)" /> | 16 | <CustomAction Id="$(var.Prefix)FailWhenDeferred$(var.Suffix)" DllEntry="WixFailWhenDeferred" Execute="deferred" Return="check" SuppressModularization="yes" BinaryRef="$(var.Prefix)UtilCA$(var.Suffix)" /> |
| 9 | 17 | ||
| 10 | <InstallExecuteSequence> | 18 | <InstallExecuteSequence> |
diff --git a/src/ext/caDecor.h b/src/ext/caDecor.h index 4a09e075..9484d74c 100644 --- a/src/ext/caDecor.h +++ b/src/ext/caDecor.h | |||
| @@ -31,3 +31,13 @@ | |||
| 31 | #else | 31 | #else |
| 32 | #define CUSTOM_ACTION_DECORATION6(f) L"Wix6" f L"_X86" | 32 | #define CUSTOM_ACTION_DECORATION6(f) L"Wix6" f L"_X86" |
| 33 | #endif | 33 | #endif |
| 34 | |||
| 35 | #if defined(_M_ARM64) | ||
| 36 | #define CUSTOM_ACTION_DECORATION8(f) L"Wix8" f L"_A64" | ||
| 37 | #elif defined(_M_AMD64) | ||
| 38 | #define CUSTOM_ACTION_DECORATION8(f) L"Wix8" f L"_X64" | ||
| 39 | #elif defined(_M_ARM) | ||
| 40 | #define CUSTOM_ACTION_DECORATION8(f) L"Wix8" f L"_ARM" | ||
| 41 | #else | ||
| 42 | #define CUSTOM_ACTION_DECORATION8(f) L"Wix8" f L"_X86" | ||
| 43 | #endif | ||
diff --git a/src/ext/caDecor.wxi b/src/ext/caDecor.wxi index 236b2154..c92af980 100644 --- a/src/ext/caDecor.wxi +++ b/src/ext/caDecor.wxi | |||
| @@ -19,6 +19,12 @@ | |||
| 19 | <?endif?> | 19 | <?endif?> |
| 20 | <?define Prefix6="Wix6" ?> | 20 | <?define Prefix6="Wix6" ?> |
| 21 | 21 | ||
| 22 | <?ifdef Prefix8 ?> | ||
| 23 | <?undef Prefix8 ?> | ||
| 24 | <?endif?> | ||
| 25 | <?define Prefix8="Wix8" ?> | ||
| 26 | |||
| 27 | |||
| 22 | <?ifndef platform ?> | 28 | <?ifndef platform ?> |
| 23 | <?define platform="x86" ?> | 29 | <?define platform="x86" ?> |
| 24 | <?endif?> | 30 | <?endif?> |
diff --git a/src/wix/Directory.Build.targets b/src/wix/Directory.Build.targets index 78b83e60..28749932 100644 --- a/src/wix/Directory.Build.targets +++ b/src/wix/Directory.Build.targets | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | <Import Project="..\Directory.Build.targets" /> | 4 | <Import Project="..\Directory.Build.targets" /> |
| 5 | 5 | ||
| 6 | <ItemGroup Condition=" '$(RequiresNativeWixAssets)'=='true' and ('$(TargetFrameworkIdentifier)'=='.NETFramework' or '$(RuntimeIdentifier)'!='' ) "> | 6 | <ItemGroup Condition=" '$(RequiresNativeWixAssets)'=='true' and ('$(TargetFrameworkIdentifier)'=='.NETFramework' or '$(RuntimeIdentifier)'!='' ) "> |
| 7 | <!-- Copy the x64 binaries when there is no RuntimeIdentifier since we've standardized on VS2022 (which is 64-bit) --> | 7 | <!-- Copy the x64 binaries when there is no RuntimeIdentifier since we've standardized on VS2026 (which is 64-bit) --> |
| 8 | <None Include="$(MSBuildThisFileDirectory)wixnative\x64\mergemod.dll" CopyToOutputDirectory="PreserveNewest" Condition=" '$(RuntimeIdentifier)'=='win-x64' or '$(RuntimeIdentifier)'=='' " /> | 8 | <None Include="$(MSBuildThisFileDirectory)wixnative\x64\mergemod.dll" CopyToOutputDirectory="PreserveNewest" Condition=" '$(RuntimeIdentifier)'=='win-x64' or '$(RuntimeIdentifier)'=='' " /> |
| 9 | <None Include="$(BaseOutputPath)$(Configuration)\x64\wixnative.exe" CopyToOutputDirectory="PreserveNewest" Condition=" '$(RuntimeIdentifier)'=='win-x64' or '$(RuntimeIdentifier)'=='' " /> | 9 | <None Include="$(BaseOutputPath)$(Configuration)\x64\wixnative.exe" CopyToOutputDirectory="PreserveNewest" Condition=" '$(RuntimeIdentifier)'=='win-x64' or '$(RuntimeIdentifier)'=='' " /> |
| 10 | 10 | ||
diff --git a/src/xsd/util/CancelWhenDeferred.xsd b/src/xsd/util/CancelWhenDeferred.xsd new file mode 100644 index 00000000..062be147 --- /dev/null +++ b/src/xsd/util/CancelWhenDeferred.xsd | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | <element name="CancelWhenDeferred"> | ||
| 2 | <annotation> | ||
| 3 | <documentation>Schedules the CancelWhenDeferred custom action for the current platform.</documentation> | ||
| 4 | <appinfo> | ||
| 5 | <parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="Package" /> | ||
| 6 | <parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="Module" /> | ||
| 7 | <parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="Fragment" /> | ||
| 8 | <parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="UI" /> | ||
| 9 | </appinfo> | ||
| 10 | </annotation> | ||
| 11 | </element> \ No newline at end of file | ||
diff --git a/src/xsd/util/order.txt b/src/xsd/util/order.txt index 63f854ae..1181e97a 100644 --- a/src/xsd/util/order.txt +++ b/src/xsd/util/order.txt | |||
| @@ -33,6 +33,7 @@ element|XmlFile | |||
| 33 | element|XmlConfig | 33 | element|XmlConfig |
| 34 | element|BroadcastEnvironmentChange | 34 | element|BroadcastEnvironmentChange |
| 35 | element|BroadcastSettingChange | 35 | element|BroadcastSettingChange |
| 36 | element|CancelWhenDeferred | ||
| 36 | element|CheckRebootRequired | 37 | element|CheckRebootRequired |
| 37 | element|ExitEarlyWithSuccess | 38 | element|ExitEarlyWithSuccess |
| 38 | element|FailWhenDeferred | 39 | element|FailWhenDeferred |
