From 4cd1c4e06145434ca940ac828772dc47b9d9738e Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sun, 13 Mar 2022 23:45:32 -0500 Subject: Allow the BA to override the bundle relation type during plan. --- src/api/burn/balutil/inc/BAFunctions.h | 1 + src/api/burn/balutil/inc/BalBaseBAFunctions.h | 10 ++++++++++ src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h | 1 + src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h | 11 +++++++++++ .../burn/balutil/inc/BalBaseBootstrapperApplicationProc.h | 12 ++++++++++++ src/api/burn/balutil/inc/IBootstrapperApplication.h | 8 ++++++++ 6 files changed, 43 insertions(+) (limited to 'src/api/burn/balutil/inc') diff --git a/src/api/burn/balutil/inc/BAFunctions.h b/src/api/burn/balutil/inc/BAFunctions.h index cbef88df..f772eb3f 100644 --- a/src/api/burn/balutil/inc/BAFunctions.h +++ b/src/api/burn/balutil/inc/BAFunctions.h @@ -89,6 +89,7 @@ enum BA_FUNCTIONS_MESSAGE BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE, BA_FUNCTIONS_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE, BA_FUNCTIONS_MESSAGE_ONPLANRESTORERELATEDBUNDLE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRESTORERELATEDBUNDLE, + BA_FUNCTIONS_MESSAGE_ONPLANRELATEDBUNDLETYPE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLETYPE, BA_FUNCTIONS_MESSAGE_ONTHEMELOADED = 1024, BA_FUNCTIONS_MESSAGE_WNDPROC, diff --git a/src/api/burn/balutil/inc/BalBaseBAFunctions.h b/src/api/burn/balutil/inc/BalBaseBAFunctions.h index 60a70e3e..f558828f 100644 --- a/src/api/burn/balutil/inc/BalBaseBAFunctions.h +++ b/src/api/burn/balutil/inc/BalBaseBAFunctions.h @@ -859,6 +859,16 @@ public: // IBootstrapperApplication return S_OK; } + virtual STDMETHODIMP OnPlanRelatedBundleType( + __in_z LPCWSTR /*wzBundleId*/, + __in BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE /*recommendedType*/, + __inout BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE* /*pRequestedType*/, + __inout BOOL* /*pfCancel*/ + ) + { + return S_OK; + } + public: // IBAFunctions virtual STDMETHODIMP OnPlan( ) diff --git a/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h b/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h index 09cc189e..ede00f28 100644 --- a/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h +++ b/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h @@ -160,6 +160,7 @@ static HRESULT WINAPI BalBaseBAFunctionsProc( case BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE: case BA_FUNCTIONS_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE: case BA_FUNCTIONS_MESSAGE_ONPLANRESTORERELATEDBUNDLE: + case BA_FUNCTIONS_MESSAGE_ONPLANRELATEDBUNDLETYPE: hr = BalBaseBootstrapperApplicationProc((BOOTSTRAPPER_APPLICATION_MESSAGE)message, pvArgs, pvResults, pvContext); break; case BA_FUNCTIONS_MESSAGE_ONTHEMELOADED: diff --git a/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h b/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h index 7b3cf827..49f4b7ca 100644 --- a/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h +++ b/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h @@ -1058,6 +1058,17 @@ public: // IBootstrapperApplication return S_OK; } + virtual STDMETHODIMP OnPlanRelatedBundleType( + __in_z LPCWSTR /*wzBundleId*/, + __in BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE /*recommendedType*/, + __inout BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE* /*pRequestedType*/, + __inout BOOL* pfCancel + ) + { + *pfCancel |= CheckCanceled(); + return S_OK; + } + public: //CBalBaseBootstrapperApplication virtual STDMETHODIMP Initialize( __in const BOOTSTRAPPER_CREATE_ARGS* pCreateArgs diff --git a/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h b/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h index 8c3b8b72..698349f7 100644 --- a/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h +++ b/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h @@ -729,6 +729,15 @@ static HRESULT BalBaseBAProcOnPlanRestoreRelatedBundle( return pBA->OnPlanRestoreRelatedBundle(pArgs->wzBundleId, pArgs->recommendedState, &pResults->requestedState, &pResults->fCancel); } +static HRESULT BalBaseBAProcOnPlanRelatedBundleType( + __in IBootstrapperApplication* pBA, + __in BA_ONPLANRELATEDBUNDLETYPE_ARGS* pArgs, + __inout BA_ONPLANRELATEDBUNDLETYPE_RESULTS* pResults + ) +{ + return pBA->OnPlanRelatedBundleType(pArgs->wzBundleId, pArgs->recommendedType, &pResults->requestedType, &pResults->fCancel); +} + /******************************************************************* BalBaseBootstrapperApplicationProc - requires pvContext to be of type IBootstrapperApplication. Provides a default mapping between the new message based BA interface and @@ -988,6 +997,9 @@ static HRESULT WINAPI BalBaseBootstrapperApplicationProc( case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRESTORERELATEDBUNDLE: hr = BalBaseBAProcOnPlanRestoreRelatedBundle(pBA, reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); break; + case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLETYPE: + hr = BalBaseBAProcOnPlanRelatedBundleType(pBA, reinterpret_cast(pvArgs), reinterpret_cast(pvResults)); + break; } } diff --git a/src/api/burn/balutil/inc/IBootstrapperApplication.h b/src/api/burn/balutil/inc/IBootstrapperApplication.h index e916d41e..462df0cc 100644 --- a/src/api/burn/balutil/inc/IBootstrapperApplication.h +++ b/src/api/burn/balutil/inc/IBootstrapperApplication.h @@ -699,4 +699,12 @@ DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-A __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState, __inout BOOL* pfCancel ) = 0; + + // OnPlanRelatedBundleType - called when the engine begins planning the related bundle relation type. + STDMETHOD(OnPlanRelatedBundleType)( + __in_z LPCWSTR wzBundleId, + __in BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE recommendedType, + __inout BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE* pRequestedType, + __inout BOOL* pfCancel + ) = 0; }; -- cgit v1.2.3-55-g6feb