From 780cd25e41f2d2982807a0a2a24a734684d27fe6 Mon Sep 17 00:00:00 2001 From: Sean Hall <r.sean.hall@gmail.com> Date: Fri, 15 May 2020 13:48:38 +1000 Subject: WIXFEAT:6164 Add OnPlanMsiPackage. --- src/balutil/inc/BAFunctions.h | 1 + src/balutil/inc/BalBaseBAFunctions.h | 15 +++++++++++++++ src/balutil/inc/BalBaseBAFunctionsProc.h | 1 + src/balutil/inc/BalBaseBootstrapperApplication.h | 16 ++++++++++++++++ src/balutil/inc/BalBaseBootstrapperApplicationProc.h | 14 +++++++++++++- src/balutil/inc/IBootstrapperApplication.h | 14 ++++++++++++++ 6 files changed, 60 insertions(+), 1 deletion(-) (limited to 'src/balutil') diff --git a/src/balutil/inc/BAFunctions.h b/src/balutil/inc/BAFunctions.h index 1338253d..8101afdb 100644 --- a/src/balutil/inc/BAFunctions.h +++ b/src/balutil/inc/BAFunctions.h @@ -64,6 +64,7 @@ enum BA_FUNCTIONS_MESSAGE BA_FUNCTIONS_MESSAGE_ONAPPLYCOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYCOMPLETE, BA_FUNCTIONS_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN, BA_FUNCTIONS_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE, + BA_FUNCTIONS_MESSAGE_ONPLANMSIPACKAGE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIPACKAGE, BA_FUNCTIONS_MESSAGE_ONTHEMELOADED = 1024, BA_FUNCTIONS_MESSAGE_WNDPROC, diff --git a/src/balutil/inc/BalBaseBAFunctions.h b/src/balutil/inc/BalBaseBAFunctions.h index 411524fb..4e095fb8 100644 --- a/src/balutil/inc/BalBaseBAFunctions.h +++ b/src/balutil/inc/BalBaseBAFunctions.h @@ -298,6 +298,19 @@ public: // IBootstrapperApplication return S_OK; } + virtual STDMETHODIMP OnPlanMsiPackage( + __in_z LPCWSTR /*wzPackageId*/, + __in BOOL /*fExecute*/, + __in BOOTSTRAPPER_ACTION_STATE /*action*/, + __inout BOOL* /*pfCancel*/, + __inout BURN_MSI_PROPERTY* /*pActionMsiProperty*/, + __inout INSTALLUILEVEL* /*pUiLevel*/, + __inout BOOL* /*pfDisableExternalUiHandler*/ + ) + { + return S_OK; + } + virtual STDMETHODIMP OnPlanPackageComplete( __in_z LPCWSTR /*wzPackageId*/, __in HRESULT /*hrStatus*/, @@ -490,6 +503,8 @@ public: // IBootstrapperApplication __in_z LPCWSTR /*wzPackageId*/, __in BOOL /*fExecute*/, __in BOOTSTRAPPER_ACTION_STATE /*action*/, + __in INSTALLUILEVEL /*uiLevel*/, + __in BOOL /*fDisableExternalUiHandler*/, __inout BOOL* /*pfCancel*/ ) { diff --git a/src/balutil/inc/BalBaseBAFunctionsProc.h b/src/balutil/inc/BalBaseBAFunctionsProc.h index da0a71f7..f6ebd9f6 100644 --- a/src/balutil/inc/BalBaseBAFunctionsProc.h +++ b/src/balutil/inc/BalBaseBAFunctionsProc.h @@ -99,6 +99,7 @@ static HRESULT WINAPI BalBaseBAFunctionsProc( case BA_FUNCTIONS_MESSAGE_ONAPPLYCOMPLETE: case BA_FUNCTIONS_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN: case BA_FUNCTIONS_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE: + case BA_FUNCTIONS_MESSAGE_ONPLANMSIPACKAGE: hr = BalBaseBootstrapperApplicationProc((BOOTSTRAPPER_APPLICATION_MESSAGE)message, pvArgs, pvResults, pvContext); break; case BA_FUNCTIONS_MESSAGE_ONTHEMELOADED: diff --git a/src/balutil/inc/BalBaseBootstrapperApplication.h b/src/balutil/inc/BalBaseBootstrapperApplication.h index 269777a6..1d014419 100644 --- a/src/balutil/inc/BalBaseBootstrapperApplication.h +++ b/src/balutil/inc/BalBaseBootstrapperApplication.h @@ -311,6 +311,20 @@ public: // IBootstrapperApplication return S_OK; } + virtual STDMETHODIMP OnPlanMsiPackage( + __in_z LPCWSTR /*wzPackageId*/, + __in BOOL /*fExecute*/, + __in BOOTSTRAPPER_ACTION_STATE /*action*/, + __inout BOOL* pfCancel, + __inout BURN_MSI_PROPERTY* /*pActionMsiProperty*/, + __inout INSTALLUILEVEL* /*pUiLevel*/, + __inout BOOL* /*pfDisableExternalUiHandler*/ + ) + { + *pfCancel |= CheckCanceled(); + return S_OK; + } + virtual STDMETHODIMP OnPlanPackageComplete( __in_z LPCWSTR /*wzPackageId*/, __in HRESULT /*hrStatus*/, @@ -604,6 +618,8 @@ public: // IBootstrapperApplication __in_z LPCWSTR wzPackageId, __in BOOL fExecute, __in BOOTSTRAPPER_ACTION_STATE /*action*/, + __in INSTALLUILEVEL /*uiLevel*/, + __in BOOL /*fDisableExternalUiHandler*/, __inout BOOL* pfCancel ) { diff --git a/src/balutil/inc/BalBaseBootstrapperApplicationProc.h b/src/balutil/inc/BalBaseBootstrapperApplicationProc.h index 35bc0a9e..d25af1f7 100644 --- a/src/balutil/inc/BalBaseBootstrapperApplicationProc.h +++ b/src/balutil/inc/BalBaseBootstrapperApplicationProc.h @@ -402,7 +402,7 @@ static HRESULT BalBaseBAProcOnExecutePackageBegin( __inout BA_ONEXECUTEPACKAGEBEGIN_RESULTS* pResults ) { - return pBA->OnExecutePackageBegin(pArgs->wzPackageId, pArgs->fExecute, pArgs->action, &pResults->fCancel); + return pBA->OnExecutePackageBegin(pArgs->wzPackageId, pArgs->fExecute, pArgs->action, pArgs->uiLevel, pArgs->fDisableExternalUiHandler, &pResults->fCancel); } static HRESULT BalBaseBAProcOnExecutePatchTarget( @@ -504,6 +504,15 @@ static HRESULT BalBaseBAProcOnLaunchApprovedExeComplete( return pBA->OnLaunchApprovedExeComplete(pArgs->hrStatus, pArgs->dwProcessId); } +static HRESULT BalBaseBAProcOnPlanMsiPackage( + __in IBootstrapperApplication* pBA, + __in BA_ONPLANMSIPACKAGE_ARGS* pArgs, + __inout BA_ONPLANMSIPACKAGE_RESULTS* pResults + ) +{ + return pBA->OnPlanMsiPackage(pArgs->wzPackageId, pArgs->fExecute, pArgs->action, &pResults->fCancel, &pResults->actionMsiProperty, &pResults->uiLevel, &pResults->fDisableExternalUiHandler); +} + /******************************************************************* BalBaseBootstrapperApplicationProc - requires pvContext to be of type IBootstrapperApplication. Provides a default mapping between the new message based BA interface and @@ -689,6 +698,9 @@ static HRESULT WINAPI BalBaseBootstrapperApplicationProc( case BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE: hr = BalBaseBAProcOnLaunchApprovedExeComplete(pBA, reinterpret_cast<BA_ONLAUNCHAPPROVEDEXECOMPLETE_ARGS*>(pvArgs), reinterpret_cast<BA_ONLAUNCHAPPROVEDEXECOMPLETE_RESULTS*>(pvResults)); break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIPACKAGE: + hr = BalBaseBAProcOnPlanMsiPackage(pBA, reinterpret_cast<BA_ONPLANMSIPACKAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANMSIPACKAGE_RESULTS*>(pvResults)); + break; } } diff --git a/src/balutil/inc/IBootstrapperApplication.h b/src/balutil/inc/IBootstrapperApplication.h index 30b456c7..e17d2589 100644 --- a/src/balutil/inc/IBootstrapperApplication.h +++ b/src/balutil/inc/IBootstrapperApplication.h @@ -194,6 +194,18 @@ DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-A __inout BOOL* pfCancel ) = 0; + // OnPlanMsiPackage - called when the engine plans an MSI or MSP package. + // + STDMETHOD(OnPlanMsiPackage)( + __in_z LPCWSTR wzPackageId, + __in BOOL fExecute, // false means rollback. + __in BOOTSTRAPPER_ACTION_STATE action, + __inout BOOL* pfCancel, + __inout BURN_MSI_PROPERTY* pActionMsiProperty, + __inout INSTALLUILEVEL* pUiLevel, + __inout BOOL* pfDisableExternalUiHandler + ) = 0; + // OnPlanPackageComplete - called after the engine plans a package. // STDMETHOD(OnPlanPackageComplete)( @@ -390,6 +402,8 @@ DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-A __in_z LPCWSTR wzPackageId, __in BOOL fExecute, // false means rollback. __in BOOTSTRAPPER_ACTION_STATE action, + __in INSTALLUILEVEL uiLevel, + __in BOOL fDisableExternalUiHandler, __inout BOOL* pfCancel ) = 0; -- cgit v1.2.3-55-g6feb