From 681cf4a9eb6be7e4092c6e5b690773fbd8469e63 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 4 Apr 2024 15:24:34 -0700 Subject: Ensure elevated SFXCA uses Windows Installer cache and unelevated uses Temp folder Fixes 8078 --- .../ManagedCustomActions/Package.wxs | 6 +++- .../CustomActionTests/TestCA/CustomAction.cs | 38 ++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) (limited to 'src/test') 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 @@ - + + + + + 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 { using System; using System.Collections.Generic; + using System.IO; using System.Linq; + using System.Text; using WixToolset.Dtf.WindowsInstaller; public class CustomActions @@ -14,6 +16,31 @@ namespace WixToolsetTest.TestCA { session.Log("Begin ImmediateCA"); + var path = Path.Combine(Path.GetTempPath(), "ImmediateCA.txt"); + WriteNow(path); + + return ActionResult.Success; + } + + [CustomAction] + public static ActionResult ExecuteImmediateCA(Session session) + { + session.Log("Begin ExecuteImmediateCA"); + + var path = Path.Combine(Path.GetTempPath(), "ExecuteImmediateCA.txt"); + WriteNow(path); + + return ActionResult.Success; + } + + [CustomAction] + public static ActionResult ImpersonatedDeferredCA(Session session) + { + session.Log("Begin ImpersonatedDeferredCA"); + + var path = Path.Combine(Path.GetTempPath(), "ImpersonatedDeferredCA.txt"); + WriteNow(path); + return ActionResult.Success; } @@ -22,7 +49,18 @@ namespace WixToolsetTest.TestCA { session.Log("Begin DeferredCA"); + WriteNow(@"C:\Windows\Installer\DeferredCA.txt"); + return ActionResult.Success; } + + private static void WriteNow(string path) + { + using (var file = File.Create(path)) + { + var now = Encoding.UTF8.GetBytes(DateTime.Now.ToString("o")); + file.Write(now, 0, now.Length); + } + } } } -- cgit v1.2.3-55-g6feb