diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2022-04-22 16:55:29 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2022-04-23 15:40:21 -0500 |
| commit | 72e20f682c0d64102e86439ba5527dd0d71932ae (patch) | |
| tree | c62618b0f6b99d3bffa3c6cd01251a29b84fcc05 /src/burn/engine | |
| parent | b82c6a2b7d451212fb0b2e32ca4d5d86c953d81a (diff) | |
| download | wix-72e20f682c0d64102e86439ba5527dd0d71932ae.tar.gz wix-72e20f682c0d64102e86439ba5527dd0d71932ae.tar.bz2 wix-72e20f682c0d64102e86439ba5527dd0d71932ae.zip | |
Add RepairCondition.
Fixes 6758
Diffstat (limited to 'src/burn/engine')
| -rw-r--r-- | src/burn/engine/package.cpp | 5 | ||||
| -rw-r--r-- | src/burn/engine/package.h | 1 | ||||
| -rw-r--r-- | src/burn/engine/plan.cpp | 24 | ||||
| -rw-r--r-- | src/burn/engine/plan.h | 1 | ||||
| -rw-r--r-- | src/burn/engine/userexperience.cpp | 2 | ||||
| -rw-r--r-- | src/burn/engine/userexperience.h | 1 |
6 files changed, 29 insertions, 5 deletions
diff --git a/src/burn/engine/package.cpp b/src/burn/engine/package.cpp index 89203ada..88e7cb9d 100644 --- a/src/burn/engine/package.cpp +++ b/src/burn/engine/package.cpp | |||
| @@ -178,6 +178,10 @@ extern "C" HRESULT PackagesParseFromXml( | |||
| 178 | hr = XmlGetAttributeEx(pixnNode, L"InstallCondition", &pPackage->sczInstallCondition); | 178 | hr = XmlGetAttributeEx(pixnNode, L"InstallCondition", &pPackage->sczInstallCondition); |
| 179 | ExitOnOptionalXmlQueryFailure(hr, fFoundXml, "Failed to get @InstallCondition."); | 179 | ExitOnOptionalXmlQueryFailure(hr, fFoundXml, "Failed to get @InstallCondition."); |
| 180 | 180 | ||
| 181 | // @RepairCondition | ||
| 182 | hr = XmlGetAttributeEx(pixnNode, L"RepairCondition", &pPackage->sczRepairCondition); | ||
| 183 | ExitOnOptionalXmlQueryFailure(hr, fFoundXml, "Failed to get @RepairCondition."); | ||
| 184 | |||
| 181 | // @RollbackBoundaryForward | 185 | // @RollbackBoundaryForward |
| 182 | hr = XmlGetAttributeEx(pixnNode, L"RollbackBoundaryForward", &scz); | 186 | hr = XmlGetAttributeEx(pixnNode, L"RollbackBoundaryForward", &scz); |
| 183 | ExitOnOptionalXmlQueryFailure(hr, fFoundXml, "Failed to get @RollbackBoundaryForward."); | 187 | ExitOnOptionalXmlQueryFailure(hr, fFoundXml, "Failed to get @RollbackBoundaryForward."); |
| @@ -362,6 +366,7 @@ extern "C" void PackageUninitialize( | |||
| 362 | ReleaseStr(pPackage->sczLogPathVariable); | 366 | ReleaseStr(pPackage->sczLogPathVariable); |
| 363 | ReleaseStr(pPackage->sczRollbackLogPathVariable); | 367 | ReleaseStr(pPackage->sczRollbackLogPathVariable); |
| 364 | ReleaseStr(pPackage->sczInstallCondition); | 368 | ReleaseStr(pPackage->sczInstallCondition); |
| 369 | ReleaseStr(pPackage->sczRepairCondition); | ||
| 365 | ReleaseStr(pPackage->sczCacheId); | 370 | ReleaseStr(pPackage->sczCacheId); |
| 366 | 371 | ||
| 367 | if (pPackage->rgDependencyProviders) | 372 | if (pPackage->rgDependencyProviders) |
diff --git a/src/burn/engine/package.h b/src/burn/engine/package.h index eb8e7543..3ec77baf 100644 --- a/src/burn/engine/package.h +++ b/src/burn/engine/package.h | |||
| @@ -250,6 +250,7 @@ typedef struct _BURN_PACKAGE | |||
| 250 | LPWSTR sczRollbackLogPathVariable; // name of the variable that will be set to the rollback path. | 250 | LPWSTR sczRollbackLogPathVariable; // name of the variable that will be set to the rollback path. |
| 251 | 251 | ||
| 252 | LPWSTR sczInstallCondition; | 252 | LPWSTR sczInstallCondition; |
| 253 | LPWSTR sczRepairCondition; | ||
| 253 | BOOL fPerMachine; | 254 | BOOL fPerMachine; |
| 254 | BOOL fPermanent; | 255 | BOOL fPermanent; |
| 255 | BOOL fVital; | 256 | BOOL fVital; |
diff --git a/src/burn/engine/plan.cpp b/src/burn/engine/plan.cpp index 2c267415..47da22c0 100644 --- a/src/burn/engine/plan.cpp +++ b/src/burn/engine/plan.cpp | |||
| @@ -347,6 +347,7 @@ extern "C" HRESULT PlanDefaultPackageRequestState( | |||
| 347 | __in BOOTSTRAPPER_PACKAGE_STATE currentState, | 347 | __in BOOTSTRAPPER_PACKAGE_STATE currentState, |
| 348 | __in BOOTSTRAPPER_ACTION action, | 348 | __in BOOTSTRAPPER_ACTION action, |
| 349 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, | 349 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, |
| 350 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, | ||
| 350 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | 351 | __in BOOTSTRAPPER_RELATION_TYPE relationType, |
| 351 | __out BOOTSTRAPPER_REQUEST_STATE* pRequestState | 352 | __out BOOTSTRAPPER_REQUEST_STATE* pRequestState |
| 352 | ) | 353 | ) |
| @@ -408,6 +409,10 @@ extern "C" HRESULT PlanDefaultPackageRequestState( | |||
| 408 | { | 409 | { |
| 409 | defaultRequestState = BOOTSTRAPPER_REQUEST_STATE_PRESENT <= defaultRequestState ? BOOTSTRAPPER_REQUEST_STATE_NONE : defaultRequestState; | 410 | defaultRequestState = BOOTSTRAPPER_REQUEST_STATE_PRESENT <= defaultRequestState ? BOOTSTRAPPER_REQUEST_STATE_NONE : defaultRequestState; |
| 410 | } | 411 | } |
| 412 | else if (BOOTSTRAPPER_ACTION_REPAIR == action && BOOTSTRAPPER_PACKAGE_CONDITION_FALSE == repairCondition) | ||
| 413 | { | ||
| 414 | defaultRequestState = BOOTSTRAPPER_REQUEST_STATE_PRESENT; | ||
| 415 | } | ||
| 411 | } | 416 | } |
| 412 | 417 | ||
| 413 | *pRequestState = defaultRequestState; | 418 | *pRequestState = defaultRequestState; |
| @@ -905,7 +910,8 @@ static HRESULT InitializePackage( | |||
| 905 | { | 910 | { |
| 906 | HRESULT hr = S_OK; | 911 | HRESULT hr = S_OK; |
| 907 | BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition = BOOTSTRAPPER_PACKAGE_CONDITION_DEFAULT; | 912 | BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition = BOOTSTRAPPER_PACKAGE_CONDITION_DEFAULT; |
| 908 | BOOL fInstallCondition = FALSE; | 913 | BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition = BOOTSTRAPPER_PACKAGE_CONDITION_DEFAULT; |
| 914 | BOOL fEvaluatedCondition = FALSE; | ||
| 909 | BOOL fBeginCalled = FALSE; | 915 | BOOL fBeginCalled = FALSE; |
| 910 | BOOTSTRAPPER_RELATION_TYPE relationType = pPlan->pCommand->relationType; | 916 | BOOTSTRAPPER_RELATION_TYPE relationType = pPlan->pCommand->relationType; |
| 911 | 917 | ||
| @@ -927,20 +933,28 @@ static HRESULT InitializePackage( | |||
| 927 | 933 | ||
| 928 | if (pPackage->sczInstallCondition && *pPackage->sczInstallCondition) | 934 | if (pPackage->sczInstallCondition && *pPackage->sczInstallCondition) |
| 929 | { | 935 | { |
| 930 | hr = ConditionEvaluate(pVariables, pPackage->sczInstallCondition, &fInstallCondition); | 936 | hr = ConditionEvaluate(pVariables, pPackage->sczInstallCondition, &fEvaluatedCondition); |
| 931 | ExitOnFailure(hr, "Failed to evaluate install condition."); | 937 | ExitOnFailure(hr, "Failed to evaluate install condition."); |
| 932 | 938 | ||
| 933 | installCondition = fInstallCondition ? BOOTSTRAPPER_PACKAGE_CONDITION_TRUE : BOOTSTRAPPER_PACKAGE_CONDITION_FALSE; | 939 | installCondition = fEvaluatedCondition ? BOOTSTRAPPER_PACKAGE_CONDITION_TRUE : BOOTSTRAPPER_PACKAGE_CONDITION_FALSE; |
| 940 | } | ||
| 941 | |||
| 942 | if (pPackage->sczRepairCondition && *pPackage->sczRepairCondition) | ||
| 943 | { | ||
| 944 | hr = ConditionEvaluate(pVariables, pPackage->sczRepairCondition, &fEvaluatedCondition); | ||
| 945 | ExitOnFailure(hr, "Failed to evaluate repair condition."); | ||
| 946 | |||
| 947 | repairCondition = fEvaluatedCondition ? BOOTSTRAPPER_PACKAGE_CONDITION_TRUE : BOOTSTRAPPER_PACKAGE_CONDITION_FALSE; | ||
| 934 | } | 948 | } |
| 935 | 949 | ||
| 936 | // Remember the default requested state so the engine doesn't get blamed for planning the wrong thing if the BA changes it. | 950 | // Remember the default requested state so the engine doesn't get blamed for planning the wrong thing if the BA changes it. |
| 937 | hr = PlanDefaultPackageRequestState(pPackage->type, pPackage->currentState, pPlan->action, installCondition, relationType, &pPackage->defaultRequested); | 951 | hr = PlanDefaultPackageRequestState(pPackage->type, pPackage->currentState, pPlan->action, installCondition, repairCondition, relationType, &pPackage->defaultRequested); |
| 938 | ExitOnFailure(hr, "Failed to set default package state."); | 952 | ExitOnFailure(hr, "Failed to set default package state."); |
| 939 | 953 | ||
| 940 | pPackage->requested = pPackage->defaultRequested; | 954 | pPackage->requested = pPackage->defaultRequested; |
| 941 | fBeginCalled = TRUE; | 955 | fBeginCalled = TRUE; |
| 942 | 956 | ||
| 943 | hr = UserExperienceOnPlanPackageBegin(pUX, pPackage->sczId, pPackage->currentState, pPackage->fCached, installCondition, &pPackage->requested, &pPackage->cacheType); | 957 | hr = UserExperienceOnPlanPackageBegin(pUX, pPackage->sczId, pPackage->currentState, pPackage->fCached, installCondition, repairCondition, &pPackage->requested, &pPackage->cacheType); |
| 944 | ExitOnRootFailure(hr, "BA aborted plan package begin."); | 958 | ExitOnRootFailure(hr, "BA aborted plan package begin."); |
| 945 | 959 | ||
| 946 | if (BURN_PACKAGE_TYPE_MSI == pPackage->type) | 960 | if (BURN_PACKAGE_TYPE_MSI == pPackage->type) |
diff --git a/src/burn/engine/plan.h b/src/burn/engine/plan.h index 87214cc8..fbb7a5a1 100644 --- a/src/burn/engine/plan.h +++ b/src/burn/engine/plan.h | |||
| @@ -342,6 +342,7 @@ HRESULT PlanDefaultPackageRequestState( | |||
| 342 | __in BOOTSTRAPPER_PACKAGE_STATE currentState, | 342 | __in BOOTSTRAPPER_PACKAGE_STATE currentState, |
| 343 | __in BOOTSTRAPPER_ACTION action, | 343 | __in BOOTSTRAPPER_ACTION action, |
| 344 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, | 344 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, |
| 345 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, | ||
| 345 | __in BOOTSTRAPPER_RELATION_TYPE relationType, | 346 | __in BOOTSTRAPPER_RELATION_TYPE relationType, |
| 346 | __out BOOTSTRAPPER_REQUEST_STATE* pRequestState | 347 | __out BOOTSTRAPPER_REQUEST_STATE* pRequestState |
| 347 | ); | 348 | ); |
diff --git a/src/burn/engine/userexperience.cpp b/src/burn/engine/userexperience.cpp index a1a010d2..a3cbcd4a 100644 --- a/src/burn/engine/userexperience.cpp +++ b/src/burn/engine/userexperience.cpp | |||
| @@ -2169,6 +2169,7 @@ EXTERN_C BAAPI UserExperienceOnPlanPackageBegin( | |||
| 2169 | __in BOOTSTRAPPER_PACKAGE_STATE state, | 2169 | __in BOOTSTRAPPER_PACKAGE_STATE state, |
| 2170 | __in BOOL fCached, | 2170 | __in BOOL fCached, |
| 2171 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, | 2171 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, |
| 2172 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, | ||
| 2172 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState, | 2173 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState, |
| 2173 | __inout BOOTSTRAPPER_CACHE_TYPE* pRequestedCacheType | 2174 | __inout BOOTSTRAPPER_CACHE_TYPE* pRequestedCacheType |
| 2174 | ) | 2175 | ) |
| @@ -2182,6 +2183,7 @@ EXTERN_C BAAPI UserExperienceOnPlanPackageBegin( | |||
| 2182 | args.state = state; | 2183 | args.state = state; |
| 2183 | args.fCached = fCached; | 2184 | args.fCached = fCached; |
| 2184 | args.installCondition = installCondition; | 2185 | args.installCondition = installCondition; |
| 2186 | args.repairCondition = repairCondition; | ||
| 2185 | args.recommendedState = *pRequestedState; | 2187 | args.recommendedState = *pRequestedState; |
| 2186 | args.recommendedCacheType = *pRequestedCacheType; | 2188 | args.recommendedCacheType = *pRequestedCacheType; |
| 2187 | 2189 | ||
diff --git a/src/burn/engine/userexperience.h b/src/burn/engine/userexperience.h index 90a047ed..2059b521 100644 --- a/src/burn/engine/userexperience.h +++ b/src/burn/engine/userexperience.h | |||
| @@ -501,6 +501,7 @@ BAAPI UserExperienceOnPlanPackageBegin( | |||
| 501 | __in BOOTSTRAPPER_PACKAGE_STATE state, | 501 | __in BOOTSTRAPPER_PACKAGE_STATE state, |
| 502 | __in BOOL fCached, | 502 | __in BOOL fCached, |
| 503 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, | 503 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, |
| 504 | __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, | ||
| 504 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState, | 505 | __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState, |
| 505 | __inout BOOTSTRAPPER_CACHE_TYPE* pRequestedCacheType | 506 | __inout BOOTSTRAPPER_CACHE_TYPE* pRequestedCacheType |
| 506 | ); | 507 | ); |
