aboutsummaryrefslogtreecommitdiff
path: root/src/engine/apply.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-11-16 19:05:29 -0600
committerSean Hall <r.sean.hall@gmail.com>2020-11-17 19:06:00 -0600
commit7d45238e97c35ccea1f77be9065b9a3ed9213bfb (patch)
tree92a482536f944347ab9be9f1321c400d900e1cc2 /src/engine/apply.cpp
parent7a942746bc535d319bdfa7f17025347ac6913ba2 (diff)
downloadwix-7d45238e97c35ccea1f77be9065b9a3ed9213bfb.tar.gz
wix-7d45238e97c35ccea1f77be9065b9a3ed9213bfb.tar.bz2
wix-7d45238e97c35ccea1f77be9065b9a3ed9213bfb.zip
Add logging and BA messages around MSI transactions.
Diffstat (limited to 'src/engine/apply.cpp')
-rw-r--r--src/engine/apply.cpp47
1 files changed, 38 insertions, 9 deletions
diff --git a/src/engine/apply.cpp b/src/engine/apply.cpp
index 53422807..833d750c 100644
--- a/src/engine/apply.cpp
+++ b/src/engine/apply.cpp
@@ -783,7 +783,7 @@ extern "C" HRESULT ApplyExecute(
783 if (pCheckpoint && pCheckpoint->pActiveRollbackBoundary && pCheckpoint->pActiveRollbackBoundary->fActiveTransaction) 783 if (pCheckpoint && pCheckpoint->pActiveRollbackBoundary && pCheckpoint->pActiveRollbackBoundary->fActiveTransaction)
784 { 784 {
785 hr = E_INVALIDSTATE; 785 hr = E_INVALIDSTATE;
786 LogString(REPORT_ERROR, "Ilegal state: Reboot requested within an MSI transaction. Transaction will rollback."); 786 LogId(REPORT_ERROR, MSG_RESTART_REQUEST_DURING_MSI_TRANSACTION, pCheckpoint->pActiveRollbackBoundary->sczId);
787 } 787 }
788 else 788 else
789 { 789 {
@@ -796,6 +796,8 @@ extern "C" HRESULT ApplyExecute(
796 // If rollback is disabled, keep what we have and always end execution here. 796 // If rollback is disabled, keep what we have and always end execution here.
797 if (pEngineState->plan.fDisableRollback) 797 if (pEngineState->plan.fDisableRollback)
798 { 798 {
799 LogId(REPORT_WARNING, MSG_PLAN_ROLLBACK_DISABLED);
800
799 if (pCheckpoint && pCheckpoint->pActiveRollbackBoundary && pCheckpoint->pActiveRollbackBoundary->fActiveTransaction) 801 if (pCheckpoint && pCheckpoint->pActiveRollbackBoundary && pCheckpoint->pActiveRollbackBoundary->fActiveTransaction)
800 { 802 {
801 hrRollback = ExecuteMsiCommitTransaction(pEngineState, pCheckpoint->pActiveRollbackBoundary, &context); 803 hrRollback = ExecuteMsiCommitTransaction(pEngineState, pCheckpoint->pActiveRollbackBoundary, &context);
@@ -1732,13 +1734,11 @@ static HRESULT DoExecuteAction(
1732 break; 1734 break;
1733 1735
1734 case BURN_EXECUTE_ACTION_TYPE_BEGIN_MSI_TRANSACTION: 1736 case BURN_EXECUTE_ACTION_TYPE_BEGIN_MSI_TRANSACTION:
1735 LogString(REPORT_STANDARD, "Starting a new MSI transaction\n");
1736 hr = ExecuteMsiBeginTransaction(pEngineState, pExecuteAction->msiTransaction.pRollbackBoundary, pContext); 1737 hr = ExecuteMsiBeginTransaction(pEngineState, pExecuteAction->msiTransaction.pRollbackBoundary, pContext);
1737 ExitOnFailure(hr, "Failed to execute begin MSI transaction action."); 1738 ExitOnFailure(hr, "Failed to execute begin MSI transaction action.");
1738 break; 1739 break;
1739 1740
1740 case BURN_EXECUTE_ACTION_TYPE_COMMIT_MSI_TRANSACTION: 1741 case BURN_EXECUTE_ACTION_TYPE_COMMIT_MSI_TRANSACTION:
1741 LogString(REPORT_STANDARD, "Committing MSI transaction\n");
1742 hr = ExecuteMsiCommitTransaction(pEngineState, pExecuteAction->msiTransaction.pRollbackBoundary, pContext); 1742 hr = ExecuteMsiCommitTransaction(pEngineState, pExecuteAction->msiTransaction.pRollbackBoundary, pContext);
1743 ExitOnFailure(hr, "Failed to execute commit MSI transaction action."); 1743 ExitOnFailure(hr, "Failed to execute commit MSI transaction action.");
1744 break; 1744 break;
@@ -1899,7 +1899,7 @@ static HRESULT ExecuteExePackage(
1899 fBeginCalled = TRUE; 1899 fBeginCalled = TRUE;
1900 1900
1901 // Send package execute begin to BA. 1901 // Send package execute begin to BA.
1902 hr = UserExperienceOnExecutePackageBegin(&pEngineState->userExperience, pExecuteAction->exePackage.pPackage->sczId, !fRollback, pExecuteAction->exePackage.action, INSTALLUILEVEL_NOCHANGE, false); 1902 hr = UserExperienceOnExecutePackageBegin(&pEngineState->userExperience, pExecuteAction->exePackage.pPackage->sczId, !fRollback, pExecuteAction->exePackage.action, INSTALLUILEVEL_NOCHANGE, FALSE);
1903 ExitOnRootFailure(hr, "BA aborted execute EXE package begin."); 1903 ExitOnRootFailure(hr, "BA aborted execute EXE package begin.");
1904 1904
1905 message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS; 1905 message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS;
@@ -2090,7 +2090,7 @@ static HRESULT ExecuteMsuPackage(
2090 fBeginCalled = TRUE; 2090 fBeginCalled = TRUE;
2091 2091
2092 // Send package execute begin to BA. 2092 // Send package execute begin to BA.
2093 hr = UserExperienceOnExecutePackageBegin(&pEngineState->userExperience, pExecuteAction->msuPackage.pPackage->sczId, !fRollback, pExecuteAction->msuPackage.action, INSTALLUILEVEL_NOCHANGE, false); 2093 hr = UserExperienceOnExecutePackageBegin(&pEngineState->userExperience, pExecuteAction->msuPackage.pPackage->sczId, !fRollback, pExecuteAction->msuPackage.action, INSTALLUILEVEL_NOCHANGE, FALSE);
2094 ExitOnRootFailure(hr, "BA aborted execute MSU package begin."); 2094 ExitOnRootFailure(hr, "BA aborted execute MSU package begin.");
2095 2095
2096 message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS; 2096 message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS;
@@ -2206,12 +2206,17 @@ static HRESULT ExecuteMsiBeginTransaction(
2206 ) 2206 )
2207{ 2207{
2208 HRESULT hr = S_OK; 2208 HRESULT hr = S_OK;
2209 BOOL fBeginCalled = FALSE;
2209 2210
2210 if (pRollbackBoundary->fActiveTransaction) 2211 if (pRollbackBoundary->fActiveTransaction)
2211 { 2212 {
2212 ExitFunction1(hr = E_INVALIDSTATE); 2213 ExitFunction1(hr = E_INVALIDSTATE);
2213 } 2214 }
2214 2215
2216 fBeginCalled = TRUE;
2217 hr = UserExperienceOnBeginMsiTransactionBegin(&pEngineState->userExperience, pRollbackBoundary->sczId);
2218 ExitOnRootFailure(hr, "BA aborted execute begin MSI transaction.");
2219
2215 if (pEngineState->plan.fPerMachine) 2220 if (pEngineState->plan.fPerMachine)
2216 { 2221 {
2217 hr = ElevationMsiBeginTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary->sczId); 2222 hr = ElevationMsiBeginTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary->sczId);
@@ -2228,6 +2233,11 @@ static HRESULT ExecuteMsiBeginTransaction(
2228 } 2233 }
2229 2234
2230LExit: 2235LExit:
2236 if (fBeginCalled)
2237 {
2238 UserExperienceOnBeginMsiTransactionComplete(&pEngineState->userExperience, pRollbackBoundary->sczId, hr);
2239 }
2240
2231 return hr; 2241 return hr;
2232} 2242}
2233 2243
@@ -2238,20 +2248,25 @@ static HRESULT ExecuteMsiCommitTransaction(
2238 ) 2248 )
2239{ 2249{
2240 HRESULT hr = S_OK; 2250 HRESULT hr = S_OK;
2251 BOOL fBeginCalled = FALSE;
2241 2252
2242 if (!pRollbackBoundary->fActiveTransaction) 2253 if (!pRollbackBoundary->fActiveTransaction)
2243 { 2254 {
2244 ExitFunction1(hr = E_INVALIDSTATE); 2255 ExitFunction1(hr = E_INVALIDSTATE);
2245 } 2256 }
2246 2257
2258 fBeginCalled = TRUE;
2259 hr = UserExperienceOnCommitMsiTransactionBegin(&pEngineState->userExperience, pRollbackBoundary->sczId);
2260 ExitOnRootFailure(hr, "BA aborted execute commit MSI transaction.");
2261
2247 if (pEngineState->plan.fPerMachine) 2262 if (pEngineState->plan.fPerMachine)
2248 { 2263 {
2249 hr = ElevationMsiCommitTransaction(pEngineState->companionConnection.hPipe); 2264 hr = ElevationMsiCommitTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary->sczId);
2250 ExitOnFailure(hr, "Failed to commit an elevated MSI transaction."); 2265 ExitOnFailure(hr, "Failed to commit an elevated MSI transaction.");
2251 } 2266 }
2252 else 2267 else
2253 { 2268 {
2254 hr = MsiEngineCommitTransaction(); 2269 hr = MsiEngineCommitTransaction(pRollbackBoundary->sczId);
2255 } 2270 }
2256 2271
2257 if (SUCCEEDED(hr)) 2272 if (SUCCEEDED(hr))
@@ -2260,6 +2275,11 @@ static HRESULT ExecuteMsiCommitTransaction(
2260 } 2275 }
2261 2276
2262LExit: 2277LExit:
2278 if (fBeginCalled)
2279 {
2280 UserExperienceOnCommitMsiTransactionComplete(&pEngineState->userExperience, pRollbackBoundary->sczId, hr);
2281 }
2282
2263 return hr; 2283 return hr;
2264} 2284}
2265 2285
@@ -2270,25 +2290,34 @@ static HRESULT ExecuteMsiRollbackTransaction(
2270 ) 2290 )
2271{ 2291{
2272 HRESULT hr = S_OK; 2292 HRESULT hr = S_OK;
2293 BOOL fBeginCalled = FALSE;
2273 2294
2274 if (!pRollbackBoundary->fActiveTransaction) 2295 if (!pRollbackBoundary->fActiveTransaction)
2275 { 2296 {
2276 ExitFunction(); 2297 ExitFunction();
2277 } 2298 }
2278 2299
2300 fBeginCalled = TRUE;
2301 UserExperienceOnRollbackMsiTransactionBegin(&pEngineState->userExperience, pRollbackBoundary->sczId);
2302
2279 if (pEngineState->plan.fPerMachine) 2303 if (pEngineState->plan.fPerMachine)
2280 { 2304 {
2281 hr = ElevationMsiRollbackTransaction(pEngineState->companionConnection.hPipe); 2305 hr = ElevationMsiRollbackTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary->sczId);
2282 ExitOnFailure(hr, "Failed to rollback an elevated MSI transaction."); 2306 ExitOnFailure(hr, "Failed to rollback an elevated MSI transaction.");
2283 } 2307 }
2284 else 2308 else
2285 { 2309 {
2286 hr = MsiEngineRollbackTransaction(); 2310 hr = MsiEngineRollbackTransaction(pRollbackBoundary->sczId);
2287 } 2311 }
2288 2312
2289LExit: 2313LExit:
2290 pRollbackBoundary->fActiveTransaction = FALSE; 2314 pRollbackBoundary->fActiveTransaction = FALSE;
2291 2315
2316 if (fBeginCalled)
2317 {
2318 UserExperienceOnRollbackMsiTransactionComplete(&pEngineState->userExperience, pRollbackBoundary->sczId, hr);
2319 }
2320
2292 return hr; 2321 return hr;
2293} 2322}
2294 2323