aboutsummaryrefslogtreecommitdiff
path: root/src/burn
diff options
context:
space:
mode:
authorNir Bar <nir.bar@panel-sw.co.il>2021-08-11 15:37:34 -0500
committerSean Hall <r.sean.hall@gmail.com>2021-08-12 14:50:55 -0500
commit0042e3d4554a0d92e1da6141854b0f1aafa07d5b (patch)
tree7dcd25456993d6a9d68b9afd21fd1d1f77bd2a5e /src/burn
parentc6b138ed166e30c750e499919b858dc6913937b6 (diff)
downloadwix-0042e3d4554a0d92e1da6141854b0f1aafa07d5b.tar.gz
wix-0042e3d4554a0d92e1da6141854b0f1aafa07d5b.tar.bz2
wix-0042e3d4554a0d92e1da6141854b0f1aafa07d5b.zip
Allow BA to opt out of MSI transaction.
Diffstat (limited to 'src/burn')
-rw-r--r--src/burn/engine/core.cpp25
-rw-r--r--src/burn/engine/engine.mc7
-rw-r--r--src/burn/engine/package.cpp2
-rw-r--r--src/burn/engine/package.h1
-rw-r--r--src/burn/engine/plan.cpp26
-rw-r--r--src/burn/engine/plan.h3
-rw-r--r--src/burn/engine/userexperience.cpp32
-rw-r--r--src/burn/engine/userexperience.h5
8 files changed, 93 insertions, 8 deletions
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp
index 87d748cc..bbd0ff96 100644
--- a/src/burn/engine/core.cpp
+++ b/src/burn/engine/core.cpp
@@ -79,6 +79,9 @@ static void LogRelatedBundles(
79 __in const BURN_RELATED_BUNDLES* pRelatedBundles, 79 __in const BURN_RELATED_BUNDLES* pRelatedBundles,
80 __in BOOL fReverse 80 __in BOOL fReverse
81 ); 81 );
82static void LogRollbackBoundary(
83 __in const BURN_ROLLBACK_BOUNDARY* pRollbackBoundary
84 );
82 85
83 86
84// function definitions 87// function definitions
@@ -2222,6 +2225,8 @@ static void LogPackages(
2222 __in const BOOTSTRAPPER_ACTION action 2225 __in const BOOTSTRAPPER_ACTION action
2223 ) 2226 )
2224{ 2227{
2228 BOOL fUninstalling = BOOTSTRAPPER_ACTION_UNINSTALL == action;
2229
2225 if (pUpgradeBundlePackage) 2230 if (pUpgradeBundlePackage)
2226 { 2231 {
2227 LogId(REPORT_STANDARD, MSG_PLANNED_UPGRADE_BUNDLE, pUpgradeBundlePackage->sczId, LoggingRequestStateToString(pUpgradeBundlePackage->defaultRequested), LoggingRequestStateToString(pUpgradeBundlePackage->requested), LoggingActionStateToString(pUpgradeBundlePackage->execute), LoggingActionStateToString(pUpgradeBundlePackage->rollback), LoggingDependencyActionToString(pUpgradeBundlePackage->dependencyExecute)); 2232 LogId(REPORT_STANDARD, MSG_PLANNED_UPGRADE_BUNDLE, pUpgradeBundlePackage->sczId, LoggingRequestStateToString(pUpgradeBundlePackage->defaultRequested), LoggingRequestStateToString(pUpgradeBundlePackage->requested), LoggingActionStateToString(pUpgradeBundlePackage->execute), LoggingActionStateToString(pUpgradeBundlePackage->rollback), LoggingDependencyActionToString(pUpgradeBundlePackage->dependencyExecute));
@@ -2233,7 +2238,7 @@ static void LogPackages(
2233 else 2238 else
2234 { 2239 {
2235 // Display related bundles first if uninstalling. 2240 // Display related bundles first if uninstalling.
2236 if (BOOTSTRAPPER_ACTION_UNINSTALL == action) 2241 if (fUninstalling)
2237 { 2242 {
2238 LogRelatedBundles(pRelatedBundles, TRUE); 2243 LogRelatedBundles(pRelatedBundles, TRUE);
2239 } 2244 }
@@ -2241,9 +2246,18 @@ static void LogPackages(
2241 // Display all the packages in the log. 2246 // Display all the packages in the log.
2242 for (DWORD i = 0; i < pPackages->cPackages; ++i) 2247 for (DWORD i = 0; i < pPackages->cPackages; ++i)
2243 { 2248 {
2244 const DWORD iPackage = (BOOTSTRAPPER_ACTION_UNINSTALL == action) ? pPackages->cPackages - 1 - i : i; 2249 const DWORD iPackage = fUninstalling ? pPackages->cPackages - 1 - i : i;
2245 const BURN_PACKAGE* pPackage = &pPackages->rgPackages[iPackage]; 2250 const BURN_PACKAGE* pPackage = &pPackages->rgPackages[iPackage];
2246 2251
2252 if (!fUninstalling && pPackage->pRollbackBoundaryForward)
2253 {
2254 LogRollbackBoundary(pPackage->pRollbackBoundaryForward);
2255 }
2256 else if (fUninstalling && pPackage->pRollbackBoundaryBackward)
2257 {
2258 LogRollbackBoundary(pPackage->pRollbackBoundaryBackward);
2259 }
2260
2247 LogId(REPORT_STANDARD, MSG_PLANNED_PACKAGE, pPackage->sczId, LoggingPackageStateToString(pPackage->currentState), LoggingRequestStateToString(pPackage->defaultRequested), LoggingRequestStateToString(pPackage->requested), LoggingActionStateToString(pPackage->execute), LoggingActionStateToString(pPackage->rollback), LoggingCacheTypeToString(pPackage->authoredCacheType), LoggingCacheTypeToString(pPackage->cacheType), LoggingBoolToString(pPackage->fPlannedCache), LoggingBoolToString(pPackage->fPlannedUncache), LoggingDependencyActionToString(pPackage->dependencyExecute), LoggingPackageRegistrationStateToString(pPackage->fCanAffectRegistration, pPackage->expectedInstallRegistrationState), LoggingPackageRegistrationStateToString(pPackage->fCanAffectRegistration, pPackage->expectedCacheRegistrationState)); 2261 LogId(REPORT_STANDARD, MSG_PLANNED_PACKAGE, pPackage->sczId, LoggingPackageStateToString(pPackage->currentState), LoggingRequestStateToString(pPackage->defaultRequested), LoggingRequestStateToString(pPackage->requested), LoggingActionStateToString(pPackage->execute), LoggingActionStateToString(pPackage->rollback), LoggingCacheTypeToString(pPackage->authoredCacheType), LoggingCacheTypeToString(pPackage->cacheType), LoggingBoolToString(pPackage->fPlannedCache), LoggingBoolToString(pPackage->fPlannedUncache), LoggingDependencyActionToString(pPackage->dependencyExecute), LoggingPackageRegistrationStateToString(pPackage->fCanAffectRegistration, pPackage->expectedInstallRegistrationState), LoggingPackageRegistrationStateToString(pPackage->fCanAffectRegistration, pPackage->expectedCacheRegistrationState));
2248 2262
2249 if (BURN_PACKAGE_TYPE_MSI == pPackage->type) 2263 if (BURN_PACKAGE_TYPE_MSI == pPackage->type)
@@ -2313,3 +2327,10 @@ static void LogRelatedBundles(
2313 } 2327 }
2314 } 2328 }
2315} 2329}
2330
2331static void LogRollbackBoundary(
2332 __in const BURN_ROLLBACK_BOUNDARY* pRollbackBoundary
2333 )
2334{
2335 LogId(REPORT_STANDARD, MSG_PLANNED_ROLLBACK_BOUNDARY, pRollbackBoundary->sczId, LoggingBoolToString(pRollbackBoundary->fVital), LoggingBoolToString(pRollbackBoundary->fTransaction), LoggingBoolToString(pRollbackBoundary->fTransactionAuthored));
2336}
diff --git a/src/burn/engine/engine.mc b/src/burn/engine/engine.mc
index f1ecebcd..dcd18074 100644
--- a/src/burn/engine/engine.mc
+++ b/src/burn/engine/engine.mc
@@ -471,6 +471,13 @@ Language=English
471 Planned slipstreamed patch: %1!ls!, execute: %2!hs!, rollback: %3!hs! 471 Planned slipstreamed patch: %1!ls!, execute: %2!hs!, rollback: %3!hs!
472. 472.
473 473
474MessageId=222
475Severity=Success
476SymbolicName=MSG_PLANNED_ROLLBACK_BOUNDARY
477Language=English
478Planned rollback boundary: '%1!ls!', vital: %2!hs!, transaction: %3!hs! (default: %4!hs!)
479.
480
474MessageId=299 481MessageId=299
475Severity=Success 482Severity=Success
476SymbolicName=MSG_PLAN_COMPLETE 483SymbolicName=MSG_PLAN_COMPLETE
diff --git a/src/burn/engine/package.cpp b/src/burn/engine/package.cpp
index 0d52d575..cd871bc5 100644
--- a/src/burn/engine/package.cpp
+++ b/src/burn/engine/package.cpp
@@ -70,7 +70,7 @@ extern "C" HRESULT PackagesParseFromXml(
70 ExitOnFailure(hr, "Failed to get @Vital."); 70 ExitOnFailure(hr, "Failed to get @Vital.");
71 71
72 // @Transaction 72 // @Transaction
73 hr = XmlGetYesNoAttribute(pixnNode, L"Transaction", &pRollbackBoundary->fTransaction); 73 hr = XmlGetYesNoAttribute(pixnNode, L"Transaction", &pRollbackBoundary->fTransactionAuthored);
74 ExitOnFailure(hr, "Failed to get @Transaction."); 74 ExitOnFailure(hr, "Failed to get @Transaction.");
75 75
76 // prepare next iteration 76 // prepare next iteration
diff --git a/src/burn/engine/package.h b/src/burn/engine/package.h
index f14064db..3d8233d1 100644
--- a/src/burn/engine/package.h
+++ b/src/burn/engine/package.h
@@ -192,6 +192,7 @@ typedef struct _BURN_ROLLBACK_BOUNDARY
192{ 192{
193 LPWSTR sczId; 193 LPWSTR sczId;
194 BOOL fVital; 194 BOOL fVital;
195 BOOL fTransactionAuthored;
195 BOOL fTransaction; 196 BOOL fTransaction;
196 BOOL fActiveTransaction; // only valid during Apply. 197 BOOL fActiveTransaction; // only valid during Apply.
197 LPWSTR sczLogPath; 198 LPWSTR sczLogPath;
diff --git a/src/burn/engine/plan.cpp b/src/burn/engine/plan.cpp
index d78f2846..85d958a6 100644
--- a/src/burn/engine/plan.cpp
+++ b/src/burn/engine/plan.cpp
@@ -59,6 +59,9 @@ static HRESULT ProcessPackage(
59 ); 59 );
60static HRESULT ProcessPackageRollbackBoundary( 60static HRESULT ProcessPackageRollbackBoundary(
61 __in BURN_PLAN* pPlan, 61 __in BURN_PLAN* pPlan,
62 __in BURN_USER_EXPERIENCE* pUX,
63 __in BURN_LOGGING* pLog,
64 __in BURN_VARIABLES* pVariables,
62 __in_opt BURN_ROLLBACK_BOUNDARY* pEffectiveRollbackBoundary, 65 __in_opt BURN_ROLLBACK_BOUNDARY* pEffectiveRollbackBoundary,
63 __inout BURN_ROLLBACK_BOUNDARY** ppRollbackBoundary 66 __inout BURN_ROLLBACK_BOUNDARY** ppRollbackBoundary
64 ); 67 );
@@ -901,7 +904,7 @@ static HRESULT ProcessPackage(
901 BURN_ROLLBACK_BOUNDARY* pEffectiveRollbackBoundary = NULL; 904 BURN_ROLLBACK_BOUNDARY* pEffectiveRollbackBoundary = NULL;
902 905
903 pEffectiveRollbackBoundary = (BOOTSTRAPPER_ACTION_UNINSTALL == pPlan->action) ? pPackage->pRollbackBoundaryBackward : pPackage->pRollbackBoundaryForward; 906 pEffectiveRollbackBoundary = (BOOTSTRAPPER_ACTION_UNINSTALL == pPlan->action) ? pPackage->pRollbackBoundaryBackward : pPackage->pRollbackBoundaryForward;
904 hr = ProcessPackageRollbackBoundary(pPlan, pEffectiveRollbackBoundary, ppRollbackBoundary); 907 hr = ProcessPackageRollbackBoundary(pPlan, pUX, pLog, pVariables, pEffectiveRollbackBoundary, ppRollbackBoundary);
905 ExitOnFailure(hr, "Failed to process package rollback boundary."); 908 ExitOnFailure(hr, "Failed to process package rollback boundary.");
906 909
907 if (BOOTSTRAPPER_ACTION_LAYOUT == pPlan->action) 910 if (BOOTSTRAPPER_ACTION_LAYOUT == pPlan->action)
@@ -952,6 +955,9 @@ LExit:
952 955
953static HRESULT ProcessPackageRollbackBoundary( 956static HRESULT ProcessPackageRollbackBoundary(
954 __in BURN_PLAN* pPlan, 957 __in BURN_PLAN* pPlan,
958 __in BURN_USER_EXPERIENCE* pUX,
959 __in BURN_LOGGING* pLog,
960 __in BURN_VARIABLES* pVariables,
955 __in_opt BURN_ROLLBACK_BOUNDARY* pEffectiveRollbackBoundary, 961 __in_opt BURN_ROLLBACK_BOUNDARY* pEffectiveRollbackBoundary,
956 __inout BURN_ROLLBACK_BOUNDARY** ppRollbackBoundary 962 __inout BURN_ROLLBACK_BOUNDARY** ppRollbackBoundary
957 ) 963 )
@@ -969,7 +975,7 @@ static HRESULT ProcessPackageRollbackBoundary(
969 } 975 }
970 976
971 // Start new rollback boundary. 977 // Start new rollback boundary.
972 hr = PlanRollbackBoundaryBegin(pPlan, pEffectiveRollbackBoundary); 978 hr = PlanRollbackBoundaryBegin(pPlan, pUX, pLog, pVariables, pEffectiveRollbackBoundary);
973 ExitOnFailure(hr, "Failed to plan rollback boundary begin."); 979 ExitOnFailure(hr, "Failed to plan rollback boundary begin.");
974 980
975 *ppRollbackBoundary = pEffectiveRollbackBoundary; 981 *ppRollbackBoundary = pEffectiveRollbackBoundary;
@@ -1702,6 +1708,9 @@ LExit:
1702 1708
1703extern "C" HRESULT PlanRollbackBoundaryBegin( 1709extern "C" HRESULT PlanRollbackBoundaryBegin(
1704 __in BURN_PLAN* pPlan, 1710 __in BURN_PLAN* pPlan,
1711 __in BURN_USER_EXPERIENCE* pUX,
1712 __in BURN_LOGGING* /*pLog*/,
1713 __in BURN_VARIABLES* /*pVariables*/,
1705 __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary 1714 __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary
1706 ) 1715 )
1707{ 1716{
@@ -1725,9 +1734,17 @@ extern "C" HRESULT PlanRollbackBoundaryBegin(
1725 pExecuteAction->type = BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY; 1734 pExecuteAction->type = BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY;
1726 pExecuteAction->rollbackBoundary.pRollbackBoundary = pRollbackBoundary; 1735 pExecuteAction->rollbackBoundary.pRollbackBoundary = pRollbackBoundary;
1727 1736
1728 // Add begin MSI transaction to execute plan. 1737 hr = UserExperienceOnPlanRollbackBoundary(pUX, pRollbackBoundary->sczId, &pRollbackBoundary->fTransaction);
1729 if (pRollbackBoundary->fTransaction) 1738 ExitOnRootFailure(hr, "BA aborted plan rollback boundary.");
1739
1740 // Only use MSI transaction if authored and the BA requested it.
1741 if (!pRollbackBoundary->fTransactionAuthored || !pRollbackBoundary->fTransaction)
1742 {
1743 pRollbackBoundary->fTransaction = FALSE;
1744 }
1745 else
1730 { 1746 {
1747 // Add begin MSI transaction to execute plan.
1731 hr = PlanExecuteCheckpoint(pPlan); 1748 hr = PlanExecuteCheckpoint(pPlan);
1732 ExitOnFailure(hr, "Failed to append checkpoint before MSI transaction begin action."); 1749 ExitOnFailure(hr, "Failed to append checkpoint before MSI transaction begin action.");
1733 1750
@@ -1925,6 +1942,7 @@ static void ResetPlannedRollbackBoundaryState(
1925 ) 1942 )
1926{ 1943{
1927 pRollbackBoundary->fActiveTransaction = FALSE; 1944 pRollbackBoundary->fActiveTransaction = FALSE;
1945 pRollbackBoundary->fTransaction = pRollbackBoundary->fTransactionAuthored;
1928 ReleaseNullStr(pRollbackBoundary->sczLogPath); 1946 ReleaseNullStr(pRollbackBoundary->sczLogPath);
1929} 1947}
1930 1948
diff --git a/src/burn/engine/plan.h b/src/burn/engine/plan.h
index b148c75b..b8bb8c3d 100644
--- a/src/burn/engine/plan.h
+++ b/src/burn/engine/plan.h
@@ -438,6 +438,9 @@ HRESULT PlanAppendRollbackAction(
438 ); 438 );
439HRESULT PlanRollbackBoundaryBegin( 439HRESULT PlanRollbackBoundaryBegin(
440 __in BURN_PLAN* pPlan, 440 __in BURN_PLAN* pPlan,
441 __in BURN_USER_EXPERIENCE* pUX,
442 __in BURN_LOGGING* pLog,
443 __in BURN_VARIABLES* pVariables,
441 __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary 444 __in BURN_ROLLBACK_BOUNDARY* pRollbackBoundary
442 ); 445 );
443HRESULT PlanRollbackBoundaryComplete( 446HRESULT PlanRollbackBoundaryComplete(
diff --git a/src/burn/engine/userexperience.cpp b/src/burn/engine/userexperience.cpp
index f48e60de..c974f4d4 100644
--- a/src/burn/engine/userexperience.cpp
+++ b/src/burn/engine/userexperience.cpp
@@ -104,7 +104,7 @@ extern "C" HRESULT UserExperienceLoad(
104 args.pCommand = pCommand; 104 args.pCommand = pCommand;
105 args.pfnBootstrapperEngineProc = EngineForApplicationProc; 105 args.pfnBootstrapperEngineProc = EngineForApplicationProc;
106 args.pvBootstrapperEngineProcContext = pEngineContext; 106 args.pvBootstrapperEngineProcContext = pEngineContext;
107 args.qwEngineAPIVersion = MAKEQWORDVERSION(2021, 4, 27, 0); 107 args.qwEngineAPIVersion = MAKEQWORDVERSION(2021, 8, 10, 0);
108 108
109 results.cbSize = sizeof(BOOTSTRAPPER_CREATE_RESULTS); 109 results.cbSize = sizeof(BOOTSTRAPPER_CREATE_RESULTS);
110 110
@@ -2056,6 +2056,36 @@ LExit:
2056 return hr; 2056 return hr;
2057} 2057}
2058 2058
2059EXTERN_C BAAPI UserExperienceOnPlanRollbackBoundary(
2060 __in BURN_USER_EXPERIENCE* pUserExperience,
2061 __in_z LPCWSTR wzRollbackBoundaryId,
2062 __inout BOOL* pfTransaction
2063 )
2064{
2065 HRESULT hr = S_OK;
2066 BA_ONPLANROLLBACKBOUNDARY_ARGS args = { };
2067 BA_ONPLANROLLBACKBOUNDARY_RESULTS results = { };
2068
2069 args.cbSize = sizeof(args);
2070 args.wzRollbackBoundaryId = wzRollbackBoundaryId;
2071 args.fRecommendedTransaction = *pfTransaction;
2072
2073 results.cbSize = sizeof(results);
2074 results.fTransaction = *pfTransaction;
2075
2076 hr = SendBAMessage(pUserExperience, BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANROLLBACKBOUNDARY, &args, &results);
2077 ExitOnFailure(hr, "BA OnPlanRollbackBoundary failed.");
2078
2079 if (results.fCancel)
2080 {
2081 hr = HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT);
2082 }
2083 *pfTransaction = results.fTransaction;
2084
2085LExit:
2086 return hr;
2087}
2088
2059EXTERN_C BAAPI UserExperienceOnPlanPatchTarget( 2089EXTERN_C BAAPI UserExperienceOnPlanPatchTarget(
2060 __in BURN_USER_EXPERIENCE* pUserExperience, 2090 __in BURN_USER_EXPERIENCE* pUserExperience,
2061 __in_z LPCWSTR wzPackageId, 2091 __in_z LPCWSTR wzPackageId,
diff --git a/src/burn/engine/userexperience.h b/src/burn/engine/userexperience.h
index aaf69083..c2219f7e 100644
--- a/src/burn/engine/userexperience.h
+++ b/src/burn/engine/userexperience.h
@@ -470,6 +470,11 @@ BAAPI UserExperienceOnPlanRelatedBundle(
470 __in_z LPCWSTR wzBundleId, 470 __in_z LPCWSTR wzBundleId,
471 __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState 471 __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState
472 ); 472 );
473BAAPI UserExperienceOnPlanRollbackBoundary(
474 __in BURN_USER_EXPERIENCE* pUserExperience,
475 __in_z LPCWSTR wzRollbackBoundaryId,
476 __inout BOOL *pfTransaction
477 );
473BAAPI UserExperienceOnPlanPatchTarget( 478BAAPI UserExperienceOnPlanPatchTarget(
474 __in BURN_USER_EXPERIENCE* pUserExperience, 479 __in BURN_USER_EXPERIENCE* pUserExperience,
475 __in_z LPCWSTR wzPackageId, 480 __in_z LPCWSTR wzPackageId,