diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2022-05-26 17:34:48 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2022-05-31 13:20:44 -0500 |
| commit | 90982fbf1c887a3ed3454f9ab3ab8dfbd57a1383 (patch) | |
| tree | 7d87b21f0879de446f5db7053d349f32b4882cbe /src/burn/engine/cache.cpp | |
| parent | a070d8c7b57d6c9a54106abeb359a6c868b6d7ae (diff) | |
| download | wix-90982fbf1c887a3ed3454f9ab3ab8dfbd57a1383.tar.gz wix-90982fbf1c887a3ed3454f9ab3ab8dfbd57a1383.tar.bz2 wix-90982fbf1c887a3ed3454f9ab3ab8dfbd57a1383.zip | |
Add PathConcatRelativeToBase and use it in Burn.
Fixes 6707
Diffstat (limited to 'src/burn/engine/cache.cpp')
| -rw-r--r-- | src/burn/engine/cache.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/burn/engine/cache.cpp b/src/burn/engine/cache.cpp index 2b7d6ede..04b2f0ca 100644 --- a/src/burn/engine/cache.cpp +++ b/src/burn/engine/cache.cpp | |||
| @@ -251,7 +251,7 @@ extern "C" HRESULT CacheInitializeSources( | |||
| 251 | hr = CacheGetCompletedPath(pCache, pRegistration->fPerMachine, pRegistration->sczId, &sczCompletedFolder); | 251 | hr = CacheGetCompletedPath(pCache, pRegistration->fPerMachine, pRegistration->sczId, &sczCompletedFolder); |
| 252 | ExitOnFailure(hr, "Failed to get completed path for bundle."); | 252 | ExitOnFailure(hr, "Failed to get completed path for bundle."); |
| 253 | 253 | ||
| 254 | hr = PathConcat(sczCompletedFolder, pRegistration->sczExecutableName, &sczCompletedPath); | 254 | hr = PathConcatRelativeToBase(sczCompletedFolder, pRegistration->sczExecutableName, &sczCompletedPath); |
| 255 | ExitOnFailure(hr, "Failed to combine working path with engine file name."); | 255 | ExitOnFailure(hr, "Failed to combine working path with engine file name."); |
| 256 | 256 | ||
| 257 | hr = PathCompare(sczCurrentPath, sczCompletedPath, &nCompare); | 257 | hr = PathCompare(sczCurrentPath, sczCompletedPath, &nCompare); |
| @@ -390,7 +390,7 @@ extern "C" HRESULT CacheCalculateBundleLayoutWorkingPath( | |||
| 390 | 390 | ||
| 391 | HRESULT hr = S_OK; | 391 | HRESULT hr = S_OK; |
| 392 | 392 | ||
| 393 | hr = PathConcat(pCache->sczAcquisitionFolder, wzBundleId, psczWorkingPath); | 393 | hr = PathConcatRelativeToBase(pCache->sczAcquisitionFolder, wzBundleId, psczWorkingPath); |
| 394 | ExitOnFailure(hr, "Failed to append bundle id for bundle layout working path."); | 394 | ExitOnFailure(hr, "Failed to append bundle id for bundle layout working path."); |
| 395 | 395 | ||
| 396 | LExit: | 396 | LExit: |
| @@ -407,7 +407,7 @@ extern "C" HRESULT CacheCalculatePayloadWorkingPath( | |||
| 407 | 407 | ||
| 408 | HRESULT hr = S_OK; | 408 | HRESULT hr = S_OK; |
| 409 | 409 | ||
| 410 | hr = PathConcat(pCache->sczAcquisitionFolder, pPayload->sczKey, psczWorkingPath); | 410 | hr = PathConcatRelativeToBase(pCache->sczAcquisitionFolder, pPayload->sczKey, psczWorkingPath); |
| 411 | ExitOnFailure(hr, "Failed to append Id as payload unverified path."); | 411 | ExitOnFailure(hr, "Failed to append Id as payload unverified path."); |
| 412 | 412 | ||
| 413 | LExit: | 413 | LExit: |
| @@ -424,7 +424,7 @@ extern "C" HRESULT CacheCalculateContainerWorkingPath( | |||
| 424 | 424 | ||
| 425 | HRESULT hr = S_OK; | 425 | HRESULT hr = S_OK; |
| 426 | 426 | ||
| 427 | hr = PathConcat(pCache->sczAcquisitionFolder, pContainer->sczHash, psczWorkingPath); | 427 | hr = PathConcatRelativeToBase(pCache->sczAcquisitionFolder, pContainer->sczHash, psczWorkingPath); |
| 428 | ExitOnFailure(hr, "Failed to append hash as container unverified path."); | 428 | ExitOnFailure(hr, "Failed to append hash as container unverified path."); |
| 429 | 429 | ||
| 430 | LExit: | 430 | LExit: |
| @@ -479,7 +479,7 @@ extern "C" HRESULT CacheGetCompletedPath( | |||
| 479 | // GetRootPath returns S_FALSE if the package cache is redirected elsewhere. | 479 | // GetRootPath returns S_FALSE if the package cache is redirected elsewhere. |
| 480 | fRedirected = S_FALSE == hr; | 480 | fRedirected = S_FALSE == hr; |
| 481 | 481 | ||
| 482 | hr = PathConcat(sczRootPath, wzCacheId, &sczCurrentCompletedPath); | 482 | hr = PathConcatRelativeToBase(sczRootPath, wzCacheId, &sczCurrentCompletedPath); |
| 483 | ExitOnFailure(hr, "Failed to construct cache path."); | 483 | ExitOnFailure(hr, "Failed to construct cache path."); |
| 484 | 484 | ||
| 485 | hr = PathBackslashTerminate(&sczCurrentCompletedPath); | 485 | hr = PathBackslashTerminate(&sczCurrentCompletedPath); |
| @@ -492,7 +492,7 @@ extern "C" HRESULT CacheGetCompletedPath( | |||
| 492 | hr = GetRootPath(pCache, fPerMachine, FALSE, &sczRootPath); | 492 | hr = GetRootPath(pCache, fPerMachine, FALSE, &sczRootPath); |
| 493 | ExitOnFailure(hr, "Failed to get old %hs package cache root directory.", fPerMachine ? "per-machine" : "per-user"); | 493 | ExitOnFailure(hr, "Failed to get old %hs package cache root directory.", fPerMachine ? "per-machine" : "per-user"); |
| 494 | 494 | ||
| 495 | hr = PathConcat(sczRootPath, wzCacheId, &sczDefaultCompletedPath); | 495 | hr = PathConcatRelativeToBase(sczRootPath, wzCacheId, &sczDefaultCompletedPath); |
| 496 | ExitOnFailure(hr, "Failed to construct cache path."); | 496 | ExitOnFailure(hr, "Failed to construct cache path."); |
| 497 | 497 | ||
| 498 | hr = PathBackslashTerminate(&sczDefaultCompletedPath); | 498 | hr = PathBackslashTerminate(&sczDefaultCompletedPath); |
| @@ -933,7 +933,7 @@ extern "C" HRESULT CacheLayoutBundle( | |||
| 933 | HRESULT hr = S_OK; | 933 | HRESULT hr = S_OK; |
| 934 | LPWSTR sczTargetPath = NULL; | 934 | LPWSTR sczTargetPath = NULL; |
| 935 | 935 | ||
| 936 | hr = PathConcat(wzLayoutDirectory, wzExecutableName, &sczTargetPath); | 936 | hr = PathConcatRelativeToBase(wzLayoutDirectory, wzExecutableName, &sczTargetPath); |
| 937 | ExitOnFailure(hr, "Failed to combine completed path with engine file name for layout."); | 937 | ExitOnFailure(hr, "Failed to combine completed path with engine file name for layout."); |
| 938 | 938 | ||
| 939 | LogStringLine(REPORT_STANDARD, "Layout bundle from: '%ls' to: '%ls'", wzSourceBundlePath, sczTargetPath); | 939 | LogStringLine(REPORT_STANDARD, "Layout bundle from: '%ls' to: '%ls'", wzSourceBundlePath, sczTargetPath); |
| @@ -968,7 +968,7 @@ extern "C" HRESULT CacheCompleteBundle( | |||
| 968 | hr = CreateCompletedPath(pCache, fPerMachine, wzBundleId, NULL, &sczTargetDirectory); | 968 | hr = CreateCompletedPath(pCache, fPerMachine, wzBundleId, NULL, &sczTargetDirectory); |
| 969 | ExitOnFailure(hr, "Failed to create completed cache path for bundle."); | 969 | ExitOnFailure(hr, "Failed to create completed cache path for bundle."); |
| 970 | 970 | ||
| 971 | hr = PathConcat(sczTargetDirectory, wzExecutableName, &sczTargetPath); | 971 | hr = PathConcatRelativeToBase(sczTargetDirectory, wzExecutableName, &sczTargetPath); |
| 972 | ExitOnFailure(hr, "Failed to combine completed path with engine file name."); | 972 | ExitOnFailure(hr, "Failed to combine completed path with engine file name."); |
| 973 | 973 | ||
| 974 | // We can't just use wzExecutablePath because we needed to call CreateCompletedPath to ensure that the destination was secured. | 974 | // We can't just use wzExecutablePath because we needed to call CreateCompletedPath to ensure that the destination was secured. |
| @@ -1021,7 +1021,7 @@ extern "C" HRESULT CacheLayoutContainer( | |||
| 1021 | HRESULT hr = S_OK; | 1021 | HRESULT hr = S_OK; |
| 1022 | LPWSTR sczCachedPath = NULL; | 1022 | LPWSTR sczCachedPath = NULL; |
| 1023 | 1023 | ||
| 1024 | hr = PathConcat(wzLayoutDirectory, pContainer->sczFilePath, &sczCachedPath); | 1024 | hr = PathConcatRelativeToBase(wzLayoutDirectory, pContainer->sczFilePath, &sczCachedPath); |
| 1025 | ExitOnFailure(hr, "Failed to concat complete cached path."); | 1025 | ExitOnFailure(hr, "Failed to concat complete cached path."); |
| 1026 | 1026 | ||
| 1027 | hr = VerifyThenTransferContainer(pContainer, sczCachedPath, wzUnverifiedContainerPath, fMove, pfnCacheMessageHandler, pfnProgress, pContext); | 1027 | hr = VerifyThenTransferContainer(pContainer, sczCachedPath, wzUnverifiedContainerPath, fMove, pfnCacheMessageHandler, pfnProgress, pContext); |
| @@ -1046,7 +1046,7 @@ extern "C" HRESULT CacheLayoutPayload( | |||
| 1046 | HRESULT hr = S_OK; | 1046 | HRESULT hr = S_OK; |
| 1047 | LPWSTR sczCachedPath = NULL; | 1047 | LPWSTR sczCachedPath = NULL; |
| 1048 | 1048 | ||
| 1049 | hr = PathConcat(wzLayoutDirectory, pPayload->sczFilePath, &sczCachedPath); | 1049 | hr = PathConcatRelativeToBase(wzLayoutDirectory, pPayload->sczFilePath, &sczCachedPath); |
| 1050 | ExitOnFailure(hr, "Failed to concat complete cached path."); | 1050 | ExitOnFailure(hr, "Failed to concat complete cached path."); |
| 1051 | 1051 | ||
| 1052 | hr = VerifyThenTransferPayload(pPayload, sczCachedPath, wzUnverifiedPayloadPath, fMove, pfnCacheMessageHandler, pfnProgress, pContext); | 1052 | hr = VerifyThenTransferPayload(pPayload, sczCachedPath, wzUnverifiedPayloadPath, fMove, pfnCacheMessageHandler, pfnProgress, pContext); |
| @@ -1141,7 +1141,7 @@ extern "C" HRESULT CacheVerifyContainer( | |||
| 1141 | HRESULT hr = S_OK; | 1141 | HRESULT hr = S_OK; |
| 1142 | LPWSTR sczCachedPath = NULL; | 1142 | LPWSTR sczCachedPath = NULL; |
| 1143 | 1143 | ||
| 1144 | hr = PathConcat(wzCachedDirectory, pContainer->sczFilePath, &sczCachedPath); | 1144 | hr = PathConcatRelativeToBase(wzCachedDirectory, pContainer->sczFilePath, &sczCachedPath); |
| 1145 | ExitOnFailure(hr, "Failed to concat complete cached path."); | 1145 | ExitOnFailure(hr, "Failed to concat complete cached path."); |
| 1146 | 1146 | ||
| 1147 | hr = VerifyFileAgainstContainer(pContainer, sczCachedPath, TRUE, BURN_CACHE_STEP_HASH_TO_SKIP_ACQUIRE, pfnCacheMessageHandler, pfnProgress, pContext); | 1147 | hr = VerifyFileAgainstContainer(pContainer, sczCachedPath, TRUE, BURN_CACHE_STEP_HASH_TO_SKIP_ACQUIRE, pfnCacheMessageHandler, pfnProgress, pContext); |
| @@ -1163,7 +1163,7 @@ extern "C" HRESULT CacheVerifyPayload( | |||
| 1163 | HRESULT hr = S_OK; | 1163 | HRESULT hr = S_OK; |
| 1164 | LPWSTR sczCachedPath = NULL; | 1164 | LPWSTR sczCachedPath = NULL; |
| 1165 | 1165 | ||
| 1166 | hr = PathConcat(wzCachedDirectory, pPayload->sczFilePath, &sczCachedPath); | 1166 | hr = PathConcatRelativeToBase(wzCachedDirectory, pPayload->sczFilePath, &sczCachedPath); |
| 1167 | ExitOnFailure(hr, "Failed to concat complete cached path."); | 1167 | ExitOnFailure(hr, "Failed to concat complete cached path."); |
| 1168 | 1168 | ||
| 1169 | hr = VerifyFileAgainstPayload(pPayload, sczCachedPath, TRUE, BURN_CACHE_STEP_HASH_TO_SKIP_ACQUIRE, pfnCacheMessageHandler, pfnProgress, pContext); | 1169 | hr = VerifyFileAgainstPayload(pPayload, sczCachedPath, TRUE, BURN_CACHE_STEP_HASH_TO_SKIP_ACQUIRE, pfnCacheMessageHandler, pfnProgress, pContext); |
| @@ -1596,7 +1596,7 @@ static HRESULT CreateCompletedPath( | |||
| 1596 | else | 1596 | else |
| 1597 | { | 1597 | { |
| 1598 | // Get the cache completed file path. | 1598 | // Get the cache completed file path. |
| 1599 | hr = PathConcat(sczCacheDirectory, wzFilePath, &sczCacheFile); | 1599 | hr = PathConcatRelativeToBase(sczCacheDirectory, wzFilePath, &sczCacheFile); |
| 1600 | ExitOnFailure(hr, "Failed to construct cache file."); | 1600 | ExitOnFailure(hr, "Failed to construct cache file."); |
| 1601 | 1601 | ||
| 1602 | // Don't reset permissions here. The payload's package must reset its cache folder when it starts caching. | 1602 | // Don't reset permissions here. The payload's package must reset its cache folder when it starts caching. |
| @@ -1634,7 +1634,7 @@ static HRESULT CreateUnverifiedPath( | |||
| 1634 | pCache->fUnverifiedCacheFolderCreated = TRUE; | 1634 | pCache->fUnverifiedCacheFolderCreated = TRUE; |
| 1635 | } | 1635 | } |
| 1636 | 1636 | ||
| 1637 | hr = PathConcat(sczUnverifiedCacheFolder, wzPayloadId, psczUnverifiedPayloadPath); | 1637 | hr = PathConcatRelativeToBase(sczUnverifiedCacheFolder, wzPayloadId, psczUnverifiedPayloadPath); |
| 1638 | ExitOnFailure(hr, "Failed to concat payload id to unverified folder path."); | 1638 | ExitOnFailure(hr, "Failed to concat payload id to unverified folder path."); |
| 1639 | 1639 | ||
| 1640 | LExit: | 1640 | LExit: |
| @@ -2055,13 +2055,13 @@ static HRESULT CopyEngineToWorkingFolder( | |||
| 2055 | hr = CacheEnsureBaseWorkingFolder(pCache, &sczWorkingFolder); | 2055 | hr = CacheEnsureBaseWorkingFolder(pCache, &sczWorkingFolder); |
| 2056 | ExitOnFailure(hr, "Failed to create working path to copy engine."); | 2056 | ExitOnFailure(hr, "Failed to create working path to copy engine."); |
| 2057 | 2057 | ||
| 2058 | hr = PathConcat(sczWorkingFolder, wzWorkingFolderName, &sczTargetDirectory); | 2058 | hr = PathConcatRelativeToBase(sczWorkingFolder, wzWorkingFolderName, &sczTargetDirectory); |
| 2059 | ExitOnFailure(hr, "Failed to calculate the bundle working folder target name."); | 2059 | ExitOnFailure(hr, "Failed to calculate the bundle working folder target name."); |
| 2060 | 2060 | ||
| 2061 | hr = DirEnsureExists(sczTargetDirectory, NULL); | 2061 | hr = DirEnsureExists(sczTargetDirectory, NULL); |
| 2062 | ExitOnFailure(hr, "Failed create bundle working folder."); | 2062 | ExitOnFailure(hr, "Failed create bundle working folder."); |
| 2063 | 2063 | ||
| 2064 | hr = PathConcat(sczTargetDirectory, wzExecutableName, &sczTargetPath); | 2064 | hr = PathConcatRelativeToBase(sczTargetDirectory, wzExecutableName, &sczTargetPath); |
| 2065 | ExitOnFailure(hr, "Failed to combine working path with engine file name."); | 2065 | ExitOnFailure(hr, "Failed to combine working path with engine file name."); |
| 2066 | 2066 | ||
| 2067 | // Copy the engine without any attached containers to the working path. | 2067 | // Copy the engine without any attached containers to the working path. |
