aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-05-03 15:30:50 -0500
committerSean Hall <r.sean.hall@gmail.com>2022-05-04 10:05:21 -0500
commit29f7e00586412163a20e298fbf84505f8a917425 (patch)
tree30257a3544f6982ded159443ebed0eb933f11a51 /src/test
parent41d2c12d60ee84cefc26ec99abb328701883c8f5 (diff)
downloadwix-29f7e00586412163a20e298fbf84505f8a917425.tar.gz
wix-29f7e00586412163a20e298fbf84505f8a917425.tar.bz2
wix-29f7e00586412163a20e298fbf84505f8a917425.zip
Only block shutdown during Apply.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/burn/TestBA/TestBA.cs9
-rw-r--r--src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp52
-rw-r--r--src/test/burn/TestData/Manual/BundleA/BundleA.wxs7
-rw-r--r--src/test/burn/TestData/Manual/PackageA/PackageA.wixproj4
-rw-r--r--src/test/burn/TestData/Manual/PackageA/ProductA.wxs15
5 files changed, 76 insertions, 11 deletions
diff --git a/src/test/burn/TestBA/TestBA.cs b/src/test/burn/TestBA/TestBA.cs
index b4d74341..5f492efd 100644
--- a/src/test/burn/TestBA/TestBA.cs
+++ b/src/test/burn/TestBA/TestBA.cs
@@ -531,15 +531,6 @@ namespace WixToolset.Test.BA
531 this.ShutdownUiThread(); 531 this.ShutdownUiThread();
532 } 532 }
533 533
534 protected override void OnSystemShutdown(SystemShutdownEventArgs args)
535 {
536 // Always prevent shutdown.
537 this.Log("Disallowed system request to shut down the bootstrapper application.");
538 args.Cancel = true;
539
540 this.ShutdownUiThread();
541 }
542
543 protected override void OnUnregisterBegin(UnregisterBeginEventArgs args) 534 protected override void OnUnregisterBegin(UnregisterBeginEventArgs args)
544 { 535 {
545 if (this.forceKeepRegistration && args.RegistrationType == RegistrationType.None) 536 if (this.forceKeepRegistration && args.RegistrationType == RegistrationType.None)
diff --git a/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp b/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp
index 7c533fea..3cf994fc 100644
--- a/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp
+++ b/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp
@@ -88,6 +88,56 @@ public: // IBAFunctions
88 return hr; 88 return hr;
89 } 89 }
90 90
91 virtual STDMETHODIMP WndProc(
92 __in HWND hWnd,
93 __in UINT uMsg,
94 __in WPARAM /*wParam*/,
95 __in LPARAM lParam,
96 __inout BOOL* pfProcessed,
97 __inout LRESULT* plResult
98 )
99 {
100 switch (uMsg)
101 {
102 case WM_QUERYENDSESSION:
103 if (BOOTSTRAPPER_DISPLAY_FULL <= m_command.display)
104 {
105 DWORD dwEndSession = static_cast<DWORD>(lParam);
106 if (ENDSESSION_CRITICAL & dwEndSession)
107 {
108 // Return false to get the WM_ENDSESSION message so that critical shutdowns can be delayed.
109 *plResult = FALSE;
110 *pfProcessed = TRUE;
111 }
112 }
113 break;
114 case WM_ENDSESSION:
115 if (BOOTSTRAPPER_DISPLAY_FULL <= m_command.display)
116 {
117 ::MessageBoxW(hWnd, L"WM_ENDSESSION", L"BAFunctions WndProc", MB_OK);
118 }
119 break;
120 }
121 return S_OK;
122 }
123
124public: //IBootstrapperApplication
125 virtual STDMETHODIMP OnExecuteBegin(
126 __in DWORD /*cExecutingPackages*/,
127 __inout BOOL* pfCancel
128 )
129 {
130 if (BOOTSTRAPPER_DISPLAY_FULL <= m_command.display)
131 {
132 if (IDCANCEL == ::MessageBoxW(m_hwndParent, L"Shutdown requests should be denied right now.", L"OnExecuteBegin", MB_OKCANCEL))
133 {
134 *pfCancel = TRUE;
135 }
136 }
137
138 return S_OK;
139 }
140
91private: 141private:
92 HRESULT OnShowTheme() 142 HRESULT OnShowTheme()
93 { 143 {
@@ -138,6 +188,8 @@ private:
138 188
139 ThemeInitializeWindowClass(m_pBafTheme, &wc, CBafThmUtilTesting::TestingWndProc, m_hModule, BAFTHMUTILTESTING_WINDOW_CLASS); 189 ThemeInitializeWindowClass(m_pBafTheme, &wc, CBafThmUtilTesting::TestingWndProc, m_hModule, BAFTHMUTILTESTING_WINDOW_CLASS);
140 190
191 Assert(wc.lpszClassName);
192
141 // If the theme did not provide an icon, try using the icon from the bundle engine. 193 // If the theme did not provide an icon, try using the icon from the bundle engine.
142 if (!wc.hIcon) 194 if (!wc.hIcon)
143 { 195 {
diff --git a/src/test/burn/TestData/Manual/BundleA/BundleA.wxs b/src/test/burn/TestData/Manual/BundleA/BundleA.wxs
index 20706b6a..44abc645 100644
--- a/src/test/burn/TestData/Manual/BundleA/BundleA.wxs
+++ b/src/test/burn/TestData/Manual/BundleA/BundleA.wxs
@@ -1,4 +1,4 @@
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. --> 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 2
3 3
4<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> 4<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
@@ -8,7 +8,10 @@
8 <Payload SourceFile="$(var.BafThmUtilTesting.TargetPath)" bal:BAFunctions="yes" /> 8 <Payload SourceFile="$(var.BafThmUtilTesting.TargetPath)" bal:BAFunctions="yes" />
9 </BootstrapperApplication> 9 </BootstrapperApplication>
10 <PackageGroup Id="BundlePackages"> 10 <PackageGroup Id="BundlePackages">
11 <MsiPackage Id="PackageA" SourceFile="$(var.PackageA.TargetPath)" /> 11 <MsiPackage Id="PackageA" SourceFile="$(var.PackageA.TargetPath)">
12 <MsiProperty Name="FORCERESTARTCA" Value="[FORCERESTARTCA]" />
13 </MsiPackage>
12 </PackageGroup> 14 </PackageGroup>
15 <Variable Name="FORCERESTARTCA" bal:Overridable="yes" />
13 </Fragment> 16 </Fragment>
14</Wix> 17</Wix>
diff --git a/src/test/burn/TestData/Manual/PackageA/PackageA.wixproj b/src/test/burn/TestData/Manual/PackageA/PackageA.wixproj
index c9c81c3a..61dc27ab 100644
--- a/src/test/burn/TestData/Manual/PackageA/PackageA.wixproj
+++ b/src/test/burn/TestData/Manual/PackageA/PackageA.wixproj
@@ -2,8 +2,12 @@
2<Project Sdk="WixToolset.Sdk"> 2<Project Sdk="WixToolset.Sdk">
3 <PropertyGroup> 3 <PropertyGroup>
4 <UpgradeCode>{0D803A6E-8090-4174-8DAC-810ECC2B1BBF}</UpgradeCode> 4 <UpgradeCode>{0D803A6E-8090-4174-8DAC-810ECC2B1BBF}</UpgradeCode>
5 <ProductComponentsRef>true</ProductComponentsRef>
5 </PropertyGroup> 6 </PropertyGroup>
6 <ItemGroup> 7 <ItemGroup>
7 <Compile Include="..\..\Templates\Package.wxs" Link="Package.wxs" /> 8 <Compile Include="..\..\Templates\Package.wxs" Link="Package.wxs" />
8 </ItemGroup> 9 </ItemGroup>
10 <ItemGroup>
11 <PackageReference Include="WixToolset.Util.wixext" />
12 </ItemGroup>
9</Project> \ No newline at end of file 13</Project> \ No newline at end of file
diff --git a/src/test/burn/TestData/Manual/PackageA/ProductA.wxs b/src/test/burn/TestData/Manual/PackageA/ProductA.wxs
new file mode 100644
index 00000000..bf1ef152
--- /dev/null
+++ b/src/test/burn/TestData/Manual/PackageA/ProductA.wxs
@@ -0,0 +1,15 @@
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<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
4 <Fragment>
5 <ComponentGroup Id="ProductComponents" />
6
7 <Property Id="FORCERESTARTCA" Secure="yes" />
8 <Property Id="ForceRestartCA" Value="&quot;shutdown.exe&quot; -r -f -t 0" />
9 <CustomAction Id="ForceRestartCA" DllEntry="WixQuietExec" BinaryRef="Wix4UtilCA_X86" Execute="deferred" Return="ignore" />
10
11 <InstallExecuteSequence>
12 <Custom Action="ForceRestartCA" After="InstallFiles" Condition="FORCERESTARTCA = 1" />
13 </InstallExecuteSequence>
14 </Fragment>
15</Wix>