aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2024-04-04 15:24:34 -0700
committerRob Mensching <rob@firegiant.com>2024-04-05 09:46:43 -0700
commit681cf4a9eb6be7e4092c6e5b690773fbd8469e63 (patch)
tree1ff50c7856c83bf930a0cbb4f52d5e1b5cbc016f /src/test
parent6ed045ee1fe69be037a999df2e57122a25f0dedf (diff)
downloadwix-681cf4a9eb6be7e4092c6e5b690773fbd8469e63.tar.gz
wix-681cf4a9eb6be7e4092c6e5b690773fbd8469e63.tar.bz2
wix-681cf4a9eb6be7e4092c6e5b690773fbd8469e63.zip
Ensure elevated SFXCA uses Windows Installer cache and unelevated uses Temp folder
Fixes 8078
Diffstat (limited to 'src/test')
-rw-r--r--src/test/msi/TestData/CustomActionTests/ManagedCustomActions/Package.wxs6
-rw-r--r--src/test/msi/TestData/CustomActionTests/TestCA/CustomAction.cs38
2 files changed, 43 insertions, 1 deletions
diff --git a/src/test/msi/TestData/CustomActionTests/ManagedCustomActions/Package.wxs b/src/test/msi/TestData/CustomActionTests/ManagedCustomActions/Package.wxs
index 9b1d224a..4159cd3e 100644
--- a/src/test/msi/TestData/CustomActionTests/ManagedCustomActions/Package.wxs
+++ b/src/test/msi/TestData/CustomActionTests/ManagedCustomActions/Package.wxs
@@ -13,13 +13,17 @@
13 <Binary Id="ManagedCA" SourceFile="TestCA.CA.dll" /> 13 <Binary Id="ManagedCA" SourceFile="TestCA.CA.dll" />
14 14
15 <CustomAction Id="ImmediateCA" BinaryRef="ManagedCA" DllEntry="ImmediateCA" Execute="immediate" Return="check" /> 15 <CustomAction Id="ImmediateCA" BinaryRef="ManagedCA" DllEntry="ImmediateCA" Execute="immediate" Return="check" />
16 <CustomAction Id="DeferredCA" BinaryRef="ManagedCA" DllEntry="DeferredCA" Execute="deferred" Return="check" /> 16 <CustomAction Id="ExecuteImmediateCA" BinaryRef="ManagedCA" DllEntry="ExecuteImmediateCA" Execute="immediate" Return="check" />
17 <CustomAction Id="ImpersonatedDeferredCA" BinaryRef="ManagedCA" DllEntry="ImpersonatedDeferredCA" Execute="deferred" Impersonate="yes" Return="check" />
18 <CustomAction Id="DeferredCA" BinaryRef="ManagedCA" DllEntry="DeferredCA" Execute="deferred" Impersonate="no" Return="check" />
17 19
18 <InstallUISequence> 20 <InstallUISequence>
19 <Custom Action="ImmediateCA" Before="CostFinalize" /> 21 <Custom Action="ImmediateCA" Before="CostFinalize" />
20 </InstallUISequence> 22 </InstallUISequence>
21 23
22 <InstallExecuteSequence> 24 <InstallExecuteSequence>
25 <Custom Action="ExecuteImmediateCA" Before="CostFinalize" />
26 <Custom Action="ImpersonatedDeferredCA" Before="InstallFiles" />
23 <Custom Action="DeferredCA" After="InstallFiles" /> 27 <Custom Action="DeferredCA" After="InstallFiles" />
24 </InstallExecuteSequence> 28 </InstallExecuteSequence>
25 </Package> 29 </Package>
diff --git a/src/test/msi/TestData/CustomActionTests/TestCA/CustomAction.cs b/src/test/msi/TestData/CustomActionTests/TestCA/CustomAction.cs
index 6891f8da..54afc2cf 100644
--- a/src/test/msi/TestData/CustomActionTests/TestCA/CustomAction.cs
+++ b/src/test/msi/TestData/CustomActionTests/TestCA/CustomAction.cs
@@ -4,7 +4,9 @@ namespace WixToolsetTest.TestCA
4{ 4{
5 using System; 5 using System;
6 using System.Collections.Generic; 6 using System.Collections.Generic;
7 using System.IO;
7 using System.Linq; 8 using System.Linq;
9 using System.Text;
8 using WixToolset.Dtf.WindowsInstaller; 10 using WixToolset.Dtf.WindowsInstaller;
9 11
10 public class CustomActions 12 public class CustomActions
@@ -14,6 +16,31 @@ namespace WixToolsetTest.TestCA
14 { 16 {
15 session.Log("Begin ImmediateCA"); 17 session.Log("Begin ImmediateCA");
16 18
19 var path = Path.Combine(Path.GetTempPath(), "ImmediateCA.txt");
20 WriteNow(path);
21
22 return ActionResult.Success;
23 }
24
25 [CustomAction]
26 public static ActionResult ExecuteImmediateCA(Session session)
27 {
28 session.Log("Begin ExecuteImmediateCA");
29
30 var path = Path.Combine(Path.GetTempPath(), "ExecuteImmediateCA.txt");
31 WriteNow(path);
32
33 return ActionResult.Success;
34 }
35
36 [CustomAction]
37 public static ActionResult ImpersonatedDeferredCA(Session session)
38 {
39 session.Log("Begin ImpersonatedDeferredCA");
40
41 var path = Path.Combine(Path.GetTempPath(), "ImpersonatedDeferredCA.txt");
42 WriteNow(path);
43
17 return ActionResult.Success; 44 return ActionResult.Success;
18 } 45 }
19 46
@@ -22,7 +49,18 @@ namespace WixToolsetTest.TestCA
22 { 49 {
23 session.Log("Begin DeferredCA"); 50 session.Log("Begin DeferredCA");
24 51
52 WriteNow(@"C:\Windows\Installer\DeferredCA.txt");
53
25 return ActionResult.Success; 54 return ActionResult.Success;
26 } 55 }
56
57 private static void WriteNow(string path)
58 {
59 using (var file = File.Create(path))
60 {
61 var now = Encoding.UTF8.GetBytes(DateTime.Now.ToString("o"));
62 file.Write(now, 0, now.Length);
63 }
64 }
27 } 65 }
28} 66}