summaryrefslogtreecommitdiff
path: root/src/burn/engine/apply.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/burn/engine/apply.cpp')
-rw-r--r--src/burn/engine/apply.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/burn/engine/apply.cpp b/src/burn/engine/apply.cpp
index c126d63c..002158b6 100644
--- a/src/burn/engine/apply.cpp
+++ b/src/burn/engine/apply.cpp
@@ -26,6 +26,7 @@ enum BURN_CACHE_PROGRESS_TYPE
26 26
27typedef struct _BURN_CACHE_CONTEXT 27typedef struct _BURN_CACHE_CONTEXT
28{ 28{
29 BURN_CACHE* pCache;
29 BURN_USER_EXPERIENCE* pUX; 30 BURN_USER_EXPERIENCE* pUX;
30 BURN_VARIABLES* pVariables; 31 BURN_VARIABLES* pVariables;
31 BURN_PAYLOADS* pPayloads; 32 BURN_PAYLOADS* pPayloads;
@@ -55,6 +56,7 @@ typedef struct _BURN_CACHE_PROGRESS_CONTEXT
55 56
56typedef struct _BURN_EXECUTE_CONTEXT 57typedef struct _BURN_EXECUTE_CONTEXT
57{ 58{
59 BURN_CACHE* pCache;
58 BURN_USER_EXPERIENCE* pUX; 60 BURN_USER_EXPERIENCE* pUX;
59 BURN_APPLY_CONTEXT* pApplyContext; 61 BURN_APPLY_CONTEXT* pApplyContext;
60 BOOL fRollback; 62 BOOL fRollback;
@@ -269,6 +271,7 @@ static void ResetTransactionRegistrationState(
269 __in BOOL fCommit 271 __in BOOL fCommit
270 ); 272 );
271static HRESULT CleanPackage( 273static HRESULT CleanPackage(
274 __in BURN_CACHE* pCache,
272 __in HANDLE hElevatedPipe, 275 __in HANDLE hElevatedPipe,
273 __in BURN_PACKAGE* pPackage 276 __in BURN_PACKAGE* pPackage
274 ); 277 );
@@ -401,7 +404,7 @@ extern "C" HRESULT ApplyRegister(
401 } 404 }
402 else // need to complete registration on the machine. 405 else // need to complete registration on the machine.
403 { 406 {
404 hr = CacheCalculateBundleWorkingPath(pEngineState->registration.sczId, pEngineState->registration.sczExecutableName, &sczEngineWorkingPath); 407 hr = CacheCalculateBundleWorkingPath(pEngineState->plan.pCache, pEngineState->registration.sczExecutableName, &sczEngineWorkingPath);
405 ExitOnFailure(hr, "Failed to calculate working path for engine."); 408 ExitOnFailure(hr, "Failed to calculate working path for engine.");
406 409
407 // begin new session 410 // begin new session
@@ -412,7 +415,7 @@ extern "C" HRESULT ApplyRegister(
412 } 415 }
413 else 416 else
414 { 417 {
415 hr = RegistrationSessionBegin(sczEngineWorkingPath, &pEngineState->registration, &pEngineState->variables, pEngineState->plan.dwRegistrationOperations, pEngineState->plan.dependencyRegistrationAction, pEngineState->plan.qwEstimatedSize, registrationType); 418 hr = RegistrationSessionBegin(sczEngineWorkingPath, &pEngineState->registration, &pEngineState->cache, &pEngineState->variables, pEngineState->plan.dwRegistrationOperations, pEngineState->plan.dependencyRegistrationAction, pEngineState->plan.qwEstimatedSize, registrationType);
416 ExitOnFailure(hr, "Failed to begin registration session."); 419 ExitOnFailure(hr, "Failed to begin registration session.");
417 } 420 }
418 } 421 }
@@ -501,7 +504,7 @@ extern "C" HRESULT ApplyUnregister(
501 } 504 }
502 else 505 else
503 { 506 {
504 hr = RegistrationSessionEnd(&pEngineState->registration, &pEngineState->variables, &pEngineState->packages, resumeMode, restart, pEngineState->plan.dependencyRegistrationAction, registrationType); 507 hr = RegistrationSessionEnd(&pEngineState->registration, &pEngineState->cache, &pEngineState->variables, &pEngineState->packages, resumeMode, restart, pEngineState->plan.dependencyRegistrationAction, registrationType);
505 ExitOnFailure(hr, "Failed to end session in per-user process."); 508 ExitOnFailure(hr, "Failed to end session in per-user process.");
506 } 509 }
507 510
@@ -531,6 +534,7 @@ extern "C" HRESULT ApplyCache(
531 ExitOnRootFailure(hr, "BA aborted cache."); 534 ExitOnRootFailure(hr, "BA aborted cache.");
532 535
533 cacheContext.hSourceEngineFile = hSourceEngineFile; 536 cacheContext.hSourceEngineFile = hSourceEngineFile;
537 cacheContext.pCache = pPlan->pCache;
534 cacheContext.pPayloads = pPlan->pPayloads; 538 cacheContext.pPayloads = pPlan->pPayloads;
535 cacheContext.pUX = pUX; 539 cacheContext.pUX = pUX;
536 cacheContext.pVariables = pVariables; 540 cacheContext.pVariables = pVariables;
@@ -568,7 +572,7 @@ extern "C" HRESULT ApplyCache(
568 { 572 {
569 if (!pPackage->fPerMachine || INVALID_HANDLE_VALUE == cacheContext.hPipe) 573 if (!pPackage->fPerMachine || INVALID_HANDLE_VALUE == cacheContext.hPipe)
570 { 574 {
571 hr = CachePreparePackage(pPackage); 575 hr = CachePreparePackage(pPlan->pCache, pPackage);
572 576
573 cacheContext.hPipe = INVALID_HANDLE_VALUE; 577 cacheContext.hPipe = INVALID_HANDLE_VALUE;
574 } 578 }
@@ -616,7 +620,7 @@ LExit:
616 ElevationCacheCleanup(hPipe); 620 ElevationCacheCleanup(hPipe);
617 } 621 }
618 622
619 CacheCleanup(FALSE, pPlan->wzBundleId); 623 CacheCleanup(FALSE, pPlan->pCache);
620 624
621 for (DWORD i = 0; i < cacheContext.cSearchPathsMax; ++i) 625 for (DWORD i = 0; i < cacheContext.cSearchPathsMax; ++i)
622 { 626 {
@@ -653,6 +657,7 @@ extern "C" HRESULT ApplyExecute(
653 BURN_ROLLBACK_BOUNDARY* pRollbackBoundary = NULL; 657 BURN_ROLLBACK_BOUNDARY* pRollbackBoundary = NULL;
654 BOOL fSeekNextRollbackBoundary = FALSE; 658 BOOL fSeekNextRollbackBoundary = FALSE;
655 659
660 context.pCache = pEngineState->plan.pCache;
656 context.pUX = &pEngineState->userExperience; 661 context.pUX = &pEngineState->userExperience;
657 context.pApplyContext = pApplyContext; 662 context.pApplyContext = pApplyContext;
658 context.cExecutePackagesTotal = pEngineState->plan.cExecutePackagesTotal; 663 context.cExecutePackagesTotal = pEngineState->plan.cExecutePackagesTotal;
@@ -762,7 +767,7 @@ extern "C" void ApplyClean(
762 BURN_CLEAN_ACTION* pCleanAction = pPlan->rgCleanActions + i; 767 BURN_CLEAN_ACTION* pCleanAction = pPlan->rgCleanActions + i;
763 BURN_PACKAGE* pPackage = pCleanAction->pPackage; 768 BURN_PACKAGE* pPackage = pCleanAction->pPackage;
764 769
765 hr = CleanPackage(hPipe, pPackage); 770 hr = CleanPackage(pPlan->pCache, hPipe, pPackage);
766 } 771 }
767} 772}
768 773
@@ -1479,7 +1484,7 @@ static HRESULT AcquireContainerOrPayload(
1479 dwChosenSearchPath = 0; 1484 dwChosenSearchPath = 0;
1480 dwDestinationSearchPath = 0; 1485 dwDestinationSearchPath = 0;
1481 1486
1482 hr = CacheGetLocalSourcePaths(wzRelativePath, *pwzSourcePath, wzDestinationPath, pContext->wzLayoutDirectory, pContext->pVariables, &pContext->rgSearchPaths, &pContext->cSearchPaths, &dwChosenSearchPath, &dwDestinationSearchPath); 1487 hr = CacheGetLocalSourcePaths(wzRelativePath, *pwzSourcePath, wzDestinationPath, pContext->wzLayoutDirectory, pContext->pCache, pContext->pVariables, &pContext->rgSearchPaths, &pContext->cSearchPaths, &dwChosenSearchPath, &dwDestinationSearchPath);
1483 ExitOnFailure(hr, "Failed to search local source."); 1488 ExitOnFailure(hr, "Failed to search local source.");
1484 1489
1485 if (wzPayloadContainerId) 1490 if (wzPayloadContainerId)
@@ -1710,7 +1715,7 @@ static HRESULT LayoutOrCacheContainerOrPayload(
1710 } 1715 }
1711 else // complete the payload. 1716 else // complete the payload.
1712 { 1717 {
1713 hr = CacheCompletePayload(pPackage->fPerMachine, pPayload, pPackage->sczCacheId, wzUnverifiedPath, fMove, CacheMessageHandler, CacheProgressRoutine, &progress); 1718 hr = CacheCompletePayload(pContext->pCache, pPackage->fPerMachine, pPayload, pPackage->sczCacheId, wzUnverifiedPath, fMove, CacheMessageHandler, CacheProgressRoutine, &progress);
1714 } 1719 }
1715 } 1720 }
1716 1721
@@ -2174,7 +2179,7 @@ static void DoRollbackCache(
2174 { 2179 {
2175 if (dwLastCheckpoint <= dwCheckpoint) // only rollback when it was attempted to be cached. 2180 if (dwLastCheckpoint <= dwCheckpoint) // only rollback when it was attempted to be cached.
2176 { 2181 {
2177 hr = CleanPackage(hPipe, pPackage); 2182 hr = CleanPackage(pPlan->pCache, hPipe, pPackage);
2178 } 2183 }
2179 } 2184 }
2180 else if (pPackage->fCanAffectRegistration) 2185 else if (pPackage->fCanAffectRegistration)
@@ -2401,7 +2406,7 @@ static HRESULT DoRollbackActions(
2401 case BURN_EXECUTE_ACTION_TYPE_UNCACHE_PACKAGE: 2406 case BURN_EXECUTE_ACTION_TYPE_UNCACHE_PACKAGE:
2402 if (!pRollbackAction->uncachePackage.pPackage->fCached) // only rollback when it wasn't already cached. 2407 if (!pRollbackAction->uncachePackage.pPackage->fCached) // only rollback when it wasn't already cached.
2403 { 2408 {
2404 hr = CleanPackage(pEngineState->companionConnection.hPipe, pRollbackAction->uncachePackage.pPackage); 2409 hr = CleanPackage(pEngineState->plan.pCache, pEngineState->companionConnection.hPipe, pRollbackAction->uncachePackage.pPackage);
2405 IgnoreRollbackError(hr, "Failed to uncache package for rollback."); 2410 IgnoreRollbackError(hr, "Failed to uncache package for rollback.");
2406 } 2411 }
2407 else if (pRollbackAction->uncachePackage.pPackage->fCanAffectRegistration) 2412 else if (pRollbackAction->uncachePackage.pPackage->fCanAffectRegistration)
@@ -2477,7 +2482,7 @@ static HRESULT ExecuteExePackage(
2477 } 2482 }
2478 else 2483 else
2479 { 2484 {
2480 hrExecute = ExeEngineExecutePackage(pExecuteAction, &pEngineState->variables, fRollback, GenericExecuteMessageHandler, pContext, pRestart); 2485 hrExecute = ExeEngineExecutePackage(pExecuteAction, pContext->pCache, &pEngineState->variables, fRollback, GenericExecuteMessageHandler, pContext, pRestart);
2481 ExitOnFailure(hrExecute, "Failed to configure per-user EXE package."); 2486 ExitOnFailure(hrExecute, "Failed to configure per-user EXE package.");
2482 } 2487 }
2483 2488
@@ -2548,7 +2553,7 @@ static HRESULT ExecuteMsiPackage(
2548 } 2553 }
2549 else 2554 else
2550 { 2555 {
2551 hrExecute = MsiEngineExecutePackage(pEngineState->userExperience.hwndApply, pExecuteAction, &pEngineState->variables, fRollback, MsiExecuteMessageHandler, pContext, pRestart); 2556 hrExecute = MsiEngineExecutePackage(pEngineState->userExperience.hwndApply, pExecuteAction, pContext->pCache, &pEngineState->variables, fRollback, MsiExecuteMessageHandler, pContext, pRestart);
2552 ExitOnFailure(hrExecute, "Failed to configure per-user MSI package."); 2557 ExitOnFailure(hrExecute, "Failed to configure per-user MSI package.");
2553 } 2558 }
2554 2559
@@ -2621,7 +2626,7 @@ static HRESULT ExecuteMspPackage(
2621 } 2626 }
2622 else 2627 else
2623 { 2628 {
2624 hrExecute = MspEngineExecutePackage(pEngineState->userExperience.hwndApply, pExecuteAction, &pEngineState->variables, fRollback, MsiExecuteMessageHandler, pContext, pRestart); 2629 hrExecute = MspEngineExecutePackage(pEngineState->userExperience.hwndApply, pExecuteAction, pContext->pCache, &pEngineState->variables, fRollback, MsiExecuteMessageHandler, pContext, pRestart);
2625 ExitOnFailure(hrExecute, "Failed to configure per-user MSP package."); 2630 ExitOnFailure(hrExecute, "Failed to configure per-user MSP package.");
2626 } 2631 }
2627 2632
@@ -2983,6 +2988,7 @@ static void ResetTransactionRegistrationState(
2983} 2988}
2984 2989
2985static HRESULT CleanPackage( 2990static HRESULT CleanPackage(
2991 __in BURN_CACHE* pCache,
2986 __in HANDLE hElevatedPipe, 2992 __in HANDLE hElevatedPipe,
2987 __in BURN_PACKAGE* pPackage 2993 __in BURN_PACKAGE* pPackage
2988 ) 2994 )
@@ -2995,7 +3001,7 @@ static HRESULT CleanPackage(
2995 } 3001 }
2996 else 3002 else
2997 { 3003 {
2998 hr = CacheRemovePackage(FALSE, pPackage->sczId, pPackage->sczCacheId); 3004 hr = CacheRemovePackage(pCache, FALSE, pPackage->sczId, pPackage->sczCacheId);
2999 } 3005 }
3000 3006
3001 if (pPackage->fCanAffectRegistration) 3007 if (pPackage->fCanAffectRegistration)