aboutsummaryrefslogtreecommitdiff
path: root/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2024-01-11 18:26:20 -0800
committerRob Mensching <rob@firegiant.com>2024-03-06 18:03:38 -0800
commit0d3d54992104288e9ee0c834d0b96e8502fd2d42 (patch)
tree9efa49c4983cd2ba1becab64bd1f2faccac88acf /src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h
parent2824298d9dd817a47527c920363556b54ead5d5d (diff)
downloadwix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.tar.gz
wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.tar.bz2
wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.zip
Move the BootstrapperApplication out of proc
Diffstat (limited to 'src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h')
-rw-r--r--src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h90
1 files changed, 41 insertions, 49 deletions
diff --git a/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h b/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h
index ae7b2a93..30c75fb6 100644
--- a/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h
+++ b/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h
@@ -3,8 +3,6 @@
3#include <windows.h> 3#include <windows.h>
4#include <msiquery.h> 4#include <msiquery.h>
5 5
6#include "BootstrapperEngine.h"
7#include "BootstrapperApplication.h"
8#include "IBootstrapperEngine.h" 6#include "IBootstrapperEngine.h"
9#include "IBootstrapperApplication.h" 7#include "IBootstrapperApplication.h"
10 8
@@ -12,7 +10,9 @@
12#include "balinfo.h" 10#include "balinfo.h"
13#include "balretry.h" 11#include "balretry.h"
14 12
15class CBalBaseBootstrapperApplication : public IBootstrapperApplication 13#define CBalBaseBootstrapperApplication CBootstrapperApplication
14
15class CBootstrapperApplication : public IBootstrapperApplication
16{ 16{
17public: // IUnknown 17public: // IUnknown
18 virtual STDMETHODIMP QueryInterface( 18 virtual STDMETHODIMP QueryInterface(
@@ -65,8 +65,7 @@ public: // IBootstrapperApplication
65 virtual STDMETHODIMP_(HRESULT) BAProc( 65 virtual STDMETHODIMP_(HRESULT) BAProc(
66 __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, 66 __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/,
67 __in const LPVOID /*pvArgs*/, 67 __in const LPVOID /*pvArgs*/,
68 __inout LPVOID /*pvResults*/, 68 __inout LPVOID /*pvResults*/
69 __in_opt LPVOID /*pvContext*/
70 ) 69 )
71 { 70 {
72 return E_NOTIMPL; 71 return E_NOTIMPL;
@@ -76,10 +75,35 @@ public: // IBootstrapperApplication
76 __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/, 75 __in BOOTSTRAPPER_APPLICATION_MESSAGE /*message*/,
77 __in const LPVOID /*pvArgs*/, 76 __in const LPVOID /*pvArgs*/,
78 __inout LPVOID /*pvResults*/, 77 __inout LPVOID /*pvResults*/,
79 __inout HRESULT* /*phr*/, 78 __inout HRESULT* /*phr*/
80 __in_opt LPVOID /*pvContext*/ 79 )
80 {
81 }
82
83 virtual STDMETHODIMP OnCreate(
84 __in IBootstrapperEngine* pEngine,
85 __in BOOTSTRAPPER_COMMAND* pCommand
86 )
87 {
88 HRESULT hr = S_OK;
89
90 m_commandDisplay = pCommand->display;
91
92 hr = BalInfoParseCommandLine(&m_BalInfoCommand, pCommand);
93 BalExitOnFailure(hr, "Failed to parse command line with balutil.");
94
95 pEngine->AddRef();
96 m_pEngine = pEngine;
97
98 LExit:
99 return hr;
100 }
101
102 virtual STDMETHODIMP OnDestroy(
103 __in BOOL /*fReload*/
81 ) 104 )
82 { 105 {
106 return S_OK;
83 } 107 }
84 108
85 virtual STDMETHODIMP OnStartup() 109 virtual STDMETHODIMP OnStartup()
@@ -429,7 +453,7 @@ public: // IBootstrapperApplication
429 m_dwProgressPercentage = dwProgressPercentage; 453 m_dwProgressPercentage = dwProgressPercentage;
430 m_dwOverallProgressPercentage = dwOverallProgressPercentage; 454 m_dwOverallProgressPercentage = dwOverallProgressPercentage;
431 455
432 if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_display) 456 if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_commandDisplay)
433 { 457 {
434 hr = m_pEngine->SendEmbeddedProgress(m_dwProgressPercentage, m_dwOverallProgressPercentage, &nResult); 458 hr = m_pEngine->SendEmbeddedProgress(m_dwProgressPercentage, m_dwOverallProgressPercentage, &nResult);
435 BalExitOnFailure(hr, "Failed to send embedded overall progress."); 459 BalExitOnFailure(hr, "Failed to send embedded overall progress.");
@@ -463,7 +487,7 @@ public: // IBootstrapperApplication
463 { 487 {
464 BalRetryErrorOccurred(wzPackageId, dwCode); 488 BalRetryErrorOccurred(wzPackageId, dwCode);
465 489
466 if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_display) 490 if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_commandDisplay)
467 { 491 {
468 HRESULT hr = m_pEngine->SendEmbeddedError(dwCode, wzError, dwUIHint, pResult); 492 HRESULT hr = m_pEngine->SendEmbeddedError(dwCode, wzError, dwUIHint, pResult);
469 if (FAILED(hr)) 493 if (FAILED(hr))
@@ -475,7 +499,7 @@ public: // IBootstrapperApplication
475 { 499 {
476 *pResult = IDCANCEL; 500 *pResult = IDCANCEL;
477 } 501 }
478 else if (BOOTSTRAPPER_DISPLAY_FULL == m_display) 502 else if (BOOTSTRAPPER_DISPLAY_FULL == m_commandDisplay)
479 { 503 {
480 if (BOOTSTRAPPER_ERROR_TYPE_HTTP_AUTH_SERVER == errorType || BOOTSTRAPPER_ERROR_TYPE_HTTP_AUTH_PROXY == errorType) 504 if (BOOTSTRAPPER_ERROR_TYPE_HTTP_AUTH_SERVER == errorType || BOOTSTRAPPER_ERROR_TYPE_HTTP_AUTH_PROXY == errorType)
481 { 505 {
@@ -553,7 +577,7 @@ public: // IBootstrapperApplication
553 577
554 // Send progress even though we don't update the numbers to at least give the caller an opportunity 578 // Send progress even though we don't update the numbers to at least give the caller an opportunity
555 // to cancel. 579 // to cancel.
556 if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_display) 580 if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_commandDisplay)
557 { 581 {
558 hr = m_pEngine->SendEmbeddedProgress(m_dwProgressPercentage, m_dwOverallProgressPercentage, &nResult); 582 hr = m_pEngine->SendEmbeddedProgress(m_dwProgressPercentage, m_dwOverallProgressPercentage, &nResult);
559 BalExitOnFailure(hr, "Failed to send embedded cache progress."); 583 BalExitOnFailure(hr, "Failed to send embedded cache progress.");
@@ -733,7 +757,7 @@ public: // IBootstrapperApplication
733 757
734 // Send progress even though we don't update the numbers to at least give the caller an opportunity 758 // Send progress even though we don't update the numbers to at least give the caller an opportunity
735 // to cancel. 759 // to cancel.
736 if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_display) 760 if (BOOTSTRAPPER_DISPLAY_EMBEDDED == m_commandDisplay)
737 { 761 {
738 hr = m_pEngine->SendEmbeddedProgress(m_dwProgressPercentage, m_dwOverallProgressPercentage, &nResult); 762 hr = m_pEngine->SendEmbeddedProgress(m_dwProgressPercentage, m_dwOverallProgressPercentage, &nResult);
739 BalExitOnFailure(hr, "Failed to send embedded execute progress."); 763 BalExitOnFailure(hr, "Failed to send embedded execute progress.");
@@ -848,7 +872,7 @@ public: // IBootstrapperApplication
848 { 872 {
849 HRESULT hr = S_OK; 873 HRESULT hr = S_OK;
850 BOOL fRestartRequired = BOOTSTRAPPER_APPLY_RESTART_REQUIRED == restart; 874 BOOL fRestartRequired = BOOTSTRAPPER_APPLY_RESTART_REQUIRED == restart;
851 BOOL fShouldBlockRestart = BOOTSTRAPPER_DISPLAY_FULL <= m_display && BAL_INFO_RESTART_PROMPT >= m_BalInfoCommand.restart; 875 BOOL fShouldBlockRestart = BOOTSTRAPPER_DISPLAY_FULL <= m_commandDisplay && BAL_INFO_RESTART_PROMPT >= m_BalInfoCommand.restart;
852 876
853 if (fRestartRequired && !fShouldBlockRestart) 877 if (fRestartRequired && !fShouldBlockRestart)
854 { 878 {
@@ -1050,20 +1074,6 @@ public: // IBootstrapperApplication
1050 return S_OK; 1074 return S_OK;
1051 } 1075 }
1052 1076
1053 virtual STDMETHODIMP OnSetUpdateBegin()
1054 {
1055 return S_OK;
1056 }
1057
1058 virtual STDMETHODIMP OnSetUpdateComplete(
1059 __in HRESULT /*hrStatus*/,
1060 __in_z_opt LPCWSTR /*wzPreviousPackageId*/,
1061 __in_z_opt LPCWSTR /*wzNewPackageId*/
1062 )
1063 {
1064 return S_OK;
1065 }
1066
1067 virtual STDMETHODIMP OnPlanRestoreRelatedBundle( 1077 virtual STDMETHODIMP OnPlanRestoreRelatedBundle(
1068 __in_z LPCWSTR /*wzBundleId*/, 1078 __in_z LPCWSTR /*wzBundleId*/,
1069 __in BOOTSTRAPPER_REQUEST_STATE /*recommendedState*/, 1079 __in BOOTSTRAPPER_REQUEST_STATE /*recommendedState*/,
@@ -1127,22 +1137,6 @@ public: // IBootstrapperApplication
1127 return S_OK; 1137 return S_OK;
1128 } 1138 }
1129 1139
1130public: //CBalBaseBootstrapperApplication
1131 virtual STDMETHODIMP Initialize(
1132 __in const BOOTSTRAPPER_CREATE_ARGS* pCreateArgs
1133 )
1134 {
1135 HRESULT hr = S_OK;
1136
1137 m_display = pCreateArgs->pCommand->display;
1138
1139 hr = BalInfoParseCommandLine(&m_BalInfoCommand, pCreateArgs->pCommand);
1140 BalExitOnFailure(hr, "Failed to parse command line with balutil.");
1141
1142 LExit:
1143 return hr;
1144 }
1145
1146protected: 1140protected:
1147 // 1141 //
1148 // PromptCancel - prompts the user to close (if not forced). 1142 // PromptCancel - prompts the user to close (if not forced).
@@ -1195,16 +1189,14 @@ protected:
1195 } 1189 }
1196 1190
1197 CBalBaseBootstrapperApplication( 1191 CBalBaseBootstrapperApplication(
1198 __in IBootstrapperEngine* pEngine,
1199 __in DWORD dwRetryCount = 0, 1192 __in DWORD dwRetryCount = 0,
1200 __in DWORD dwRetryTimeout = 1000 1193 __in DWORD dwRetryTimeout = 1000
1201 ) 1194 )
1202 { 1195 {
1203 m_cReferences = 1; 1196 m_cReferences = 1;
1204 m_display = BOOTSTRAPPER_DISPLAY_UNKNOWN; 1197 m_commandDisplay = BOOTSTRAPPER_DISPLAY_UNKNOWN;
1205 1198
1206 pEngine->AddRef(); 1199 m_pEngine = NULL;
1207 m_pEngine = pEngine;
1208 1200
1209 ::InitializeCriticalSection(&m_csCanceled); 1201 ::InitializeCriticalSection(&m_csCanceled);
1210 m_fCanceled = FALSE; 1202 m_fCanceled = FALSE;
@@ -1230,12 +1222,12 @@ protected:
1230 CRITICAL_SECTION m_csCanceled; 1222 CRITICAL_SECTION m_csCanceled;
1231 BOOL m_fCanceled; 1223 BOOL m_fCanceled;
1232 1224
1225 IBootstrapperEngine* m_pEngine;
1233 BAL_INFO_COMMAND m_BalInfoCommand; 1226 BAL_INFO_COMMAND m_BalInfoCommand;
1234 1227
1235private: 1228private:
1236 long m_cReferences; 1229 long m_cReferences;
1237 BOOTSTRAPPER_DISPLAY m_display; 1230 BOOTSTRAPPER_DISPLAY m_commandDisplay;
1238 IBootstrapperEngine* m_pEngine;
1239 1231
1240 BOOL m_fRollingBack; 1232 BOOL m_fRollingBack;
1241 1233