From 10ef9d5bfbf81f454113a1c2716009831a916222 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 10 Mar 2021 15:47:59 -0600 Subject: Determine whether to ignore forward compatible bundles during Plan. --- .../inc/BootstrapperApplication.h | 20 ++++++- src/engine/core.cpp | 65 ++++++++++----------- src/engine/dependency.cpp | 23 +++----- src/engine/dependency.h | 10 ---- src/engine/detect.cpp | 48 +++------------ src/engine/detect.h | 3 +- src/engine/engine.mc | 2 +- src/engine/plan.cpp | 68 ++++++++++++++++++++++ src/engine/plan.h | 10 ++++ src/engine/registration.h | 6 +- src/engine/userexperience.cpp | 43 ++++++++++++-- src/engine/userexperience.h | 12 +++- 12 files changed, 200 insertions(+), 110 deletions(-) diff --git a/src/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h b/src/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h index 6cf3477c..c3242167 100644 --- a/src/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h +++ b/src/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h @@ -143,6 +143,7 @@ enum BOOTSTRAPPER_APPLICATION_MESSAGE BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTBEGIN, BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMRESTOREPOINTCOMPLETE, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDPACKAGE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE, }; enum BOOTSTRAPPER_APPLYCOMPLETE_ACTION @@ -496,7 +497,6 @@ struct BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_RESULTS { DWORD cbSize; BOOL fCancel; - BOOL fIgnoreBundle; }; struct BA_ONDETECTMSIFEATURE_ARGS @@ -854,6 +854,24 @@ struct BA_ONPLANCOMPLETE_RESULTS DWORD cbSize; }; +struct BA_ONPLANFORWARDCOMPATIBLEBUNDLE_ARGS +{ + DWORD cbSize; + LPCWSTR wzBundleId; + BOOTSTRAPPER_RELATION_TYPE relationType; + LPCWSTR wzBundleTag; + BOOL fPerMachine; + LPCWSTR wzVersion; + BOOL fRecommendedIgnoreBundle; +}; + +struct BA_ONPLANFORWARDCOMPATIBLEBUNDLE_RESULTS +{ + DWORD cbSize; + BOOL fCancel; + BOOL fIgnoreBundle; +}; + struct BA_ONPLANMSIFEATURE_ARGS { DWORD cbSize; diff --git a/src/engine/core.cpp b/src/engine/core.cpp index 2f18e4d2..eb8a84fe 100644 --- a/src/engine/core.cpp +++ b/src/engine/core.cpp @@ -319,15 +319,8 @@ extern "C" HRESULT CoreDetect( hr = DependencyDetectProviderKeyBundleId(&pEngineState->registration); if (SUCCEEDED(hr)) { - hr = DetectForwardCompatibleBundle(&pEngineState->userExperience, &pEngineState->command, &pEngineState->registration); + hr = DetectForwardCompatibleBundles(&pEngineState->userExperience, &pEngineState->registration); ExitOnFailure(hr, "Failed to detect forward compatible bundle."); - - // If a forward compatible bundle was detected, skip rest of bundle detection - // since we will passthrough. - if (pEngineState->registration.fEnabledForwardCompatibleBundle) - { - ExitFunction(); - } } else if (E_NOTFOUND == hr) { @@ -504,39 +497,45 @@ extern "C" HRESULT CorePlan( hr = PlanUpdateBundle(&pEngineState->userExperience, pUpgradeBundlePackage, &pEngineState->plan, &pEngineState->log, &pEngineState->variables, pEngineState->command.display, pEngineState->command.relationType, &hSyncpointEvent); ExitOnFailure(hr, "Failed to plan update."); } - else if (pEngineState->registration.fEnabledForwardCompatibleBundle) + else { - Assert(!pEngineState->plan.fPerMachine); + hr = PlanForwardCompatibleBundles(&pEngineState->userExperience, &pEngineState->command, &pEngineState->plan, &pEngineState->registration, action); + ExitOnFailure(hr, "Failed to plan forward compatible bundles."); - pForwardCompatibleBundlePackage = &pEngineState->registration.forwardCompatibleBundle; - - hr = PlanPassThroughBundle(&pEngineState->userExperience, pForwardCompatibleBundlePackage, &pEngineState->plan, &pEngineState->log, &pEngineState->variables, pEngineState->command.display, pEngineState->command.relationType, &hSyncpointEvent); - ExitOnFailure(hr, "Failed to plan passthrough."); - } - else // doing an action that modifies the machine state. - { - pEngineState->plan.fPerMachine = pEngineState->registration.fPerMachine; // default the scope of the plan to the per-machine state of the bundle. + if (pEngineState->plan.fEnabledForwardCompatibleBundle) + { + Assert(!pEngineState->plan.fPerMachine); - hr = PlanRegistration(&pEngineState->plan, &pEngineState->registration, pEngineState->command.resumeType, pEngineState->command.relationType, &fContinuePlanning); - ExitOnFailure(hr, "Failed to plan registration."); + pForwardCompatibleBundlePackage = &pEngineState->plan.forwardCompatibleBundle; - if (fContinuePlanning) + hr = PlanPassThroughBundle(&pEngineState->userExperience, pForwardCompatibleBundlePackage, &pEngineState->plan, &pEngineState->log, &pEngineState->variables, pEngineState->command.display, pEngineState->command.relationType, &hSyncpointEvent); + ExitOnFailure(hr, "Failed to plan passthrough."); + } + else // doing an action that modifies the machine state. { - // Remember the early index, because we want to be able to insert some related bundles - // into the plan before other executed packages. This particularly occurs for uninstallation - // of addons and patches, which should be uninstalled before the main product. - DWORD dwExecuteActionEarlyIndex = pEngineState->plan.cExecuteActions; + pEngineState->plan.fPerMachine = pEngineState->registration.fPerMachine; // default the scope of the plan to the per-machine state of the bundle. - // Plan the related bundles first to support downgrades with ref-counting. - hr = PlanRelatedBundlesBegin(&pEngineState->userExperience, &pEngineState->registration, pEngineState->command.relationType, &pEngineState->plan); - ExitOnFailure(hr, "Failed to plan related bundles."); + hr = PlanRegistration(&pEngineState->plan, &pEngineState->registration, pEngineState->command.resumeType, pEngineState->command.relationType, &fContinuePlanning); + ExitOnFailure(hr, "Failed to plan registration."); - hr = PlanPackages(&pEngineState->userExperience, &pEngineState->packages, &pEngineState->plan, &pEngineState->log, &pEngineState->variables, pEngineState->command.display, pEngineState->command.relationType, NULL, &hSyncpointEvent); - ExitOnFailure(hr, "Failed to plan packages."); + if (fContinuePlanning) + { + // Remember the early index, because we want to be able to insert some related bundles + // into the plan before other executed packages. This particularly occurs for uninstallation + // of addons and patches, which should be uninstalled before the main product. + DWORD dwExecuteActionEarlyIndex = pEngineState->plan.cExecuteActions; - // Schedule the update of related bundles last. - hr = PlanRelatedBundlesComplete(&pEngineState->registration, &pEngineState->plan, &pEngineState->log, &pEngineState->variables, &hSyncpointEvent, dwExecuteActionEarlyIndex); - ExitOnFailure(hr, "Failed to schedule related bundles."); + // Plan the related bundles first to support downgrades with ref-counting. + hr = PlanRelatedBundlesBegin(&pEngineState->userExperience, &pEngineState->registration, pEngineState->command.relationType, &pEngineState->plan); + ExitOnFailure(hr, "Failed to plan related bundles."); + + hr = PlanPackages(&pEngineState->userExperience, &pEngineState->packages, &pEngineState->plan, &pEngineState->log, &pEngineState->variables, pEngineState->command.display, pEngineState->command.relationType, NULL, &hSyncpointEvent); + ExitOnFailure(hr, "Failed to plan packages."); + + // Schedule the update of related bundles last. + hr = PlanRelatedBundlesComplete(&pEngineState->registration, &pEngineState->plan, &pEngineState->log, &pEngineState->variables, &hSyncpointEvent, dwExecuteActionEarlyIndex); + ExitOnFailure(hr, "Failed to schedule related bundles."); + } } } diff --git a/src/engine/dependency.cpp b/src/engine/dependency.cpp index 4833de94..9ab76551 100644 --- a/src/engine/dependency.cpp +++ b/src/engine/dependency.cpp @@ -234,6 +234,8 @@ extern "C" HRESULT DependencyDetect( BURN_REGISTRATION* pRegistration = &pEngineState->registration; STRINGDICT_HANDLE sdIgnoredDependents = NULL; BURN_PACKAGE* pPackage = NULL; + BOOL fSelfDependent = NULL != pRegistration->wzSelfDependent; + BOOL fActiveParent = NULL != pRegistration->sczActiveParent && NULL != *pRegistration->sczActiveParent; // Always leave this empty so that all dependents get detected. Plan will ignore dependents based on its own logic. hr = DictCreateStringList(&sdIgnoredDependents, INITIAL_STRINGDICT_SIZE, DICT_FLAG_CASEINSENSITIVE); @@ -263,16 +265,20 @@ extern "C" HRESULT DependencyDetect( ExitOnFailure(hr, "Failed to detect dependents for related bundle '%ls'", pPackage->sczId); } - if (pRegistration->wzSelfDependent) + if (fSelfDependent || fActiveParent) { for (DWORD i = 0; i < pRegistration->cDependents; ++i) { DEPENDENCY* pDependent = pRegistration->rgDependents + i; - if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->wzSelfDependent, -1, pDependent->sczKey, -1)) + if (fActiveParent && CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->sczActiveParent, -1, pDependent->sczKey, -1)) + { + pRegistration->fParentRegisteredAsDependent = TRUE; + } + + if (fSelfDependent && CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->wzSelfDependent, -1, pDependent->sczKey, -1)) { pRegistration->fSelfRegisteredAsDependent = TRUE; - break; } } } @@ -348,17 +354,6 @@ LExit: return hr; } -extern "C" BOOL DependencyDependentExists( - __in const BURN_REGISTRATION* pRegistration, - __in_z LPCWSTR wzDependentProviderKey - ) -{ - HRESULT hr = S_OK; - - hr = DepDependentExists(pRegistration->hkRoot, pRegistration->sczProviderKey, wzDependentProviderKey); - return SUCCEEDED(hr); -} - extern "C" HRESULT DependencyPlanPackageBegin( __in BOOL fPerMachine, __in BURN_PACKAGE* pPackage, diff --git a/src/engine/dependency.h b/src/engine/dependency.h index efb9f2f2..06a01a20 100644 --- a/src/engine/dependency.h +++ b/src/engine/dependency.h @@ -84,16 +84,6 @@ HRESULT DependencyAddIgnoreDependencies( __in_z LPCWSTR wzAddIgnoreDependencies ); -/******************************************************************** - DependencyDependentExists - Checks to see if the provider key is - already dependent on this bundle. - -*********************************************************************/ -BOOL DependencyDependentExists( - __in const BURN_REGISTRATION* pRegistration, - __in_z LPCWSTR wzDependentProviderKey - ); - /******************************************************************** DependencyPlanPackageBegin - Updates the dependency registration action depending on the calculated state for the package. diff --git a/src/engine/detect.cpp b/src/engine/detect.cpp index 4265cf9b..74e8b9ca 100644 --- a/src/engine/detect.cpp +++ b/src/engine/detect.cpp @@ -39,9 +39,9 @@ extern "C" void DetectReset( { RelatedBundlesUninitialize(&pRegistration->relatedBundles); ReleaseNullStr(pRegistration->sczDetectedProviderKeyBundleId); - pRegistration->fEnabledForwardCompatibleBundle = FALSE; - PackageUninitialize(&pRegistration->forwardCompatibleBundle); pRegistration->fSelfRegisteredAsDependent = FALSE; + pRegistration->fParentRegisteredAsDependent = FALSE; + pRegistration->fForwardCompatibleBundleExists = FALSE; pRegistration->fEligibleForCleanup = FALSE; if (pRegistration->rgIgnoredDependencies) @@ -120,46 +120,20 @@ extern "C" void DetectReset( } } -extern "C" HRESULT DetectForwardCompatibleBundle( +extern "C" HRESULT DetectForwardCompatibleBundles( __in BURN_USER_EXPERIENCE* pUX, - __in BOOTSTRAPPER_COMMAND* pCommand, __in BURN_REGISTRATION* pRegistration ) { HRESULT hr = S_OK; - BOOL fRecommendIgnore = TRUE; - BOOL fIgnoreBundle = FALSE; int nCompareResult = 0; if (pRegistration->sczDetectedProviderKeyBundleId && CSTR_EQUAL != ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->sczDetectedProviderKeyBundleId, -1, pRegistration->sczId, -1)) { - // Only change the recommendation if an active parent was provided. - if (pRegistration->sczActiveParent && *pRegistration->sczActiveParent) - { - // On install, recommend running the forward compatible bundle because there is an active parent. This - // will essentially register the parent with the forward compatible bundle. - if (BOOTSTRAPPER_ACTION_INSTALL == pCommand->action) - { - fRecommendIgnore = FALSE; - } - else if (BOOTSTRAPPER_ACTION_UNINSTALL == pCommand->action || - BOOTSTRAPPER_ACTION_MODIFY == pCommand->action || - BOOTSTRAPPER_ACTION_REPAIR == pCommand->action) - { - // When modifying the bundle, only recommend running the forward compatible bundle if the parent - // is already registered as a dependent of the provider key. - if (DependencyDependentExists(pRegistration, pRegistration->sczActiveParent)) - { - fRecommendIgnore = FALSE; - } - } - } - for (DWORD iRelatedBundle = 0; iRelatedBundle < pRegistration->relatedBundles.cRelatedBundles; ++iRelatedBundle) { BURN_RELATED_BUNDLE* pRelatedBundle = pRegistration->relatedBundles.rgRelatedBundles + iRelatedBundle; - fIgnoreBundle = fRecommendIgnore; if (BOOTSTRAPPER_RELATION_UPGRADE == pRelatedBundle->relationType && CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->sczDetectedProviderKeyBundleId, -1, pRelatedBundle->package.sczId, -1)) @@ -169,19 +143,13 @@ extern "C" HRESULT DetectForwardCompatibleBundle( if (nCompareResult <= 0) { - hr = UserExperienceOnDetectForwardCompatibleBundle(pUX, pRelatedBundle->package.sczId, pRelatedBundle->relationType, pRelatedBundle->sczTag, pRelatedBundle->package.fPerMachine, pRelatedBundle->pVersion, &fIgnoreBundle); - ExitOnRootFailure(hr, "BA aborted detect forward compatible bundle."); - - if (!fIgnoreBundle) - { - hr = PseudoBundleInitializePassthrough(&pRegistration->forwardCompatibleBundle, pCommand, NULL, pRegistration->sczActiveParent, pRegistration->sczAncestors, &pRelatedBundle->package); - ExitOnFailure(hr, "Failed to initialize update bundle."); + pRelatedBundle->fForwardCompatible = TRUE; + pRegistration->fForwardCompatibleBundleExists = TRUE; - pRegistration->fEnabledForwardCompatibleBundle = TRUE; - } + hr = UserExperienceOnDetectForwardCompatibleBundle(pUX, pRelatedBundle->package.sczId, pRelatedBundle->relationType, pRelatedBundle->sczTag, pRelatedBundle->package.fPerMachine, pRelatedBundle->pVersion); + ExitOnRootFailure(hr, "BA aborted detect forward compatible bundle."); - LogId(REPORT_STANDARD, MSG_DETECTED_FORWARD_COMPATIBLE_BUNDLE, pRelatedBundle->package.sczId, LoggingRelationTypeToString(pRelatedBundle->relationType), LoggingPerMachineToString(pRelatedBundle->package.fPerMachine), pRelatedBundle->pVersion->sczVersion, LoggingBoolToString(pRegistration->fEnabledForwardCompatibleBundle)); - break; + LogId(REPORT_STANDARD, MSG_DETECTED_FORWARD_COMPATIBLE_BUNDLE, pRelatedBundle->package.sczId, LoggingRelationTypeToString(pRelatedBundle->relationType), LoggingPerMachineToString(pRelatedBundle->package.fPerMachine), pRelatedBundle->pVersion->sczVersion); } } } diff --git a/src/engine/detect.h b/src/engine/detect.h index 7989c9dd..9bc34882 100644 --- a/src/engine/detect.h +++ b/src/engine/detect.h @@ -20,9 +20,8 @@ void DetectReset( __in BURN_PACKAGES* pPackages ); -HRESULT DetectForwardCompatibleBundle( +HRESULT DetectForwardCompatibleBundles( __in BURN_USER_EXPERIENCE* pUX, - __in BOOTSTRAPPER_COMMAND* pCommand, __in BURN_REGISTRATION* pRegistration ); diff --git a/src/engine/engine.mc b/src/engine/engine.mc index f7b18c59..687d2b60 100644 --- a/src/engine/engine.mc +++ b/src/engine/engine.mc @@ -237,7 +237,7 @@ MessageId=107 Severity=Success SymbolicName=MSG_DETECTED_FORWARD_COMPATIBLE_BUNDLE Language=English -Detected forward compatible bundle: %1!ls!, type: %2!hs!, scope: %3!hs!, version: %4!ls!, enabled: %5!hs! +Detected forward compatible bundle: %1!ls!, type: %2!hs!, scope: %3!hs!, version: %4!ls! . MessageId=120 diff --git a/src/engine/plan.cpp b/src/engine/plan.cpp index 4f29209f..87607382 100644 --- a/src/engine/plan.cpp +++ b/src/engine/plan.cpp @@ -194,6 +194,8 @@ extern "C" void PlanReset( __in BURN_PACKAGES* pPackages ) { + PackageUninitialize(&pPlan->forwardCompatibleBundle); + if (pPlan->rgRegistrationActions) { for (DWORD i = 0; i < pPlan->cRegistrationActions; ++i) @@ -488,6 +490,72 @@ LExit: return hr; } +extern "C" HRESULT PlanForwardCompatibleBundles( + __in BURN_USER_EXPERIENCE* pUX, + __in BOOTSTRAPPER_COMMAND* pCommand, + __in BURN_PLAN* pPlan, + __in BURN_REGISTRATION* pRegistration, + __in BOOTSTRAPPER_ACTION action + ) +{ + HRESULT hr = S_OK; + BOOL fRecommendIgnore = TRUE; + BOOL fIgnoreBundle = FALSE; + + if (!pRegistration->fForwardCompatibleBundleExists) + { + ExitFunction(); + } + + // Only change the recommendation if an active parent was provided. + if (pRegistration->sczActiveParent && *pRegistration->sczActiveParent) + { + // On install, recommend running the forward compatible bundle because there is an active parent. This + // will essentially register the parent with the forward compatible bundle. + if (BOOTSTRAPPER_ACTION_INSTALL == action) + { + fRecommendIgnore = FALSE; + } + else if (BOOTSTRAPPER_ACTION_UNINSTALL == action || + BOOTSTRAPPER_ACTION_MODIFY == action || + BOOTSTRAPPER_ACTION_REPAIR == action) + { + // When modifying the bundle, only recommend running the forward compatible bundle if the parent + // is already registered as a dependent of the provider key. + if (pRegistration->fParentRegisteredAsDependent) + { + fRecommendIgnore = FALSE; + } + } + } + + for (DWORD iRelatedBundle = 0; iRelatedBundle < pRegistration->relatedBundles.cRelatedBundles; ++iRelatedBundle) + { + BURN_RELATED_BUNDLE* pRelatedBundle = pRegistration->relatedBundles.rgRelatedBundles + iRelatedBundle; + if (!pRelatedBundle->fForwardCompatible) + { + continue; + } + + fIgnoreBundle = fRecommendIgnore; + + hr = UserExperienceOnPlanForwardCompatibleBundle(pUX, pRelatedBundle->package.sczId, pRelatedBundle->relationType, pRelatedBundle->sczTag, pRelatedBundle->package.fPerMachine, pRelatedBundle->pVersion, &fIgnoreBundle); + ExitOnRootFailure(hr, "BA aborted plan forward compatible bundle."); + + if (!fIgnoreBundle) + { + hr = PseudoBundleInitializePassthrough(&pPlan->forwardCompatibleBundle, pCommand, NULL, pRegistration->sczActiveParent, pRegistration->sczAncestors, &pRelatedBundle->package); + ExitOnFailure(hr, "Failed to initialize pass through bundle."); + + pPlan->fEnabledForwardCompatibleBundle = TRUE; + break; + } + } + +LExit: + return hr; +} + extern "C" HRESULT PlanPackages( __in BURN_USER_EXPERIENCE* pUX, __in BURN_PACKAGES* pPackages, diff --git a/src/engine/plan.h b/src/engine/plan.h index c679d368..e72186c7 100644 --- a/src/engine/plan.h +++ b/src/engine/plan.h @@ -322,6 +322,9 @@ typedef struct _BURN_PLAN DWORD cExecutePackagesTotal; DWORD cOverallProgressTicksTotal; + BOOL fEnabledForwardCompatibleBundle; + BURN_PACKAGE forwardCompatibleBundle; + BURN_DEPENDENCY_REGISTRATION_ACTION dependencyRegistrationAction; BURN_DEPENDENT_REGISTRATION_ACTION* rgRegistrationActions; @@ -392,6 +395,13 @@ HRESULT PlanLayoutBundle( __in BURN_PAYLOADS* pPayloads, __out_z LPWSTR* psczLayoutDirectory ); +HRESULT PlanForwardCompatibleBundles( + __in BURN_USER_EXPERIENCE* pUX, + __in BOOTSTRAPPER_COMMAND* pCommand, + __in BURN_PLAN* pPlan, + __in BURN_REGISTRATION* pRegistration, + __in BOOTSTRAPPER_ACTION action + ); HRESULT PlanPackages( __in BURN_USER_EXPERIENCE* pUX, __in BURN_PACKAGES* pPackages, diff --git a/src/engine/registration.h b/src/engine/registration.h index 4aca5a05..bb87b6e9 100644 --- a/src/engine/registration.h +++ b/src/engine/registration.h @@ -58,6 +58,7 @@ typedef struct _BURN_UPDATE_REGISTRATION typedef struct _BURN_RELATED_BUNDLE { BOOTSTRAPPER_RELATION_TYPE relationType; + BOOL fForwardCompatible; VERUTIL_VERSION* pVersion; LPWSTR sczTag; @@ -146,14 +147,13 @@ typedef struct _BURN_REGISTRATION UINT cDependents; // Only valid after detect. LPCWSTR wzSelfDependent; // Only valid after detect. BOOL fSelfRegisteredAsDependent; // Only valid after detect. + BOOL fParentRegisteredAsDependent; // Only valid after detect. + BOOL fForwardCompatibleBundleExists; // Only valid after detect. BOOL fEligibleForCleanup; // Only valid after detect. LPWSTR sczDetectedProviderKeyBundleId; LPWSTR sczAncestors; LPWSTR sczBundlePackageAncestors; - - BOOL fEnabledForwardCompatibleBundle; - BURN_PACKAGE forwardCompatibleBundle; } BURN_REGISTRATION; diff --git a/src/engine/userexperience.cpp b/src/engine/userexperience.cpp index 40a30c5d..e1e32a87 100644 --- a/src/engine/userexperience.cpp +++ b/src/engine/userexperience.cpp @@ -763,8 +763,7 @@ EXTERN_C BAAPI UserExperienceOnDetectForwardCompatibleBundle( __in BOOTSTRAPPER_RELATION_TYPE relationType, __in_z LPCWSTR wzBundleTag, __in BOOL fPerMachine, - __in VERUTIL_VERSION* pVersion, - __inout BOOL* pfIgnoreBundle + __in VERUTIL_VERSION* pVersion ) { HRESULT hr = S_OK; @@ -779,7 +778,6 @@ EXTERN_C BAAPI UserExperienceOnDetectForwardCompatibleBundle( args.wzVersion = pVersion->sczVersion; results.cbSize = sizeof(results); - results.fIgnoreBundle = *pfIgnoreBundle; hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE, &args, &results); ExitOnFailure(hr, "BA OnDetectForwardCompatibleBundle failed."); @@ -788,7 +786,6 @@ EXTERN_C BAAPI UserExperienceOnDetectForwardCompatibleBundle( { hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); } - *pfIgnoreBundle = results.fIgnoreBundle; LExit: return hr; @@ -1567,6 +1564,44 @@ LExit: return hr; } +EXTERN_C BAAPI UserExperienceOnPlanForwardCompatibleBundle( + __in BURN_USER_EXPERIENCE* pUserExperience, + __in_z LPCWSTR wzBundleId, + __in BOOTSTRAPPER_RELATION_TYPE relationType, + __in_z LPCWSTR wzBundleTag, + __in BOOL fPerMachine, + __in VERUTIL_VERSION* pVersion, + __inout BOOL* pfIgnoreBundle + ) +{ + HRESULT hr = S_OK; + BA_ONPLANFORWARDCOMPATIBLEBUNDLE_ARGS args = { }; + BA_ONPLANFORWARDCOMPATIBLEBUNDLE_RESULTS results = { }; + + args.cbSize = sizeof(args); + args.wzBundleId = wzBundleId; + args.relationType = relationType; + args.wzBundleTag = wzBundleTag; + args.fPerMachine = fPerMachine; + args.wzVersion = pVersion->sczVersion; + args.fRecommendedIgnoreBundle = *pfIgnoreBundle; + + results.cbSize = sizeof(results); + results.fIgnoreBundle = *pfIgnoreBundle; + + hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANFORWARDCOMPATIBLEBUNDLE, &args, &results); + ExitOnFailure(hr, "BA OnPlanForwardCompatibleBundle failed."); + + if (results.fCancel) + { + hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT); + } + *pfIgnoreBundle = results.fIgnoreBundle; + +LExit: + return hr; +} + EXTERN_C BAAPI UserExperienceOnPlanMsiPackage( __in BURN_USER_EXPERIENCE* pUserExperience, __in_z LPCWSTR wzPackageId, diff --git a/src/engine/userexperience.h b/src/engine/userexperience.h index 754a9030..eccc0786 100644 --- a/src/engine/userexperience.h +++ b/src/engine/userexperience.h @@ -200,8 +200,7 @@ BAAPI UserExperienceOnDetectForwardCompatibleBundle( __in BOOTSTRAPPER_RELATION_TYPE relationType, __in_z LPCWSTR wzBundleTag, __in BOOL fPerMachine, - __in VERUTIL_VERSION* pVersion, - __inout BOOL* pfIgnoreBundle + __in VERUTIL_VERSION* pVersion ); BAAPI UserExperienceOnDetectMsiFeature( __in BURN_USER_EXPERIENCE* pUserExperience, @@ -357,6 +356,15 @@ BAAPI UserExperienceOnPlanComplete( __in BURN_USER_EXPERIENCE* pUserExperience, __in HRESULT hrStatus ); +BAAPI UserExperienceOnPlanForwardCompatibleBundle( + __in BURN_USER_EXPERIENCE* pUserExperience, + __in_z LPCWSTR wzBundleId, + __in BOOTSTRAPPER_RELATION_TYPE relationType, + __in_z LPCWSTR wzBundleTag, + __in BOOL fPerMachine, + __in VERUTIL_VERSION* pVersion, + __inout BOOL* pfIgnoreBundle + ); BAAPI UserExperienceOnPlanMsiFeature( __in BURN_USER_EXPERIENCE* pUserExperience, __in_z LPCWSTR wzPackageId, -- cgit v1.2.3-55-g6feb