aboutsummaryrefslogtreecommitdiff
path: root/src/engine/apply.cpp
diff options
context:
space:
mode:
authorNir Bar <nir.bar@panel-sw.co.il>2021-03-17 14:45:03 -0500
committerSean Hall <r.sean.hall@gmail.com>2021-03-17 14:49:24 -0500
commitb7582318f6cb6e166f5ca22128caea2a97551a1f (patch)
treef92071000dd33376e6b982b52ed2172278ef4035 /src/engine/apply.cpp
parentaf68033509730ffe01602f839861a47287bb709f (diff)
downloadwix-b7582318f6cb6e166f5ca22128caea2a97551a1f.tar.gz
wix-b7582318f6cb6e166f5ca22128caea2a97551a1f.tar.bz2
wix-b7582318f6cb6e166f5ca22128caea2a97551a1f.zip
Use wiutil to start/end msi transactions
Release MSI transaction handles immediately contributes to #5386
Diffstat (limited to 'src/engine/apply.cpp')
-rw-r--r--src/engine/apply.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/engine/apply.cpp b/src/engine/apply.cpp
index 3fbab61a..77080c76 100644
--- a/src/engine/apply.cpp
+++ b/src/engine/apply.cpp
@@ -821,16 +821,16 @@ extern "C" HRESULT ApplyExecute(
821 break; 821 break;
822 } 822 }
823 823
824 // If inside a MSI transaction, roll it back.
825 if (pCheckpoint && pCheckpoint->pActiveRollbackBoundary && pCheckpoint->pActiveRollbackBoundary->fActiveTransaction)
826 {
827 hrRollback = ExecuteMsiRollbackTransaction(pEngineState, pCheckpoint->pActiveRollbackBoundary, &context);
828 IgnoreRollbackError(hrRollback, "Failed rolling back transaction");
829 }
830
831 // The action failed, roll back to previous rollback boundary.
832 if (pCheckpoint) 824 if (pCheckpoint)
833 { 825 {
826 // If inside a MSI transaction, roll it back.
827 if (pCheckpoint->pActiveRollbackBoundary && pCheckpoint->pActiveRollbackBoundary->fActiveTransaction)
828 {
829 hrRollback = ExecuteMsiRollbackTransaction(pEngineState, pCheckpoint->pActiveRollbackBoundary, &context);
830 IgnoreRollbackError(hrRollback, "Failed rolling back transaction");
831 }
832
833 // The action failed, roll back to previous rollback boundary.
834 hrRollback = DoRollbackActions(pEngineState, &context, pCheckpoint->dwId, pRestart); 834 hrRollback = DoRollbackActions(pEngineState, &context, pCheckpoint->dwId, pRestart);
835 IgnoreRollbackError(hrRollback, "Failed rollback actions"); 835 IgnoreRollbackError(hrRollback, "Failed rollback actions");
836 } 836 }
@@ -2316,12 +2316,12 @@ static HRESULT ExecuteMsiBeginTransaction(
2316 2316
2317 if (pEngineState->plan.fPerMachine) 2317 if (pEngineState->plan.fPerMachine)
2318 { 2318 {
2319 hr = ElevationMsiBeginTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary->sczId); 2319 hr = ElevationMsiBeginTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary);
2320 ExitOnFailure(hr, "Failed to begin an elevated MSI transaction."); 2320 ExitOnFailure(hr, "Failed to begin an elevated MSI transaction.");
2321 } 2321 }
2322 else 2322 else
2323 { 2323 {
2324 hr = MsiEngineBeginTransaction(pRollbackBoundary->sczId); 2324 hr = MsiEngineBeginTransaction(pRollbackBoundary);
2325 } 2325 }
2326 2326
2327 if (SUCCEEDED(hr)) 2327 if (SUCCEEDED(hr))
@@ -2347,25 +2347,25 @@ static HRESULT ExecuteMsiCommitTransaction(
2347 ) 2347 )
2348{ 2348{
2349 HRESULT hr = S_OK; 2349 HRESULT hr = S_OK;
2350 BOOL fBeginCalled = FALSE; 2350 BOOL fCommitBeginCalled = FALSE;
2351 2351
2352 if (!pRollbackBoundary->fActiveTransaction) 2352 if (!pRollbackBoundary->fActiveTransaction)
2353 { 2353 {
2354 ExitFunction1(hr = E_INVALIDSTATE); 2354 ExitFunction1(hr = E_INVALIDSTATE);
2355 } 2355 }
2356 2356
2357 fBeginCalled = TRUE; 2357 fCommitBeginCalled = TRUE;
2358 hr = UserExperienceOnCommitMsiTransactionBegin(&pEngineState->userExperience, pRollbackBoundary->sczId); 2358 hr = UserExperienceOnCommitMsiTransactionBegin(&pEngineState->userExperience, pRollbackBoundary->sczId);
2359 ExitOnRootFailure(hr, "BA aborted execute commit MSI transaction."); 2359 ExitOnRootFailure(hr, "BA aborted execute commit MSI transaction.");
2360 2360
2361 if (pEngineState->plan.fPerMachine) 2361 if (pEngineState->plan.fPerMachine)
2362 { 2362 {
2363 hr = ElevationMsiCommitTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary->sczId); 2363 hr = ElevationMsiCommitTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary);
2364 ExitOnFailure(hr, "Failed to commit an elevated MSI transaction."); 2364 ExitOnFailure(hr, "Failed to commit an elevated MSI transaction.");
2365 } 2365 }
2366 else 2366 else
2367 { 2367 {
2368 hr = MsiEngineCommitTransaction(pRollbackBoundary->sczId); 2368 hr = MsiEngineCommitTransaction(pRollbackBoundary);
2369 } 2369 }
2370 2370
2371 if (SUCCEEDED(hr)) 2371 if (SUCCEEDED(hr))
@@ -2376,7 +2376,7 @@ static HRESULT ExecuteMsiCommitTransaction(
2376 } 2376 }
2377 2377
2378LExit: 2378LExit:
2379 if (fBeginCalled) 2379 if (fCommitBeginCalled)
2380 { 2380 {
2381 UserExperienceOnCommitMsiTransactionComplete(&pEngineState->userExperience, pRollbackBoundary->sczId, hr); 2381 UserExperienceOnCommitMsiTransactionComplete(&pEngineState->userExperience, pRollbackBoundary->sczId, hr);
2382 } 2382 }
@@ -2391,24 +2391,24 @@ static HRESULT ExecuteMsiRollbackTransaction(
2391 ) 2391 )
2392{ 2392{
2393 HRESULT hr = S_OK; 2393 HRESULT hr = S_OK;
2394 BOOL fBeginCalled = FALSE; 2394 BOOL fRollbackBeginCalled = FALSE;
2395 2395
2396 if (!pRollbackBoundary->fActiveTransaction) 2396 if (!pRollbackBoundary->fActiveTransaction)
2397 { 2397 {
2398 ExitFunction(); 2398 ExitFunction();
2399 } 2399 }
2400 2400
2401 fBeginCalled = TRUE; 2401 fRollbackBeginCalled = TRUE;
2402 UserExperienceOnRollbackMsiTransactionBegin(&pEngineState->userExperience, pRollbackBoundary->sczId); 2402 UserExperienceOnRollbackMsiTransactionBegin(&pEngineState->userExperience, pRollbackBoundary->sczId);
2403 2403
2404 if (pEngineState->plan.fPerMachine) 2404 if (pEngineState->plan.fPerMachine)
2405 { 2405 {
2406 hr = ElevationMsiRollbackTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary->sczId); 2406 hr = ElevationMsiRollbackTransaction(pEngineState->companionConnection.hPipe, pRollbackBoundary);
2407 ExitOnFailure(hr, "Failed to rollback an elevated MSI transaction."); 2407 ExitOnFailure(hr, "Failed to rollback an elevated MSI transaction.");
2408 } 2408 }
2409 else 2409 else
2410 { 2410 {
2411 hr = MsiEngineRollbackTransaction(pRollbackBoundary->sczId); 2411 hr = MsiEngineRollbackTransaction(pRollbackBoundary);
2412 } 2412 }
2413 2413
2414LExit: 2414LExit:
@@ -2416,7 +2416,7 @@ LExit:
2416 2416
2417 ResetTransactionRegistrationState(pEngineState, FALSE); 2417 ResetTransactionRegistrationState(pEngineState, FALSE);
2418 2418
2419 if (fBeginCalled) 2419 if (fRollbackBeginCalled)
2420 { 2420 {
2421 UserExperienceOnRollbackMsiTransactionComplete(&pEngineState->userExperience, pRollbackBoundary->sczId, hr); 2421 UserExperienceOnRollbackMsiTransactionComplete(&pEngineState->userExperience, pRollbackBoundary->sczId, hr);
2422 } 2422 }