summaryrefslogtreecommitdiff
path: root/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp')
-rw-r--r--src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp121
1 files changed, 119 insertions, 2 deletions
diff --git a/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp b/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp
index 50de2c7f..3539450e 100644
--- a/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp
+++ b/src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp
@@ -23,6 +23,7 @@ static const LPCWSTR WIXSTDBA_VARIABLE_LANGUAGE_ID = L"WixStdBALanguageId";
23static const LPCWSTR WIXSTDBA_VARIABLE_RESTART_REQUIRED = L"WixStdBARestartRequired"; 23static const LPCWSTR WIXSTDBA_VARIABLE_RESTART_REQUIRED = L"WixStdBARestartRequired";
24static const LPCWSTR WIXSTDBA_VARIABLE_SHOW_VERSION = L"WixStdBAShowVersion"; 24static const LPCWSTR WIXSTDBA_VARIABLE_SHOW_VERSION = L"WixStdBAShowVersion";
25static const LPCWSTR WIXSTDBA_VARIABLE_SUPPRESS_OPTIONS_UI = L"WixStdBASuppressOptionsUI"; 25static const LPCWSTR WIXSTDBA_VARIABLE_SUPPRESS_OPTIONS_UI = L"WixStdBASuppressOptionsUI";
26static const LPCWSTR WIXSTDBA_VARIABLE_UPDATE_AVAILABLE = L"WixStdBAUpdateAvailable";
26 27
27enum WIXSTDBA_STATE 28enum WIXSTDBA_STATE
28{ 29{
@@ -98,6 +99,11 @@ enum WIXSTDBA_CONTROL
98 WIXSTDBA_CONTROL_REPAIR_BUTTON, 99 WIXSTDBA_CONTROL_REPAIR_BUTTON,
99 WIXSTDBA_CONTROL_UNINSTALL_BUTTON, 100 WIXSTDBA_CONTROL_UNINSTALL_BUTTON,
100 101
102 // Updates
103 WIXSTDBA_CONTROL_CHECKING_FOR_UPDATES_LABEL,
104 WIXSTDBA_CONTROL_INSTALL_UPDATE_BUTTON,
105 WIXSTDBA_CONTROL_MODIFY_UPDATE_BUTTON,
106
101 // Progress page 107 // Progress page
102 WIXSTDBA_CONTROL_CACHE_PROGRESS_PACKAGE_TEXT, 108 WIXSTDBA_CONTROL_CACHE_PROGRESS_PACKAGE_TEXT,
103 WIXSTDBA_CONTROL_CACHE_PROGRESS_BAR, 109 WIXSTDBA_CONTROL_CACHE_PROGRESS_BAR,
@@ -342,6 +348,70 @@ public: // IBootstrapperApplication
342 } 348 }
343 349
344 350
351 virtual STDMETHODIMP OnDetectUpdateBegin(
352 __in_z LPCWSTR wzUpdateLocation,
353 __inout BOOL* pfCancel,
354 __inout BOOL* pfSkip
355 )
356 {
357#ifdef DEBUG
358 BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: OnDetectUpdateBegin() - update location: %ls", wzUpdateLocation);
359#endif
360
361 // Try update detection only if we have a potential update source and are in full UI mode.
362 *pfSkip = !wzUpdateLocation
363 || !*wzUpdateLocation
364 || BOOTSTRAPPER_DISPLAY_FULL != m_command.display;
365
366 ThemeShowControl(m_pControlCheckingForUpdatesLabel, *pfSkip ? SW_HIDE : SW_SHOW);
367
368 return __super::OnDetectUpdateBegin(wzUpdateLocation, pfCancel, pfSkip);
369 }
370
371
372 virtual STDMETHODIMP OnDetectUpdate(
373 __in_z LPCWSTR wzUpdateLocation,
374 __in DWORD64 dw64Size,
375 __in_z_opt LPCWSTR wzHash,
376 __in BOOTSTRAPPER_UPDATE_HASH_TYPE hashAlgorithm,
377 __in LPCWSTR wzUpdateVersion,
378 __in_z LPCWSTR wzTitle,
379 __in_z LPCWSTR wzSummary,
380 __in_z LPCWSTR wzContentType,
381 __in_z LPCWSTR wzContent,
382 __inout BOOL* pfCancel,
383 __inout BOOL* pfStopProcessingUpdates
384 )
385 {
386 HRESULT hr = S_OK;
387 int nResult = 0;
388
389 hr = VerCompareStringVersions(m_sczBundleVersion, wzUpdateVersion, TRUE/*fStrict*/, &nResult);
390 BalExitOnFailure(hr, "Failed to compare bundle version: %ls to update version: %ls.", m_sczBundleVersion, wzUpdateVersion);
391
392 // Burn sends the feed in descending version order so we need only the first one.
393 *pfStopProcessingUpdates = TRUE;
394
395 if (0 <= nResult)
396 {
397 BalLog(BOOTSTRAPPER_LOG_LEVEL_VERBOSE, "WIXSTDBA: Update version: %ls is a match or downgrade for bundle version: %ls.", wzUpdateVersion, m_sczBundleVersion);
398 }
399 else
400 {
401 BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: Update v%ls for bundle v%ls available from: %ls.", wzUpdateVersion, m_sczBundleVersion, wzUpdateLocation);
402
403 hr = BalSetVersionVariable(WIXSTDBA_VARIABLE_UPDATE_AVAILABLE, wzUpdateVersion);
404 BalExitOnFailure(hr, "Failed to set WixStdBAUpdateAvailable value: %ls.", wzUpdateVersion);
405
406 hr = m_pEngine->SetUpdate(NULL, wzUpdateLocation, dw64Size, hashAlgorithm, wzHash);
407 BalExitOnFailure(hr, "Failed to set update location: %ls.", wzUpdateLocation);
408 }
409
410 LExit:
411 return __super::OnDetectUpdate(wzUpdateLocation, dw64Size, wzHash, hashAlgorithm, wzUpdateVersion, wzTitle, wzSummary, wzContentType, wzContent, pfCancel, pfStopProcessingUpdates);
412 }
413
414
345 virtual STDMETHODIMP OnDetectComplete( 415 virtual STDMETHODIMP OnDetectComplete(
346 __in HRESULT hrStatus, 416 __in HRESULT hrStatus,
347 __in BOOL /*fEligibleForCleanup*/ 417 __in BOOL /*fEligibleForCleanup*/
@@ -3741,10 +3811,10 @@ private:
3741 3811
3742 m_state = state; 3812 m_state = state;
3743 3813
3744 // If our install is at the end (success or failure) and we're not showing full UI or 3814 // If our install is at the end (success or failure) and we're not showing full UI or not updating or
3745 // we successfully installed the prerequisite(s) and either no restart is required or can automatically restart 3815 // we successfully installed the prerequisite(s) and either no restart is required or can automatically restart
3746 // then exit. 3816 // then exit.
3747 if ((WIXSTDBA_STATE_APPLIED <= m_state && BOOTSTRAPPER_DISPLAY_FULL > m_command.display) || 3817 if ((WIXSTDBA_STATE_APPLIED <= m_state && (BOOTSTRAPPER_DISPLAY_FULL > m_command.display || BOOTSTRAPPER_ACTION_UPDATE_REPLACE == m_plannedAction)) ||
3748 (WIXSTDBA_STATE_APPLIED == m_state && m_fPrereq && (!m_fRestartRequired || m_fShouldRestart && m_fAllowRestart))) 3818 (WIXSTDBA_STATE_APPLIED == m_state && m_fPrereq && (!m_fRestartRequired || m_fShouldRestart && m_fAllowRestart)))
3749 { 3819 {
3750 // Quietly exit. 3820 // Quietly exit.
@@ -4038,6 +4108,15 @@ private:
4038 4108
4039 4109
4040 // 4110 //
4111 // OnClickUpdateButton - start the update process.
4112 //
4113 void OnClickUpdateButton()
4114 {
4115 this->OnPlan(BOOTSTRAPPER_ACTION_UPDATE_REPLACE);
4116 }
4117
4118
4119 //
4041 // OnClickCloseButton - close the application. 4120 // OnClickCloseButton - close the application.
4042 // 4121 //
4043 void OnClickCloseButton() 4122 void OnClickCloseButton()
@@ -4263,6 +4342,13 @@ private:
4263 pResults->lResult = 0; 4342 pResults->lResult = 0;
4264 ExitFunction(); 4343 ExitFunction();
4265 4344
4345 case WIXSTDBA_CONTROL_INSTALL_UPDATE_BUTTON:
4346 case WIXSTDBA_CONTROL_MODIFY_UPDATE_BUTTON:
4347 OnClickUpdateButton();
4348 fProcessed = TRUE;
4349 pResults->lResult = 0;
4350 ExitFunction();
4351
4266 case WIXSTDBA_CONTROL_LAUNCH_BUTTON: 4352 case WIXSTDBA_CONTROL_LAUNCH_BUTTON:
4267 OnClickLaunchButton(); 4353 OnClickLaunchButton();
4268 fProcessed = TRUE; 4354 fProcessed = TRUE;
@@ -4381,6 +4467,10 @@ LExit:
4381 __in HRESULT hrStatus 4467 __in HRESULT hrStatus
4382 ) 4468 )
4383 { 4469 {
4470#ifdef DEBUG
4471 BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "WIXSTDBA: SetState() - setting state to %u with status 0x%08x.", state, hrStatus);
4472#endif
4473
4384 if (FAILED(hrStatus)) 4474 if (FAILED(hrStatus))
4385 { 4475 {
4386 m_hrFinal = hrStatus; 4476 m_hrFinal = hrStatus;
@@ -4786,6 +4876,27 @@ public:
4786 m_pControlUninstallButton = NULL; 4876 m_pControlUninstallButton = NULL;
4787 ++pAssignControl; 4877 ++pAssignControl;
4788 4878
4879 pAssignControl->wId = WIXSTDBA_CONTROL_CHECKING_FOR_UPDATES_LABEL;
4880 pAssignControl->wzName = L"CheckingForUpdatesLabel";
4881 pAssignControl->ppControl = &m_pControlCheckingForUpdatesLabel;
4882 pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4883 m_pControlCheckingForUpdatesLabel = NULL;
4884 ++pAssignControl;
4885
4886 pAssignControl->wId = WIXSTDBA_CONTROL_INSTALL_UPDATE_BUTTON;
4887 pAssignControl->wzName = L"InstallUpdateButton";
4888 pAssignControl->ppControl = &m_pControlInstallUpdateButton;
4889 pAssignControl->dwAutomaticBehaviorType = THEME_CONTROL_AUTOMATIC_BEHAVIOR_ALL;
4890 m_pControlInstallUpdateButton = NULL;
4891 ++pAssignControl;
4892
4893 pAssignControl->wId = WIXSTDBA_CONTROL_MODIFY_UPDATE_BUTTON;
4894 pAssignControl->wzName = L"ModifyUpdateButton";
4895 pAssignControl->ppControl = &m_pControlModifyUpdateButton;
4896 pAssignControl->dwAutomaticBehaviorType = THEME_CONTROL_AUTOMATIC_BEHAVIOR_ALL;
4897 m_pControlModifyUpdateButton = NULL;
4898 ++pAssignControl;
4899
4789 pAssignControl->wId = WIXSTDBA_CONTROL_CACHE_PROGRESS_PACKAGE_TEXT; 4900 pAssignControl->wId = WIXSTDBA_CONTROL_CACHE_PROGRESS_PACKAGE_TEXT;
4790 pAssignControl->wzName = L"CacheProgressPackageText"; 4901 pAssignControl->wzName = L"CacheProgressPackageText";
4791 pAssignControl->ppControl = &m_pControlCacheProgressPackageText; 4902 pAssignControl->ppControl = &m_pControlCacheProgressPackageText;
@@ -4929,6 +5040,7 @@ public:
4929 ReleaseStr(m_sczLicenseUrl); 5040 ReleaseStr(m_sczLicenseUrl);
4930 ReleaseStr(m_sczBundleVersion); 5041 ReleaseStr(m_sczBundleVersion);
4931 ReleaseStr(m_sczAfterForcedRestartPackage); 5042 ReleaseStr(m_sczAfterForcedRestartPackage);
5043
4932 ReleaseNullObject(m_pEngine); 5044 ReleaseNullObject(m_pEngine);
4933 } 5045 }
4934 5046
@@ -4966,6 +5078,11 @@ private:
4966 const THEME_CONTROL* m_pControlRepairButton; 5078 const THEME_CONTROL* m_pControlRepairButton;
4967 const THEME_CONTROL* m_pControlUninstallButton; 5079 const THEME_CONTROL* m_pControlUninstallButton;
4968 5080
5081 // Update/loading pages
5082 const THEME_CONTROL* m_pControlCheckingForUpdatesLabel;
5083 const THEME_CONTROL* m_pControlInstallUpdateButton;
5084 const THEME_CONTROL* m_pControlModifyUpdateButton;
5085
4969 // Progress page 5086 // Progress page
4970 const THEME_CONTROL* m_pControlCacheProgressPackageText; 5087 const THEME_CONTROL* m_pControlCacheProgressPackageText;
4971 const THEME_CONTROL* m_pControlCacheProgressbar; 5088 const THEME_CONTROL* m_pControlCacheProgressbar;