aboutsummaryrefslogtreecommitdiff
path: root/src/engine/apply.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-04-16 10:18:24 -0500
committerSean Hall <r.sean.hall@gmail.com>2021-04-19 23:12:55 -0500
commitb941c2754748251520dc5032d11396c9844fad8e (patch)
tree1106c2cffdb3aecfc206daebfb6e99894fd222b2 /src/engine/apply.cpp
parent90cdf39e6e6b7d676ca33bee031fa2b865bb5fbd (diff)
downloadwix-b941c2754748251520dc5032d11396c9844fad8e.tar.gz
wix-b941c2754748251520dc5032d11396c9844fad8e.tar.bz2
wix-b941c2754748251520dc5032d11396c9844fad8e.zip
Verify file in the cache before trying to acquire it.
Diffstat (limited to 'src/engine/apply.cpp')
-rw-r--r--src/engine/apply.cpp36
1 files changed, 29 insertions, 7 deletions
diff --git a/src/engine/apply.cpp b/src/engine/apply.cpp
index 7e03ebf9..dffbc6d6 100644
--- a/src/engine/apply.cpp
+++ b/src/engine/apply.cpp
@@ -768,6 +768,12 @@ static HRESULT ApplyCachePackage(
768 HRESULT hr = S_OK; 768 HRESULT hr = S_OK;
769 BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION cachePackageCompleteAction = BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION_NONE; 769 BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION cachePackageCompleteAction = BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION_NONE;
770 770
771 if (!pPackage->sczCacheFolder && !pContext->wzLayoutDirectory)
772 {
773 hr = CacheGetCompletedPath(pPackage->fPerMachine, pPackage->sczCacheId, &pPackage->sczCacheFolder);
774 ExitOnFailure(hr, "Failed to get cached path for package with cache id: %ls", pPackage->sczCacheId);
775 }
776
771 for (;;) 777 for (;;)
772 { 778 {
773 hr = UserExperienceOnCachePackageBegin(pContext->pUX, pPackage->sczId, pPackage->payloads.cPayloads, pPackage->payloads.qwTotalSize); 779 hr = UserExperienceOnCachePackageBegin(pContext->pUX, pPackage->sczId, pPackage->payloads.cPayloads, pPackage->payloads.qwTotalSize);
@@ -872,6 +878,14 @@ static HRESULT ApplyLayoutContainer(
872 878
873 Assert(!pContainer->fAttached); 879 Assert(!pContainer->fAttached);
874 880
881 hr = CacheVerifyContainer(pContainer, pContext->wzLayoutDirectory);
882 if (SUCCEEDED(hr))
883 {
884 // TODO: send Acquire and Verify messages to BA?
885 pContext->qwSuccessfulCacheProgress += pContainer->qwFileSize * 2;
886 ExitFunction();
887 }
888
875 for (;;) 889 for (;;)
876 { 890 {
877 fRetry = FALSE; 891 fRetry = FALSE;
@@ -916,7 +930,20 @@ static HRESULT ApplyProcessPayload(
916 DWORD cTryAgainAttempts = 0; 930 DWORD cTryAgainAttempts = 0;
917 BOOL fRetry = FALSE; 931 BOOL fRetry = FALSE;
918 932
919 Assert(pContext->pPayloads || pContext->wzLayoutDirectory); 933 Assert(pContext->pPayloads && pPackage || pContext->wzLayoutDirectory);
934
935 if (pPayload->pContainer && pContext->wzLayoutDirectory)
936 {
937 ExitFunction();
938 }
939
940 hr = CacheVerifyPayload(pPayload, pContext->wzLayoutDirectory ? pContext->wzLayoutDirectory : pPackage->sczCacheFolder);
941 if (SUCCEEDED(hr))
942 {
943 // TODO: send Acquire and Verify messages to BA?
944 pContext->qwSuccessfulCacheProgress += pPayload->qwFileSize * 2;
945 ExitFunction();
946 }
920 947
921 for (;;) 948 for (;;)
922 { 949 {
@@ -924,12 +951,7 @@ static HRESULT ApplyProcessPayload(
924 951
925 if (pPayload->pContainer) 952 if (pPayload->pContainer)
926 { 953 {
927 if (pContext->wzLayoutDirectory) 954 // TODO: only extract container if payload isn't already extracted
928 {
929 ExitFunction();
930 }
931
932 // TODO: only extract container if payload isn't already cached and isn't already extracted
933 hr = ApplyExtractContainer(pContext, pPayload->pContainer); 955 hr = ApplyExtractContainer(pContext, pPayload->pContainer);
934 ExitOnFailure(hr, "Failed to extract container for payload: %ls", pPayload->sczKey); 956 ExitOnFailure(hr, "Failed to extract container for payload: %ls", pPayload->sczKey);
935 } 957 }