diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-09-02 16:12:42 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-09-03 15:29:26 -0500 |
commit | 237bdc6a97c0dd455da99c16e6b3b7cac4c79e86 (patch) | |
tree | 1f2c789a7aa752e068fac8a4ca08815d13bf527a /src/test | |
parent | 7728e34e48a4fdb710ecc92dd8dca833bff3993f (diff) | |
download | wix-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')
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 | |||
94 | 2. Click Install. | 94 | 2. Click Install. |
95 | 3. Verify that the UAC prompt came up and accept elevation. | 95 | 3. Verify that the UAC prompt came up and accept elevation. |
96 | 4. Click OK on the OnExecuteBegin message box. | 96 | 4. Click OK on the OnExecuteBegin message box. |
97 | 5. Click Restart. | 97 | 5. Verify the Restart button doesn't have the UAC shield and then click it. |
98 | 6. The machine should restart. | 98 | 6. Verify that there was no UAC prompt. |
99 | 7. Login to the machine. | 99 | 7. The machine should restart. |
100 | 8. Verify that the bundle did not automatically start running. | 100 | 8. Login to the machine. |
101 | 9. 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): | 101 | 9. Verify that the bundle did not automatically start running. |
102 | 10. 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 | |||
113 | CanRestartFromUnelevatedPerUserBundleWithoutShutdownPrivilege | ||
114 | |||
115 | Note: Requires different User Rights Assignment settings from CanLogRestartFailure - Only Administrators should have the shutdown privilege. Users should not have it. | ||
116 | |||
117 | 1. Run BundleC.exe unelevated with the command line EXEEXITCODE=3010. | ||
118 | 2. Click Install. | ||
119 | 3. Verify the Restart button has the UAC shield and then click it. | ||
120 | 4. Verify that the UAC prompt came up and accept elevation. | ||
121 | 5. The machine should restart. | ||
122 | 6. Login to the machine. | ||
123 | 7. Verify that the bundle did not automatically start running. | ||
124 | 8. 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 | |||
135 | CanRestartFromUnelevatedPerUserBundleWithShutdownPrivilege | ||
136 | |||
137 | Note: Requires different User Rights Assignment settings from CanLogRestartFailure - Administrators and Users should have the shutdown privilege. | ||
138 | |||
139 | 1. Run BundleC.exe unelevated with the command line EXEEXITCODE=3010. | ||
140 | 2. Click Install. | ||
141 | 3. Verify that there was no UAC prompt. | ||
142 | 4. Verify the Restart button doesn't have the UAC shield and then click it. | ||
143 | 5. Verify that there was no UAC prompt. | ||
144 | 6. The machine should restart. | ||
145 | 7. Login to the machine. | ||
146 | 8. Verify that the bundle did not automatically start running. | ||
147 | 9. 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 | ||