aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-09-02 16:12:42 -0500
committerSean Hall <r.sean.hall@gmail.com>2022-09-03 15:29:26 -0500
commit237bdc6a97c0dd455da99c16e6b3b7cac4c79e86 (patch)
tree1f2c789a7aa752e068fac8a4ca08815d13bf527a /src/test
parent7728e34e48a4fdb710ecc92dd8dca833bff3993f (diff)
downloadwix-237bdc6a97c0dd455da99c16e6b3b7cac4c79e86.tar.gz
wix-237bdc6a97c0dd455da99c16e6b3b7cac4c79e86.tar.bz2
wix-237bdc6a97c0dd455da99c16e6b3b7cac4c79e86.zip
Add WixCanRestart and make wixstdba elevate for restart when required.
Fixes 5499
Diffstat (limited to 'src/test')
-rw-r--r--src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp2
-rw-r--r--src/test/burn/TestData/Manual/BundleA/ManualTests.txt54
-rw-r--r--src/test/burn/TestData/Manual/BundleC/BundleC.wixproj18
-rw-r--r--src/test/burn/TestData/Manual/BundleC/BundleC.wxs15
-rw-r--r--src/test/burn/TestData/Manual/PackagePerUser/PackagePerUser.wixproj9
5 files changed, 92 insertions, 6 deletions
diff --git a/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp b/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp
index c619dbd6..a2b8e041 100644
--- a/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp
+++ b/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp
@@ -477,7 +477,7 @@ static HRESULT LogUserSid()
477 TOKEN_USER* pTokenUser = NULL; 477 TOKEN_USER* pTokenUser = NULL;
478 LPWSTR sczSid = NULL; 478 LPWSTR sczSid = NULL;
479 479
480 hr = ProcTokenUser(::GetCurrentProcess(), &pTokenUser); 480 hr = ProcGetTokenInformation(::GetCurrentProcess(), TokenUser, reinterpret_cast<LPVOID*>(&pTokenUser));
481 BalExitOnFailure(hr, "Failed to get user from process token."); 481 BalExitOnFailure(hr, "Failed to get user from process token.");
482 482
483 if (!::ConvertSidToStringSidW(pTokenUser->User.Sid, &sczSid)) 483 if (!::ConvertSidToStringSidW(pTokenUser->User.Sid, &sczSid))
diff --git a/src/test/burn/TestData/Manual/BundleA/ManualTests.txt b/src/test/burn/TestData/Manual/BundleA/ManualTests.txt
index d432f94a..b8c6e74d 100644
--- a/src/test/burn/TestData/Manual/BundleA/ManualTests.txt
+++ b/src/test/burn/TestData/Manual/BundleA/ManualTests.txt
@@ -94,11 +94,12 @@ CanRestartFromUnelevatedPerMachineBundleWithoutShutdownPrivilege
942. Click Install. 942. Click Install.
953. Verify that the UAC prompt came up and accept elevation. 953. Verify that the UAC prompt came up and accept elevation.
964. Click OK on the OnExecuteBegin message box. 964. Click OK on the OnExecuteBegin message box.
975. Click Restart. 975. Verify the Restart button doesn't have the UAC shield and then click it.
986. The machine should restart. 986. Verify that there was no UAC prompt.
997. Login to the machine. 997. The machine should restart.
1008. Verify that the bundle did not automatically start running. 1008. Login to the machine.
1019. Look in the bundle log and verify that the restart request didn't cause any errors, and that it logged messages that look like (the process id for w005 must match the elevated i400 and i401): 1019. Verify that the bundle did not automatically start running.
10210. Look in the bundle log and verify that the restart request didn't cause any errors, and that it logged messages that look like (the process id for w005 must match the elevated i400 and i401):
102 103
103[0DDC:0448]w005: Restarting computer... 104[0DDC:0448]w005: Restarting computer...
104[1228:18CC]i400: Received system request to shut down the process: allowed: Yes, elevated: No, critical: No, logoff: No, close app: No 105[1228:18CC]i400: Received system request to shut down the process: allowed: Yes, elevated: No, critical: No, logoff: No, close app: No
@@ -107,4 +108,47 @@ CanRestartFromUnelevatedPerMachineBundleWithoutShutdownPrivilege
107[0DDC:0954]i401: Received result of system request to shut down the process: closing: Yes, elevated: Yes, critical: No, logoff: No, close app: No 108[0DDC:0954]i401: Received result of system request to shut down the process: closing: Yes, elevated: Yes, critical: No, logoff: No, close app: No
108======================================= 109=======================================
109 110
111(11. Uninstall the bundle)
112
113CanRestartFromUnelevatedPerUserBundleWithoutShutdownPrivilege
114
115 Note: Requires different User Rights Assignment settings from CanLogRestartFailure - Only Administrators should have the shutdown privilege. Users should not have it.
116
1171. Run BundleC.exe unelevated with the command line EXEEXITCODE=3010.
1182. Click Install.
1193. Verify the Restart button has the UAC shield and then click it.
1204. Verify that the UAC prompt came up and accept elevation.
1215. The machine should restart.
1226. Login to the machine.
1237. Verify that the bundle did not automatically start running.
1248. Look in the bundle log and verify that the restart request didn't cause any errors, and that it logged messages that look like (the process id for w005 must match the elevated i400 and i401):
125
126[0DDC:0448]w005: Restarting computer...
127[1228:18CC]i400: Received system request to shut down the process: allowed: Yes, elevated: No, critical: No, logoff: No, close app: No
128[1228:18CC]i401: Received result of system request to shut down the process: closing: Yes, elevated: No, critical: No, logoff: No, close app: No
129[0DDC:0954]i400: Received system request to shut down the process: allowed: Yes, elevated: Yes, critical: No, logoff: No, close app: No
130[0DDC:0954]i401: Received result of system request to shut down the process: closing: Yes, elevated: Yes, critical: No, logoff: No, close app: No
131=======================================
132
133(9. Uninstall the bundle)
134
135CanRestartFromUnelevatedPerUserBundleWithShutdownPrivilege
136
137 Note: Requires different User Rights Assignment settings from CanLogRestartFailure - Administrators and Users should have the shutdown privilege.
138
1391. Run BundleC.exe unelevated with the command line EXEEXITCODE=3010.
1402. Click Install.
1413. Verify that there was no UAC prompt.
1424. Verify the Restart button doesn't have the UAC shield and then click it.
1435. Verify that there was no UAC prompt.
1446. The machine should restart.
1457. Login to the machine.
1468. Verify that the bundle did not automatically start running.
1479. Look in the bundle log and verify that the restart request didn't cause any errors, and that it logged messages that look like (there should be no elevated i400 and i401 and the process id for w005 must match):
148
149[1228:0448]w005: Restarting computer...
150[1228:18CC]i400: Received system request to shut down the process: allowed: Yes, elevated: No, critical: No, logoff: No, close app: No
151[1228:18CC]i401: Received result of system request to shut down the process: closing: Yes, elevated: No, critical: No, logoff: No, close app: No
152=======================================
153
110(10. Uninstall the bundle) 154(10. Uninstall the bundle)
diff --git a/src/test/burn/TestData/Manual/BundleC/BundleC.wixproj b/src/test/burn/TestData/Manual/BundleC/BundleC.wixproj
new file mode 100644
index 00000000..eabd529c
--- /dev/null
+++ b/src/test/burn/TestData/Manual/BundleC/BundleC.wixproj
@@ -0,0 +1,18 @@
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<Project Sdk="WixToolset.Sdk">
3 <PropertyGroup>
4 <OutputType>Bundle</OutputType>
5 <BA>hyperlinkLicense</BA>
6 <UpgradeCode>{5CAE82BB-A2F3-4994-9BA8-4ACEAFAE7738}</UpgradeCode>
7 </PropertyGroup>
8 <ItemGroup>
9 <Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" />
10 </ItemGroup>
11 <ItemGroup>
12 <ProjectReference Include="..\PackagePerUser\PackagePerUser.wixproj" />
13 <ProjectReference Include="..\..\TestBA\TestBAWixlib\testbawixlib.wixproj" />
14 </ItemGroup>
15 <ItemGroup>
16 <PackageReference Include="WixToolset.Bal.wixext" />
17 </ItemGroup>
18</Project> \ No newline at end of file
diff --git a/src/test/burn/TestData/Manual/BundleC/BundleC.wxs b/src/test/burn/TestData/Manual/BundleC/BundleC.wxs
new file mode 100644
index 00000000..aadcd8b2
--- /dev/null
+++ b/src/test/burn/TestData/Manual/BundleC/BundleC.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
4<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
5 <Fragment>
6 <PackageGroup Id="BundlePackages">
7 <MsiPackage Id="PackagePerUser" SourceFile="$(var.PackagePerUser.TargetPath)" />
8 <ExePackage Id="ExeA" Cache="remove" PerMachine="no"
9 DetectCondition="" Permanent="yes" InstallArguments="/ec [EXEEXITCODE]">
10 <PayloadGroupRef Id="TestExePayloads" />
11 </ExePackage>
12 </PackageGroup>
13 <Variable Name="EXEEXITCODE" bal:Overridable="yes" Value="0" />
14 </Fragment>
15</Wix>
diff --git a/src/test/burn/TestData/Manual/PackagePerUser/PackagePerUser.wixproj b/src/test/burn/TestData/Manual/PackagePerUser/PackagePerUser.wixproj
new file mode 100644
index 00000000..0efa4d63
--- /dev/null
+++ b/src/test/burn/TestData/Manual/PackagePerUser/PackagePerUser.wixproj
@@ -0,0 +1,9 @@
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<Project Sdk="WixToolset.Sdk">
3 <PropertyGroup>
4 <UpgradeCode>{F7FBAC90-07A6-4DEB-A9C5-E267EDDA28EF}</UpgradeCode>
5 </PropertyGroup>
6 <ItemGroup>
7 <Compile Include="..\..\Templates\PackagePerUser.wxs" Link="PackagePerUser.wxs" />
8 </ItemGroup>
9</Project> \ No newline at end of file