aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2021-04-13 18:16:55 -0700
committerRob Mensching <rob@firegiant.com>2021-04-14 12:15:52 -0700
commitd32f770ca05748df9e356444c7e617d5eeedb60c (patch)
tree5a866f82950f9047aab6d7655ba538bcdbfb2535
parent6f7bb97daa1ae6bf2486b1c566c29e1b524b7548 (diff)
downloadwix-d32f770ca05748df9e356444c7e617d5eeedb60c.tar.gz
wix-d32f770ca05748df9e356444c7e617d5eeedb60c.tar.bz2
wix-d32f770ca05748df9e356444c7e617d5eeedb60c.zip
Allow BA to update feed source
Fixes wixtoolset/issues#5568
-rw-r--r--src/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h12
-rw-r--r--src/engine/EngineForApplication.cpp19
-rw-r--r--src/engine/detect.cpp9
-rw-r--r--src/engine/externalengine.cpp32
-rw-r--r--src/engine/externalengine.h5
-rw-r--r--src/engine/userexperience.cpp2
6 files changed, 77 insertions, 2 deletions
diff --git a/src/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h b/src/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h
index 99e9b9f0..0a974563 100644
--- a/src/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h
+++ b/src/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h
@@ -112,6 +112,7 @@ enum BOOTSTRAPPER_ENGINE_MESSAGE
112 BOOTSTRAPPER_ENGINE_MESSAGE_APPLY, 112 BOOTSTRAPPER_ENGINE_MESSAGE_APPLY,
113 BOOTSTRAPPER_ENGINE_MESSAGE_QUIT, 113 BOOTSTRAPPER_ENGINE_MESSAGE_QUIT,
114 BOOTSTRAPPER_ENGINE_MESSAGE_LAUNCHAPPROVEDEXE, 114 BOOTSTRAPPER_ENGINE_MESSAGE_LAUNCHAPPROVEDEXE,
115 BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATESOURCE,
115 BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS, 116 BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS,
116}; 117};
117 118
@@ -276,6 +277,17 @@ typedef struct _BAENGINE_LAUNCHAPPROVEDEXE_RESULTS
276 DWORD cbSize; 277 DWORD cbSize;
277} BAENGINE_LAUNCHAPPROVEDEXE_RESULTS; 278} BAENGINE_LAUNCHAPPROVEDEXE_RESULTS;
278 279
280typedef struct _BAENGINE_SETUPDATESOURCE_ARGS
281{
282 DWORD cbSize;
283 LPCWSTR wzUrl;
284} BAENGINE_SETUPDATESOURCE_ARGS;
285
286typedef struct _BAENGINE_SETUPDATESOURCE_RESULTS
287{
288 DWORD cbSize;
289} BAENGINE_SETUPDATESOURCE_RESULTS;
290
279typedef struct _BAENGINE_LOG_ARGS 291typedef struct _BAENGINE_LOG_ARGS
280{ 292{
281 DWORD cbSize; 293 DWORD cbSize;
diff --git a/src/engine/EngineForApplication.cpp b/src/engine/EngineForApplication.cpp
index 361e0f4e..83d88ba1 100644
--- a/src/engine/EngineForApplication.cpp
+++ b/src/engine/EngineForApplication.cpp
@@ -411,6 +411,22 @@ LExit:
411 return hr; 411 return hr;
412} 412}
413 413
414static HRESULT BAEngineSetUpdateSource(
415 __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
416 __in const LPVOID pvArgs,
417 __inout LPVOID pvResults
418 )
419{
420 HRESULT hr = S_OK;
421 ValidateMessageArgs(hr, pvArgs, BAENGINE_SETUPDATESOURCE_ARGS, pArgs);
422 ValidateMessageResults(hr, pvResults, BAENGINE_SETUPDATESOURCE_RESULTS, pResults);
423
424 hr = ExternalEngineSetUpdateSource(pContext->pEngineState, pArgs->wzUrl);
425
426LExit:
427 return hr;
428}
429
414HRESULT WINAPI EngineForApplicationProc( 430HRESULT WINAPI EngineForApplicationProc(
415 __in BOOTSTRAPPER_ENGINE_MESSAGE message, 431 __in BOOTSTRAPPER_ENGINE_MESSAGE message,
416 __in const LPVOID pvArgs, 432 __in const LPVOID pvArgs,
@@ -497,6 +513,9 @@ HRESULT WINAPI EngineForApplicationProc(
497 case BOOTSTRAPPER_ENGINE_MESSAGE_LAUNCHAPPROVEDEXE: 513 case BOOTSTRAPPER_ENGINE_MESSAGE_LAUNCHAPPROVEDEXE:
498 hr = BAEngineLaunchApprovedExe(pContext, pvArgs, pvResults); 514 hr = BAEngineLaunchApprovedExe(pContext, pvArgs, pvResults);
499 break; 515 break;
516 case BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATESOURCE:
517 hr = BAEngineSetUpdateSource(pContext, pvArgs, pvResults);
518 break;
500 case BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS: 519 case BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS:
501 hr = BAEngineCompareVersions(pContext, pvArgs, pvResults); 520 hr = BAEngineCompareVersions(pContext, pvArgs, pvResults);
502 break; 521 break;
diff --git a/src/engine/detect.cpp b/src/engine/detect.cpp
index 8ca74986..3a58f3dc 100644
--- a/src/engine/detect.cpp
+++ b/src/engine/detect.cpp
@@ -258,6 +258,7 @@ extern "C" HRESULT DetectUpdate(
258 BOOL fBeginCalled = FALSE; 258 BOOL fBeginCalled = FALSE;
259 BOOL fSkip = TRUE; 259 BOOL fSkip = TRUE;
260 BOOL fIgnoreError = FALSE; 260 BOOL fIgnoreError = FALSE;
261 LPWSTR sczOriginalSource = NULL;
261 262
262 // If no update source was specified, skip update detection. 263 // If no update source was specified, skip update detection.
263 if (!pUpdate->sczUpdateSource || !*pUpdate->sczUpdateSource) 264 if (!pUpdate->sczUpdateSource || !*pUpdate->sczUpdateSource)
@@ -266,7 +267,11 @@ extern "C" HRESULT DetectUpdate(
266 } 267 }
267 268
268 fBeginCalled = TRUE; 269 fBeginCalled = TRUE;
269 hr = UserExperienceOnDetectUpdateBegin(pUX, pUpdate->sczUpdateSource, &fSkip); 270
271 hr = StrAllocString(&sczOriginalSource, pUpdate->sczUpdateSource, 0);
272 ExitOnFailure(hr, "Failed to duplicate update feed source.");
273
274 hr = UserExperienceOnDetectUpdateBegin(pUX, sczOriginalSource, &fSkip);
270 ExitOnRootFailure(hr, "BA aborted detect update begin."); 275 ExitOnRootFailure(hr, "BA aborted detect update begin.");
271 276
272 if (!fSkip) 277 if (!fSkip)
@@ -276,6 +281,8 @@ extern "C" HRESULT DetectUpdate(
276 } 281 }
277 282
278LExit: 283LExit:
284 ReleaseStr(sczOriginalSource);
285
279 if (fBeginCalled) 286 if (fBeginCalled)
280 { 287 {
281 UserExperienceOnDetectUpdateComplete(pUX, hr, &fIgnoreError); 288 UserExperienceOnDetectUpdateComplete(pUX, hr, &fIgnoreError);
diff --git a/src/engine/externalengine.cpp b/src/engine/externalengine.cpp
index d881544c..fffd96bf 100644
--- a/src/engine/externalengine.cpp
+++ b/src/engine/externalengine.cpp
@@ -733,6 +733,38 @@ LExit:
733 return hr; 733 return hr;
734} 734}
735 735
736HRESULT ExternalEngineSetUpdateSource(
737 __in BURN_ENGINE_STATE* pEngineState,
738 __in_z LPCWSTR wzUrl
739 )
740{
741 HRESULT hr = S_OK;
742 BOOL fLeaveCriticalSection = FALSE;
743
744 ::EnterCriticalSection(&pEngineState->userExperience.csEngineActive);
745 fLeaveCriticalSection = TRUE;
746 hr = UserExperienceEnsureEngineInactive(&pEngineState->userExperience);
747 ExitOnFailure(hr, "Engine is active, cannot change engine state.");
748
749 if (wzUrl && *wzUrl)
750 {
751 hr = StrAllocString(&pEngineState->update.sczUpdateSource, wzUrl, 0);
752 ExitOnFailure(hr, "Failed to set feed download URL.");
753 }
754 else // no URL provided means clear out the whole download source.
755 {
756 ReleaseNullStr(pEngineState->update.sczUpdateSource);
757 }
758
759LExit:
760 if (fLeaveCriticalSection)
761 {
762 ::LeaveCriticalSection(&pEngineState->userExperience.csEngineActive);
763 }
764
765 return hr;
766}
767
736// TODO: callers need to provide the original size (at the time of first public release) of the struct instead of the current size. 768// TODO: callers need to provide the original size (at the time of first public release) of the struct instead of the current size.
737HRESULT WINAPI ExternalEngineValidateMessageParameter( 769HRESULT WINAPI ExternalEngineValidateMessageParameter(
738 __in_opt const LPVOID pv, 770 __in_opt const LPVOID pv,
diff --git a/src/engine/externalengine.h b/src/engine/externalengine.h
index 3f7bc8c8..a007e5b2 100644
--- a/src/engine/externalengine.h
+++ b/src/engine/externalengine.h
@@ -165,6 +165,11 @@ HRESULT ExternalEngineLaunchApprovedExe(
165 __in const DWORD dwWaitForInputIdleTimeout 165 __in const DWORD dwWaitForInputIdleTimeout
166 ); 166 );
167 167
168HRESULT ExternalEngineSetUpdateSource(
169 __in BURN_ENGINE_STATE* pEngineState,
170 __in_z LPCWSTR wzUrl
171 );
172
168HRESULT WINAPI ExternalEngineValidateMessageParameter( 173HRESULT WINAPI ExternalEngineValidateMessageParameter(
169 __in_opt const LPVOID pv, 174 __in_opt const LPVOID pv,
170 __in SIZE_T cbSizeOffset, 175 __in SIZE_T cbSizeOffset,
diff --git a/src/engine/userexperience.cpp b/src/engine/userexperience.cpp
index 5a225651..b81dbfb2 100644
--- a/src/engine/userexperience.cpp
+++ b/src/engine/userexperience.cpp
@@ -111,7 +111,7 @@ extern "C" HRESULT UserExperienceLoad(
111 args.pCommand = pCommand; 111 args.pCommand = pCommand;
112 args.pfnBootstrapperEngineProc = EngineForApplicationProc; 112 args.pfnBootstrapperEngineProc = EngineForApplicationProc;
113 args.pvBootstrapperEngineProcContext = pEngineContext; 113 args.pvBootstrapperEngineProcContext = pEngineContext;
114 args.qwEngineAPIVersion = MAKEQWORDVERSION(2021, 3, 2, 0); 114 args.qwEngineAPIVersion = MAKEQWORDVERSION(2021, 4, 14, 0);
115 115
116 results.cbSize = sizeof(BOOTSTRAPPER_CREATE_RESULTS); 116 results.cbSize = sizeof(BOOTSTRAPPER_CREATE_RESULTS);
117 117