diff options
author | Bob Arnson <bob@firegiant.com> | 2021-12-26 23:23:24 -0500 |
---|---|---|
committer | Bob Arnson <github@bobs.org> | 2021-12-27 09:33:51 -0500 |
commit | 4c34ad46d0eb664a48dc2b4a7696cd96c3c3a56a (patch) | |
tree | 32a66d0aecaa829ef48322d70414dee44346fa20 /src/burn/engine/registration.cpp | |
parent | 113aed110c01913941c6e6e7d24c0ce42b1f91b6 (diff) | |
download | wix-4c34ad46d0eb664a48dc2b4a7696cd96c3c3a56a.tar.gz wix-4c34ad46d0eb664a48dc2b4a7696cd96c3c3a56a.tar.bz2 wix-4c34ad46d0eb664a48dc2b4a7696cd96c3c3a56a.zip |
Remove RebootRequired per...
...https://github.com/wixtoolset/issues/issues/6668.
Diffstat (limited to 'src/burn/engine/registration.cpp')
-rw-r--r-- | src/burn/engine/registration.cpp | 62 |
1 files changed, 1 insertions, 61 deletions
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 | ||
8 | const LPCWSTR REGISTRY_RUN_KEY = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"; | 8 | const LPCWSTR REGISTRY_RUN_KEY = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"; |
9 | const LPCWSTR REGISTRY_RUN_ONCE_KEY = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce"; | 9 | const LPCWSTR REGISTRY_RUN_ONCE_KEY = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce"; |
10 | const LPCWSTR REGISTRY_REBOOT_PENDING_FORMAT = L"%ls.RebootRequired"; | ||
11 | const LPCWSTR REGISTRY_BUNDLE_INSTALLED = L"Installed"; | 10 | const LPCWSTR REGISTRY_BUNDLE_INSTALLED = L"Installed"; |
12 | const LPCWSTR REGISTRY_BUNDLE_DISPLAY_ICON = L"DisplayIcon"; | 11 | const LPCWSTR REGISTRY_BUNDLE_DISPLAY_ICON = L"DisplayIcon"; |
13 | const LPCWSTR REGISTRY_BUNDLE_DISPLAY_VERSION = L"DisplayVersion"; | 12 | const LPCWSTR REGISTRY_BUNDLE_DISPLAY_VERSION = L"DisplayVersion"; |
@@ -108,9 +107,6 @@ static HRESULT UpdateBundleNameRegistration( | |||
108 | __in BOOL fInProgressRegistration | 107 | __in BOOL fInProgressRegistration |
109 | ); | 108 | ); |
110 | static BOOL IsWuRebootPending(); | 109 | static BOOL IsWuRebootPending(); |
111 | static BOOL IsBundleRebootPending( | ||
112 | __in BURN_REGISTRATION* pRegistration | ||
113 | ); | ||
114 | static BOOL IsRegistryRebootPending(); | 110 | static 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 | ||
475 | LExit: | 471 | LExit: |
@@ -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 | ||
982 | LExit: | 947 | LExit: |
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 | ||
1400 | LExit: | 1362 | LExit: |
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 | ||
1772 | static 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 | |||
1786 | LExit: | ||
1787 | ReleaseStr(sczRebootRequiredKey); | ||
1788 | ReleaseRegKey(hkRebootRequired); | ||
1789 | |||
1790 | return fBundleRebootPending; | ||
1791 | } | ||
1792 | |||
1793 | static BOOL IsRegistryRebootPending() | 1733 | static BOOL IsRegistryRebootPending() |
1794 | { | 1734 | { |
1795 | HRESULT hr = S_OK; | 1735 | HRESULT hr = S_OK; |