aboutsummaryrefslogtreecommitdiff
path: root/src/engine/apply.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/apply.cpp')
-rw-r--r--src/engine/apply.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/engine/apply.cpp b/src/engine/apply.cpp
index 4570ffb9..74f57f6a 100644
--- a/src/engine/apply.cpp
+++ b/src/engine/apply.cpp
@@ -1422,19 +1422,19 @@ static HRESULT AcquireContainerOrPayload(
1422 hr = CacheGetLocalSourcePaths(wzRelativePath, *pwzSourcePath, wzDestinationPath, pContext->wzLayoutDirectory, pContext->pVariables, &pContext->rgSearchPaths, &pContext->cSearchPaths, &dwChosenSearchPath, &dwDestinationSearchPath); 1422 hr = CacheGetLocalSourcePaths(wzRelativePath, *pwzSourcePath, wzDestinationPath, pContext->wzLayoutDirectory, pContext->pVariables, &pContext->rgSearchPaths, &pContext->cSearchPaths, &dwChosenSearchPath, &dwDestinationSearchPath);
1423 ExitOnFailure(hr, "Failed to search local source."); 1423 ExitOnFailure(hr, "Failed to search local source.");
1424 1424
1425 // When a payload comes from a container, the container has the highest chance of being correct.
1426 // But we want to avoid extracting the container multiple times.
1427 // So only consider the destination path, which means the container was already extracted.
1428 if (wzPayloadContainerId) 1425 if (wzPayloadContainerId)
1429 { 1426 {
1427 // When a payload comes from a container, the container has the highest chance of being correct.
1428 // But we want to avoid extracting the container multiple times.
1429 // So only consider the destination path, which means the container was already extracted.
1430 if (FileExistsEx(pContext->rgSearchPaths[dwDestinationSearchPath], NULL)) 1430 if (FileExistsEx(pContext->rgSearchPaths[dwDestinationSearchPath], NULL))
1431 { 1431 {
1432 fFoundLocal = TRUE; 1432 fFoundLocal = TRUE;
1433 dwChosenSearchPath = dwDestinationSearchPath; 1433 dwChosenSearchPath = dwDestinationSearchPath;
1434 } 1434 }
1435 else 1435 else // don't prefer the container if extracting it already failed.
1436 { 1436 {
1437 fPreferExtract = TRUE; 1437 fPreferExtract = SUCCEEDED(pPayload->pContainer->hrExtract);
1438 } 1438 }
1439 } 1439 }
1440 1440
@@ -1470,14 +1470,14 @@ static HRESULT AcquireContainerOrPayload(
1470 { 1470 {
1471 resolveOperation = BOOTSTRAPPER_CACHE_RESOLVE_LOCAL; 1471 resolveOperation = BOOTSTRAPPER_CACHE_RESOLVE_LOCAL;
1472 } 1472 }
1473 else if (wzPayloadContainerId)
1474 {
1475 resolveOperation = BOOTSTRAPPER_CACHE_RESOLVE_CONTAINER;
1476 }
1477 else if (*pwzDownloadUrl && **pwzDownloadUrl) 1473 else if (*pwzDownloadUrl && **pwzDownloadUrl)
1478 { 1474 {
1479 resolveOperation = BOOTSTRAPPER_CACHE_RESOLVE_DOWNLOAD; 1475 resolveOperation = BOOTSTRAPPER_CACHE_RESOLVE_DOWNLOAD;
1480 } 1476 }
1477 else if (wzPayloadContainerId)
1478 {
1479 resolveOperation = BOOTSTRAPPER_CACHE_RESOLVE_CONTAINER;
1480 }
1481 } 1481 }
1482 1482
1483 // Let the BA have a chance to override the source. 1483 // Let the BA have a chance to override the source.
@@ -1526,7 +1526,7 @@ static HRESULT AcquireContainerOrPayload(
1526 1526
1527 break; 1527 break;
1528 case BOOTSTRAPPER_CACHE_OPERATION_EXTRACT: 1528 case BOOTSTRAPPER_CACHE_OPERATION_EXTRACT:
1529 Assert(pPayload->pContainer); 1529 Assert(pPayload && pPayload->pContainer);
1530 1530
1531 hr = ApplyExtractContainer(pContext, pPayload->pContainer); 1531 hr = ApplyExtractContainer(pContext, pPayload->pContainer);
1532 ExitOnFailure(hr, "Failed to extract container for payload: %ls", wzPayloadId); 1532 ExitOnFailure(hr, "Failed to extract container for payload: %ls", wzPayloadId);
@@ -1541,6 +1541,15 @@ static HRESULT AcquireContainerOrPayload(
1541 hr = CompleteCacheProgress(pProgress, pContainer ? pContainer->qwFileSize : pPayload->qwFileSize); 1541 hr = CompleteCacheProgress(pProgress, pContainer ? pContainer->qwFileSize : pPayload->qwFileSize);
1542 1542
1543LExit: 1543LExit:
1544 if (BOOTSTRAPPER_CACHE_OPERATION_EXTRACT == cacheOperation)
1545 {
1546 if (FAILED(hr) && SUCCEEDED(pPayload->pContainer->hrExtract) &&
1547 (fFoundLocal || pPayload->downloadSource.sczUrl && *pPayload->downloadSource.sczUrl))
1548 {
1549 *pfRetry = TRUE;
1550 }
1551 pPayload->pContainer->hrExtract = hr;
1552 }
1544 UserExperienceOnCacheAcquireComplete(pContext->pUX, wzPackageOrContainerId, wzPayloadId, hr, pfRetry); 1553 UserExperienceOnCacheAcquireComplete(pContext->pUX, wzPackageOrContainerId, wzPayloadId, hr, pfRetry);
1545 1554
1546 pContext->cSearchPathsMax = max(pContext->cSearchPaths, pContext->cSearchPathsMax); 1555 pContext->cSearchPathsMax = max(pContext->cSearchPaths, pContext->cSearchPathsMax);