aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/burn/burn.cmd2
-rw-r--r--src/burn/burn.sln7
-rw-r--r--src/burn/engine/engine.mc6
-rw-r--r--src/burn/engine/registration.cpp62
-rw-r--r--src/burn/test/BurnUnitTest/BurnUnitTest.vcxproj20
-rw-r--r--src/burn/test/BurnUnitTest/RegistrationTest.cpp1
6 files changed, 20 insertions, 78 deletions
diff --git a/src/burn/burn.cmd b/src/burn/burn.cmd
index 55478eb2..10d56558 100644
--- a/src/burn/burn.cmd
+++ b/src/burn/burn.cmd
@@ -12,7 +12,7 @@
12 12
13nuget restore || exit /b 13nuget restore || exit /b
14 14
15msbuild -t:Test -p:Configuration=%_C% test\BurnUnitTest || exit /b 15msbuild -t:Test -p:Configuration=%_C%;Platform=x86 test\BurnUnitTest || exit /b
16 16
17msbuild -t:Build -p:Configuration=%_C%;Platform=x86 || exit /b 17msbuild -t:Build -p:Configuration=%_C%;Platform=x86 || exit /b
18msbuild -t:Build -p:Configuration=%_C%;Platform=x64 || exit /b 18msbuild -t:Build -p:Configuration=%_C%;Platform=x64 || exit /b
diff --git a/src/burn/burn.sln b/src/burn/burn.sln
index 95d8c511..0a6227a5 100644
--- a/src/burn/burn.sln
+++ b/src/burn/burn.sln
@@ -1,7 +1,7 @@
1 1
2Microsoft Visual Studio Solution File, Format Version 12.00 2Microsoft Visual Studio Solution File, Format Version 12.00
3# Visual Studio Version 16 3# Visual Studio Version 17
4VisualStudioVersion = 16.0.30711.63 4VisualStudioVersion = 17.0.32014.148
5MinimumVisualStudioVersion = 15.0.26124.0 5MinimumVisualStudioVersion = 15.0.26124.0
6Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "engine", "engine\engine.vcxproj", "{8119537D-E1D9-6591-D51A-49768A2F9C37}" 6Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "engine", "engine\engine.vcxproj", "{8119537D-E1D9-6591-D51A-49768A2F9C37}"
7EndProject 7EndProject
@@ -44,7 +44,8 @@ Global
44 {C38373AA-882F-4F55-B03F-2AAB4BFBE3F1}.Release|x86.ActiveCfg = Release|Win32 44 {C38373AA-882F-4F55-B03F-2AAB4BFBE3F1}.Release|x86.ActiveCfg = Release|Win32
45 {C38373AA-882F-4F55-B03F-2AAB4BFBE3F1}.Release|x86.Build.0 = Release|Win32 45 {C38373AA-882F-4F55-B03F-2AAB4BFBE3F1}.Release|x86.Build.0 = Release|Win32
46 {9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Debug|ARM64.ActiveCfg = Debug|ARM64 46 {9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Debug|ARM64.ActiveCfg = Debug|ARM64
47 {9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Debug|x64.ActiveCfg = Debug|Win32 47 {9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Debug|x64.ActiveCfg = Debug|x64
48 {9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Debug|x64.Build.0 = Debug|x64
48 {9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Debug|x86.ActiveCfg = Debug|Win32 49 {9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Debug|x86.ActiveCfg = Debug|Win32
49 {9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Debug|x86.Build.0 = Debug|Win32 50 {9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Debug|x86.Build.0 = Debug|Win32
50 {9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Release|ARM64.ActiveCfg = Release|ARM64 51 {9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Release|ARM64.ActiveCfg = Release|ARM64
diff --git a/src/burn/engine/engine.mc b/src/burn/engine/engine.mc
index 29e4f956..dde4d40b 100644
--- a/src/burn/engine/engine.mc
+++ b/src/burn/engine/engine.mc
@@ -1131,9 +1131,3 @@ Language=English
1131Skipping MSI property '%1!ls!' because condition '%2!ls!' evaluates to %3!hs!. 1131Skipping MSI property '%1!ls!' because condition '%2!ls!' evaluates to %3!hs!.
1132. 1132.
1133 1133
1134MessageId=701
1135Severity=Warning
1136SymbolicName=MSG_PENDING_REBOOT_DETECTED
1137Language=English
1138A reboot is pending from a prior execution of this bundle: %1!ls!. Apply will be blocked. Continuing...
1139.
diff --git a/src/burn/engine/registration.cpp b/src/burn/engine/registration.cpp
index 54a5a928..e06767e1 100644
--- a/src/burn/engine/registration.cpp
+++ b/src/burn/engine/registration.cpp
@@ -7,7 +7,6 @@
7 7
8const LPCWSTR REGISTRY_RUN_KEY = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"; 8const LPCWSTR REGISTRY_RUN_KEY = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
9const LPCWSTR REGISTRY_RUN_ONCE_KEY = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce"; 9const LPCWSTR REGISTRY_RUN_ONCE_KEY = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce";
10const LPCWSTR REGISTRY_REBOOT_PENDING_FORMAT = L"%ls.RebootRequired";
11const LPCWSTR REGISTRY_BUNDLE_INSTALLED = L"Installed"; 10const LPCWSTR REGISTRY_BUNDLE_INSTALLED = L"Installed";
12const LPCWSTR REGISTRY_BUNDLE_DISPLAY_ICON = L"DisplayIcon"; 11const LPCWSTR REGISTRY_BUNDLE_DISPLAY_ICON = L"DisplayIcon";
13const LPCWSTR REGISTRY_BUNDLE_DISPLAY_VERSION = L"DisplayVersion"; 12const LPCWSTR REGISTRY_BUNDLE_DISPLAY_VERSION = L"DisplayVersion";
@@ -108,9 +107,6 @@ static HRESULT UpdateBundleNameRegistration(
108 __in BOOL fInProgressRegistration 107 __in BOOL fInProgressRegistration
109 ); 108 );
110static BOOL IsWuRebootPending(); 109static BOOL IsWuRebootPending();
111static BOOL IsBundleRebootPending(
112 __in BURN_REGISTRATION* pRegistration
113);
114static BOOL IsRegistryRebootPending(); 110static BOOL IsRegistryRebootPending();
115 111
116// function definitions 112// function definitions
@@ -469,7 +465,7 @@ extern "C" HRESULT RegistrationSetVariables(
469 hr = VariableSetVersion(pVariables, BURN_BUNDLE_VERSION, pRegistration->pVersion, TRUE); 465 hr = VariableSetVersion(pVariables, BURN_BUNDLE_VERSION, pRegistration->pVersion, TRUE);
470 ExitOnFailure(hr, "Failed to overwrite the bundle version built-in variable."); 466 ExitOnFailure(hr, "Failed to overwrite the bundle version built-in variable.");
471 467
472 hr = VariableSetNumeric(pVariables, BURN_REBOOT_PENDING, IsBundleRebootPending(pRegistration) || IsWuRebootPending() || IsRegistryRebootPending(), TRUE); 468 hr = VariableSetNumeric(pVariables, BURN_REBOOT_PENDING, IsWuRebootPending() || IsRegistryRebootPending(), TRUE);
473 ExitOnFailure(hr, "Failed to overwrite the bundle reboot-pending built-in variable."); 469 ExitOnFailure(hr, "Failed to overwrite the bundle reboot-pending built-in variable.");
474 470
475LExit: 471LExit:
@@ -521,14 +517,6 @@ extern "C" HRESULT RegistrationDetectResumeType(
521 HKEY hkRegistration = NULL; 517 HKEY hkRegistration = NULL;
522 DWORD dwResume = 0; 518 DWORD dwResume = 0;
523 519
524 if (IsBundleRebootPending(pRegistration))
525 {
526 LogId(REPORT_STANDARD, MSG_PENDING_REBOOT_DETECTED, pRegistration->sczRegistrationKey);
527
528 *pResumeType = BOOTSTRAPPER_RESUME_TYPE_REBOOT_PENDING;
529 ExitFunction1(hr = S_OK);
530 }
531
532 // open registration key 520 // open registration key
533 hr = RegOpen(pRegistration->hkRoot, pRegistration->sczRegistrationKey, KEY_QUERY_VALUE, &hkRegistration); 521 hr = RegOpen(pRegistration->hkRoot, pRegistration->sczRegistrationKey, KEY_QUERY_VALUE, &hkRegistration);
534 if (E_FILENOTFOUND == hr || E_PATHNOTFOUND == hr) 522 if (E_FILENOTFOUND == hr || E_PATHNOTFOUND == hr)
@@ -905,31 +893,8 @@ extern "C" HRESULT RegistrationSessionEnd(
905 ) 893 )
906{ 894{
907 HRESULT hr = S_OK; 895 HRESULT hr = S_OK;
908 LPWSTR sczRebootRequiredKey = NULL;
909 HKEY hkRebootRequired = NULL;
910 HKEY hkRegistration = NULL; 896 HKEY hkRegistration = NULL;
911 897
912 // If a restart is required for any reason, write a volatile registry key to track of
913 // of that fact until the reboot has taken place.
914 if (BOOTSTRAPPER_APPLY_RESTART_NONE != restart)
915 {
916 // We'll write the volatile registry key right next to the bundle ARP registry key
917 // because that's easy. This is all best effort since the worst case just means in
918 // the rare case the user launches the same install again before taking the restart
919 // the BA won't know a restart was still required.
920 hr = StrAllocFormatted(&sczRebootRequiredKey, REGISTRY_REBOOT_PENDING_FORMAT, pRegistration->sczRegistrationKey);
921 if (SUCCEEDED(hr))
922 {
923 hr = RegCreateEx(pRegistration->hkRoot, sczRebootRequiredKey, KEY_WRITE, TRUE, NULL, &hkRebootRequired, NULL);
924 }
925
926 if (FAILED(hr))
927 {
928 ExitTraceSource(DUTIL_SOURCE_DEFAULT, hr, "Failed to write volatile reboot required registry key.");
929 hr = S_OK;
930 }
931 }
932
933 // If no resume mode, then remove the bundle registration. 898 // If no resume mode, then remove the bundle registration.
934 if (BURN_RESUME_MODE_NONE == resumeMode) 899 if (BURN_RESUME_MODE_NONE == resumeMode)
935 { 900 {
@@ -981,8 +946,6 @@ extern "C" HRESULT RegistrationSessionEnd(
981 946
982LExit: 947LExit:
983 ReleaseRegKey(hkRegistration); 948 ReleaseRegKey(hkRegistration);
984 ReleaseRegKey(hkRebootRequired);
985 ReleaseStr(sczRebootRequiredKey);
986 949
987 return hr; 950 return hr;
988} 951}
@@ -1320,7 +1283,6 @@ static HRESULT UpdateResumeMode(
1320{ 1283{
1321 HRESULT hr = S_OK; 1284 HRESULT hr = S_OK;
1322 DWORD er = ERROR_SUCCESS; 1285 DWORD er = ERROR_SUCCESS;
1323 HKEY hkRebootRequired = NULL;
1324 HKEY hkRun = NULL; 1286 HKEY hkRun = NULL;
1325 LPWSTR sczRunOnceCommandLine = NULL; 1287 LPWSTR sczRunOnceCommandLine = NULL;
1326 LPCWSTR sczResumeKey = REGISTRY_RUN_ONCE_KEY; 1288 LPCWSTR sczResumeKey = REGISTRY_RUN_ONCE_KEY;
@@ -1399,7 +1361,6 @@ static HRESULT UpdateResumeMode(
1399 1361
1400LExit: 1362LExit:
1401 ReleaseStr(sczRunOnceCommandLine); 1363 ReleaseStr(sczRunOnceCommandLine);
1402 ReleaseRegKey(hkRebootRequired);
1403 ReleaseRegKey(hkRun); 1364 ReleaseRegKey(hkRun);
1404 1365
1405 return hr; 1366 return hr;
@@ -1769,27 +1730,6 @@ static BOOL IsWuRebootPending()
1769 return fRebootPending; 1730 return fRebootPending;
1770} 1731}
1771 1732
1772static BOOL IsBundleRebootPending(BURN_REGISTRATION* pRegistration)
1773{
1774 HRESULT hr = S_OK;
1775 LPWSTR sczRebootRequiredKey = NULL;
1776 HKEY hkRebootRequired = NULL;
1777 BOOL fBundleRebootPending = FALSE;
1778
1779 // Check to see if a restart is pending for this bundle.
1780 hr = StrAllocFormatted(&sczRebootRequiredKey, REGISTRY_REBOOT_PENDING_FORMAT, pRegistration->sczRegistrationKey);
1781 ExitOnFailure(hr, "Failed to format pending restart registry key to read.");
1782
1783 hr = RegOpen(pRegistration->hkRoot, sczRebootRequiredKey, KEY_QUERY_VALUE, &hkRebootRequired);
1784 fBundleRebootPending = SUCCEEDED(hr);
1785
1786LExit:
1787 ReleaseStr(sczRebootRequiredKey);
1788 ReleaseRegKey(hkRebootRequired);
1789
1790 return fBundleRebootPending;
1791}
1792
1793static BOOL IsRegistryRebootPending() 1733static BOOL IsRegistryRebootPending()
1794{ 1734{
1795 HRESULT hr = S_OK; 1735 HRESULT hr = S_OK;
diff --git a/src/burn/test/BurnUnitTest/BurnUnitTest.vcxproj b/src/burn/test/BurnUnitTest/BurnUnitTest.vcxproj
index c038dccd..714b6549 100644
--- a/src/burn/test/BurnUnitTest/BurnUnitTest.vcxproj
+++ b/src/burn/test/BurnUnitTest/BurnUnitTest.vcxproj
@@ -5,22 +5,30 @@
5 <Import Project="..\..\..\internal\WixBuildTools.TestSupport.Native\build\WixBuildTools.TestSupport.Native.props" /> 5 <Import Project="..\..\..\internal\WixBuildTools.TestSupport.Native\build\WixBuildTools.TestSupport.Native.props" />
6 6
7 <ItemGroup Label="ProjectConfigurations"> 7 <ItemGroup Label="ProjectConfigurations">
8 <ProjectConfiguration Include="Debug|ARM64">
9 <Configuration>Debug</Configuration>
10 <Platform>ARM64</Platform>
11 </ProjectConfiguration>
12 <ProjectConfiguration Include="Debug|Win32"> 8 <ProjectConfiguration Include="Debug|Win32">
13 <Configuration>Debug</Configuration> 9 <Configuration>Debug</Configuration>
14 <Platform>Win32</Platform> 10 <Platform>Win32</Platform>
15 </ProjectConfiguration> 11 </ProjectConfiguration>
16 <ProjectConfiguration Include="Release|ARM64"> 12 <ProjectConfiguration Include="Debug|x64">
17 <Configuration>Release</Configuration> 13 <Configuration>Debug</Configuration>
14 <Platform>x64</Platform>
15 </ProjectConfiguration>
16 <ProjectConfiguration Include="Debug|ARM64">
17 <Configuration>Debug</Configuration>
18 <Platform>ARM64</Platform> 18 <Platform>ARM64</Platform>
19 </ProjectConfiguration> 19 </ProjectConfiguration>
20 <ProjectConfiguration Include="Release|Win32"> 20 <ProjectConfiguration Include="Release|Win32">
21 <Configuration>Release</Configuration> 21 <Configuration>Release</Configuration>
22 <Platform>Win32</Platform> 22 <Platform>Win32</Platform>
23 </ProjectConfiguration> 23 </ProjectConfiguration>
24 <ProjectConfiguration Include="Release|x64">
25 <Configuration>Release</Configuration>
26 <Platform>x64</Platform>
27 </ProjectConfiguration>
28 <ProjectConfiguration Include="Release|ARM64">
29 <Configuration>Release</Configuration>
30 <Platform>ARM64</Platform>
31 </ProjectConfiguration>
24 </ItemGroup> 32 </ItemGroup>
25 33
26 <PropertyGroup Label="Globals"> 34 <PropertyGroup Label="Globals">
diff --git a/src/burn/test/BurnUnitTest/RegistrationTest.cpp b/src/burn/test/BurnUnitTest/RegistrationTest.cpp
index 94937ef6..3cf15d10 100644
--- a/src/burn/test/BurnUnitTest/RegistrationTest.cpp
+++ b/src/burn/test/BurnUnitTest/RegistrationTest.cpp
@@ -369,7 +369,6 @@ namespace Bootstrapper
369 TestThrowOnFailure(hr, L"Failed to set registration variables."); 369 TestThrowOnFailure(hr, L"Failed to set registration variables.");
370 370
371 Assert::Equal(1ll, VariableGetNumericHelper(&variables, BURN_BUNDLE_INSTALLED)); 371 Assert::Equal(1ll, VariableGetNumericHelper(&variables, BURN_BUNDLE_INSTALLED));
372 Assert::Equal(1ll, VariableGetNumericHelper(&variables, BURN_REBOOT_PENDING));
373 Assert::Equal<String^>(gcnew String(L"foo"), VariableGetStringHelper(&variables, BURN_BUNDLE_TAG)); 372 Assert::Equal<String^>(gcnew String(L"foo"), VariableGetStringHelper(&variables, BURN_BUNDLE_TAG));
374 Assert::Equal<String^>(gcnew String(L"bar"), VariableGetStringHelper(&variables, BURN_BUNDLE_PROVIDER_KEY)); 373 Assert::Equal<String^>(gcnew String(L"bar"), VariableGetStringHelper(&variables, BURN_BUNDLE_PROVIDER_KEY));
375 Assert::Equal<String^>(gcnew String(L"1.0.0.0"), VariableGetVersionHelper(&variables, BURN_BUNDLE_VERSION)); 374 Assert::Equal<String^>(gcnew String(L"1.0.0.0"), VariableGetVersionHelper(&variables, BURN_BUNDLE_VERSION));