diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2021-02-18 10:44:49 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2021-02-22 20:25:06 -0600 |
| commit | b29af5d005c2cc802aa60a123d435042038ba8ef (patch) | |
| tree | cb86e61b6abb327f8e1ebc33162acfca28bb89e9 /src/engine/msiengine.cpp | |
| parent | dbd55be5e707f07eb044c8c7f13c3dfd246148c0 (diff) | |
| download | wix-b29af5d005c2cc802aa60a123d435042038ba8ef.tar.gz wix-b29af5d005c2cc802aa60a123d435042038ba8ef.tar.bz2 wix-b29af5d005c2cc802aa60a123d435042038ba8ef.zip | |
Get all request states up front before building the plan.
Diffstat (limited to 'src/engine/msiengine.cpp')
| -rw-r--r-- | src/engine/msiengine.cpp | 62 |
1 files changed, 37 insertions, 25 deletions
diff --git a/src/engine/msiengine.cpp b/src/engine/msiengine.cpp index 4fdf2b7a..252a17b7 100644 --- a/src/engine/msiengine.cpp +++ b/src/engine/msiengine.cpp | |||
| @@ -674,13 +674,46 @@ LExit: | |||
| 674 | return hr; | 674 | return hr; |
| 675 | } | 675 | } |
| 676 | 676 | ||
| 677 | extern "C" HRESULT MsiEnginePlanInitializePackage( | ||
| 678 | __in BURN_PACKAGE* pPackage, | ||
| 679 | __in BURN_VARIABLES* pVariables, | ||
| 680 | __in BURN_USER_EXPERIENCE* pUserExperience | ||
| 681 | ) | ||
| 682 | { | ||
| 683 | HRESULT hr = S_OK; | ||
| 684 | |||
| 685 | if (pPackage->Msi.cFeatures) | ||
| 686 | { | ||
| 687 | // get feature request states | ||
| 688 | for (DWORD i = 0; i < pPackage->Msi.cFeatures; ++i) | ||
| 689 | { | ||
| 690 | BURN_MSIFEATURE* pFeature = &pPackage->Msi.rgFeatures[i]; | ||
| 691 | |||
| 692 | // Evaluate feature conditions. | ||
| 693 | hr = EvaluateActionStateConditions(pVariables, pFeature->sczAddLocalCondition, pFeature->sczAddSourceCondition, pFeature->sczAdvertiseCondition, &pFeature->defaultRequested); | ||
| 694 | ExitOnFailure(hr, "Failed to evaluate requested state conditions."); | ||
| 695 | |||
| 696 | hr = EvaluateActionStateConditions(pVariables, pFeature->sczRollbackAddLocalCondition, pFeature->sczRollbackAddSourceCondition, pFeature->sczRollbackAdvertiseCondition, &pFeature->expectedState); | ||
| 697 | ExitOnFailure(hr, "Failed to evaluate expected state conditions."); | ||
| 698 | |||
| 699 | // Remember the default feature requested state so the engine doesn't get blamed for planning the wrong thing if the BA changes it. | ||
| 700 | pFeature->requested = pFeature->defaultRequested; | ||
| 701 | |||
| 702 | // Send plan MSI feature message to BA. | ||
| 703 | hr = UserExperienceOnPlanMsiFeature(pUserExperience, pPackage->sczId, pFeature->sczId, &pFeature->requested); | ||
| 704 | ExitOnRootFailure(hr, "BA aborted plan MSI feature."); | ||
| 705 | } | ||
| 706 | } | ||
| 707 | |||
| 708 | LExit: | ||
| 709 | return hr; | ||
| 710 | } | ||
| 711 | |||
| 677 | // | 712 | // |
| 678 | // PlanCalculate - calculates the execute and rollback state for the requested package state. | 713 | // PlanCalculate - calculates the execute and rollback state for the requested package state. |
| 679 | // | 714 | // |
| 680 | extern "C" HRESULT MsiEnginePlanCalculatePackage( | 715 | extern "C" HRESULT MsiEnginePlanCalculatePackage( |
| 681 | __in BURN_PACKAGE* pPackage, | 716 | __in BURN_PACKAGE* pPackage, |
| 682 | __in BURN_VARIABLES* pVariables, | ||
| 683 | __in BURN_USER_EXPERIENCE* pUserExperience, | ||
| 684 | __in BOOL fInsideMsiTransaction, | 717 | __in BOOL fInsideMsiTransaction, |
| 685 | __out_opt BOOL* pfBARequestedCache | 718 | __out_opt BOOL* pfBARequestedCache |
| 686 | ) | 719 | ) |
| @@ -702,38 +735,17 @@ extern "C" HRESULT MsiEnginePlanCalculatePackage( | |||
| 702 | // If the package is present and we're repairing it. | 735 | // If the package is present and we're repairing it. |
| 703 | BOOL fRepairingPackage = (BOOTSTRAPPER_PACKAGE_STATE_CACHED < pPackage->currentState && BOOTSTRAPPER_REQUEST_STATE_REPAIR == pPackage->requested); | 736 | BOOL fRepairingPackage = (BOOTSTRAPPER_PACKAGE_STATE_CACHED < pPackage->currentState && BOOTSTRAPPER_REQUEST_STATE_REPAIR == pPackage->requested); |
| 704 | 737 | ||
| 705 | LogId(REPORT_STANDARD, MSG_PLAN_MSI_FEATURES, pPackage->Msi.cFeatures, pPackage->sczId); | ||
| 706 | |||
| 707 | // plan features | 738 | // plan features |
| 708 | for (DWORD i = 0; i < pPackage->Msi.cFeatures; ++i) | 739 | for (DWORD i = 0; i < pPackage->Msi.cFeatures; ++i) |
| 709 | { | 740 | { |
| 710 | BURN_MSIFEATURE* pFeature = &pPackage->Msi.rgFeatures[i]; | 741 | BURN_MSIFEATURE* pFeature = &pPackage->Msi.rgFeatures[i]; |
| 711 | BOOTSTRAPPER_FEATURE_STATE defaultFeatureRequestedState = BOOTSTRAPPER_FEATURE_STATE_UNKNOWN; | ||
| 712 | BOOTSTRAPPER_FEATURE_STATE featureRequestedState = BOOTSTRAPPER_FEATURE_STATE_UNKNOWN; | ||
| 713 | BOOTSTRAPPER_FEATURE_STATE featureExpectedState = BOOTSTRAPPER_FEATURE_STATE_UNKNOWN; | ||
| 714 | |||
| 715 | // Evaluate feature conditions. | ||
| 716 | hr = EvaluateActionStateConditions(pVariables, pFeature->sczAddLocalCondition, pFeature->sczAddSourceCondition, pFeature->sczAdvertiseCondition, &defaultFeatureRequestedState); | ||
| 717 | ExitOnFailure(hr, "Failed to evaluate requested state conditions."); | ||
| 718 | |||
| 719 | hr = EvaluateActionStateConditions(pVariables, pFeature->sczRollbackAddLocalCondition, pFeature->sczRollbackAddSourceCondition, pFeature->sczRollbackAdvertiseCondition, &featureExpectedState); | ||
| 720 | ExitOnFailure(hr, "Failed to evaluate expected state conditions."); | ||
| 721 | |||
| 722 | // Remember the default feature requested state so the engine doesn't get blamed for planning the wrong thing if the BA changes it. | ||
| 723 | featureRequestedState = defaultFeatureRequestedState; | ||
| 724 | |||
| 725 | // Send plan MSI feature message to BA. | ||
| 726 | hr = UserExperienceOnPlanMsiFeature(pUserExperience, pPackage->sczId, pFeature->sczId, &featureRequestedState); | ||
| 727 | ExitOnRootFailure(hr, "BA aborted plan MSI feature."); | ||
| 728 | 742 | ||
| 729 | // Calculate feature actions. | 743 | // Calculate feature actions. |
| 730 | hr = CalculateFeatureAction(pFeature->currentState, featureRequestedState, fRepairingPackage, &pFeature->execute, &fFeatureActionDelta); | 744 | hr = CalculateFeatureAction(pFeature->currentState, pFeature->requested, fRepairingPackage, &pFeature->execute, &fFeatureActionDelta); |
| 731 | ExitOnFailure(hr, "Failed to calculate execute feature state."); | 745 | ExitOnFailure(hr, "Failed to calculate execute feature state."); |
| 732 | 746 | ||
| 733 | hr = CalculateFeatureAction(featureRequestedState, BOOTSTRAPPER_FEATURE_ACTION_NONE == pFeature->execute ? featureExpectedState : pFeature->currentState, FALSE, &pFeature->rollback, &fRollbackFeatureActionDelta); | 747 | hr = CalculateFeatureAction(pFeature->requested, BOOTSTRAPPER_FEATURE_ACTION_NONE == pFeature->execute ? pFeature->expectedState : pFeature->currentState, FALSE, &pFeature->rollback, &fRollbackFeatureActionDelta); |
| 734 | ExitOnFailure(hr, "Failed to calculate rollback feature state."); | 748 | ExitOnFailure(hr, "Failed to calculate rollback feature state."); |
| 735 | |||
| 736 | LogId(REPORT_STANDARD, MSG_PLANNED_MSI_FEATURE, pFeature->sczId, LoggingMsiFeatureStateToString(pFeature->currentState), LoggingMsiFeatureStateToString(defaultFeatureRequestedState), LoggingMsiFeatureStateToString(featureRequestedState), LoggingMsiFeatureActionToString(pFeature->execute), LoggingMsiFeatureActionToString(pFeature->rollback)); | ||
| 737 | } | 749 | } |
| 738 | } | 750 | } |
| 739 | 751 | ||
