diff options
Diffstat (limited to '')
| -rw-r--r-- | src/burn/engine/apply.cpp | 2 | ||||
| -rw-r--r-- | src/burn/engine/bundlepackageengine.cpp | 2 | ||||
| -rw-r--r-- | src/burn/engine/cache.cpp | 56 | ||||
| -rw-r--r-- | src/burn/engine/core.cpp | 2 | ||||
| -rw-r--r-- | src/burn/engine/engine.mc | 7 | ||||
| -rw-r--r-- | src/burn/engine/exeengine.cpp | 2 | ||||
| -rw-r--r-- | src/burn/engine/msiengine.cpp | 4 | ||||
| -rw-r--r-- | src/burn/engine/mspengine.cpp | 2 | ||||
| -rw-r--r-- | src/burn/engine/msuengine.cpp | 2 | ||||
| -rw-r--r-- | src/burn/engine/payload.cpp | 2 | ||||
| -rw-r--r-- | src/burn/engine/plan.cpp | 11 | ||||
| -rw-r--r-- | src/burn/engine/registration.cpp | 6 | ||||
| -rw-r--r-- | src/libs/dutil/WixToolset.DUtil/inc/pathutil.h | 10 | ||||
| -rw-r--r-- | src/libs/dutil/WixToolset.DUtil/path2utl.cpp | 19 |
14 files changed, 87 insertions, 40 deletions
diff --git a/src/burn/engine/apply.cpp b/src/burn/engine/apply.cpp index 4ebed191..048cd98b 100644 --- a/src/burn/engine/apply.cpp +++ b/src/burn/engine/apply.cpp | |||
| @@ -1371,7 +1371,7 @@ static HRESULT LayoutBundle( | |||
| 1371 | ExitOnFailure(hr, "Failed to get path to bundle to layout."); | 1371 | ExitOnFailure(hr, "Failed to get path to bundle to layout."); |
| 1372 | } | 1372 | } |
| 1373 | 1373 | ||
| 1374 | hr = PathConcatRelativeToBase(pContext->wzLayoutDirectory, wzExecutableName, &sczDestinationPath); | 1374 | hr = PathConcatRelativeToFullyQualifiedBase(pContext->wzLayoutDirectory, wzExecutableName, &sczDestinationPath); |
| 1375 | ExitOnFailure(hr, "Failed to concat layout path for bundle."); | 1375 | ExitOnFailure(hr, "Failed to concat layout path for bundle."); |
| 1376 | 1376 | ||
| 1377 | // If the destination path is the currently running bundle, bail. | 1377 | // If the destination path is the currently running bundle, bail. |
diff --git a/src/burn/engine/bundlepackageengine.cpp b/src/burn/engine/bundlepackageengine.cpp index 8ba8e0d2..6a0343bd 100644 --- a/src/burn/engine/bundlepackageengine.cpp +++ b/src/burn/engine/bundlepackageengine.cpp | |||
| @@ -780,7 +780,7 @@ static HRESULT ExecuteBundle( | |||
| 780 | hr = CacheGetCompletedPath(pCache, pPackage->fPerMachine, pPackage->sczCacheId, &sczCachedDirectory); | 780 | hr = CacheGetCompletedPath(pCache, pPackage->fPerMachine, pPackage->sczCacheId, &sczCachedDirectory); |
| 781 | ExitOnFailure(hr, "Failed to get cached path for package: %ls", pPackage->sczId); | 781 | ExitOnFailure(hr, "Failed to get cached path for package: %ls", pPackage->sczId); |
| 782 | 782 | ||
| 783 | hr = PathConcatRelativeToBase(sczCachedDirectory, pPackagePayload->sczFilePath, &sczExecutablePath); | 783 | hr = PathConcatRelativeToFullyQualifiedBase(sczCachedDirectory, pPackagePayload->sczFilePath, &sczExecutablePath); |
| 784 | ExitOnFailure(hr, "Failed to build executable path."); | 784 | ExitOnFailure(hr, "Failed to build executable path."); |
| 785 | } | 785 | } |
| 786 | 786 | ||
diff --git a/src/burn/engine/cache.cpp b/src/burn/engine/cache.cpp index 5eacb20d..cf9de1c3 100644 --- a/src/burn/engine/cache.cpp +++ b/src/burn/engine/cache.cpp | |||
| @@ -188,13 +188,18 @@ extern "C" HRESULT CacheInitialize( | |||
| 188 | hr = PolcReadString(POLICY_BURN_REGISTRY_PATH, L"PackageCache", NULL, &pCache->sczCurrentMachinePackageCache); | 188 | hr = PolcReadString(POLICY_BURN_REGISTRY_PATH, L"PackageCache", NULL, &pCache->sczCurrentMachinePackageCache); |
| 189 | ExitOnFailure(hr, "Failed to read PackageCache policy directory."); | 189 | ExitOnFailure(hr, "Failed to read PackageCache policy directory."); |
| 190 | 190 | ||
| 191 | if (pCache->sczCurrentMachinePackageCache) | 191 | if (pCache->sczCurrentMachinePackageCache && PathIsFullyQualified(pCache->sczCurrentMachinePackageCache)) |
| 192 | { | 192 | { |
| 193 | hr = PathBackslashTerminate(&pCache->sczCurrentMachinePackageCache); | 193 | hr = PathBackslashTerminate(&pCache->sczCurrentMachinePackageCache); |
| 194 | ExitOnFailure(hr, "Failed to backslash terminate redirected per-machine package cache directory name."); | 194 | ExitOnFailure(hr, "Failed to backslash terminate redirected per-machine package cache directory name."); |
| 195 | } | 195 | } |
| 196 | else | 196 | else |
| 197 | { | 197 | { |
| 198 | if (pCache->sczCurrentMachinePackageCache) | ||
| 199 | { | ||
| 200 | LogErrorId(E_INVALIDARG, MSG_INVALID_POLICY_MACHINE_PACKAGE_CACHE, pCache->sczCurrentMachinePackageCache, NULL, NULL); | ||
| 201 | } | ||
| 202 | |||
| 198 | hr = StrAllocString(&pCache->sczCurrentMachinePackageCache, pCache->sczDefaultMachinePackageCache, 0); | 203 | hr = StrAllocString(&pCache->sczCurrentMachinePackageCache, pCache->sczDefaultMachinePackageCache, 0); |
| 199 | ExitOnFailure(hr, "Failed to copy default package cache directory to current package cache directory."); | 204 | ExitOnFailure(hr, "Failed to copy default package cache directory to current package cache directory."); |
| 200 | } | 205 | } |
| @@ -251,7 +256,7 @@ extern "C" HRESULT CacheInitializeSources( | |||
| 251 | hr = CacheGetCompletedPath(pCache, pRegistration->fPerMachine, pRegistration->sczId, &sczCompletedFolder); | 256 | hr = CacheGetCompletedPath(pCache, pRegistration->fPerMachine, pRegistration->sczId, &sczCompletedFolder); |
| 252 | ExitOnFailure(hr, "Failed to get completed path for bundle."); | 257 | ExitOnFailure(hr, "Failed to get completed path for bundle."); |
| 253 | 258 | ||
| 254 | hr = PathConcatRelativeToBase(sczCompletedFolder, pRegistration->sczExecutableName, &sczCompletedPath); | 259 | hr = PathConcatRelativeToFullyQualifiedBase(sczCompletedFolder, pRegistration->sczExecutableName, &sczCompletedPath); |
| 255 | ExitOnFailure(hr, "Failed to combine working path with engine file name."); | 260 | ExitOnFailure(hr, "Failed to combine working path with engine file name."); |
| 256 | 261 | ||
| 257 | hr = PathCompareCanonicalized(sczCurrentPath, sczCompletedPath, &fPathEqual); | 262 | hr = PathCompareCanonicalized(sczCurrentPath, sczCompletedPath, &fPathEqual); |
| @@ -342,15 +347,16 @@ extern "C" HRESULT CacheEnsureBaseWorkingFolder( | |||
| 342 | { | 347 | { |
| 343 | for (DWORD i = 0; i < pCache->cPotentialBaseWorkingFolders; ++i) | 348 | for (DWORD i = 0; i < pCache->cPotentialBaseWorkingFolders; ++i) |
| 344 | { | 349 | { |
| 345 | hr = PathConcatRelativeToBase(pCache->rgsczPotentialBaseWorkingFolders[i], pCache->wzGuid, &sczPotential); | 350 | hr = PathConcatRelativeToFullyQualifiedBase(pCache->rgsczPotentialBaseWorkingFolders[i], pCache->wzGuid, &sczPotential); |
| 346 | ExitOnFailure(hr, "Failed to append random guid on to potential path for working folder."); | ||
| 347 | |||
| 348 | hr = DirEnsureExists(sczPotential, NULL); | ||
| 349 | if (SUCCEEDED(hr)) | 351 | if (SUCCEEDED(hr)) |
| 350 | { | 352 | { |
| 351 | pCache->sczBaseWorkingFolder = sczPotential; | 353 | hr = DirEnsureExists(sczPotential, NULL); |
| 352 | sczPotential = NULL; | 354 | if (SUCCEEDED(hr)) |
| 353 | break; | 355 | { |
| 356 | pCache->sczBaseWorkingFolder = sczPotential; | ||
| 357 | sczPotential = NULL; | ||
| 358 | break; | ||
| 359 | } | ||
| 354 | } | 360 | } |
| 355 | 361 | ||
| 356 | LogErrorId(hr, MSG_INVALID_BASE_WORKING_FOLDER, sczPotential, NULL, NULL); | 362 | LogErrorId(hr, MSG_INVALID_BASE_WORKING_FOLDER, sczPotential, NULL, NULL); |
| @@ -414,7 +420,7 @@ extern "C" HRESULT CacheCalculateBundleLayoutWorkingPath( | |||
| 414 | 420 | ||
| 415 | HRESULT hr = S_OK; | 421 | HRESULT hr = S_OK; |
| 416 | 422 | ||
| 417 | hr = PathConcatRelativeToBase(pCache->sczAcquisitionFolder, wzBundleId, psczWorkingPath); | 423 | hr = PathConcatRelativeToFullyQualifiedBase(pCache->sczAcquisitionFolder, wzBundleId, psczWorkingPath); |
| 418 | ExitOnFailure(hr, "Failed to append bundle id for bundle layout working path."); | 424 | ExitOnFailure(hr, "Failed to append bundle id for bundle layout working path."); |
| 419 | 425 | ||
| 420 | LExit: | 426 | LExit: |
| @@ -431,7 +437,7 @@ extern "C" HRESULT CacheCalculatePayloadWorkingPath( | |||
| 431 | 437 | ||
| 432 | HRESULT hr = S_OK; | 438 | HRESULT hr = S_OK; |
| 433 | 439 | ||
| 434 | hr = PathConcatRelativeToBase(pCache->sczAcquisitionFolder, pPayload->sczKey, psczWorkingPath); | 440 | hr = PathConcatRelativeToFullyQualifiedBase(pCache->sczAcquisitionFolder, pPayload->sczKey, psczWorkingPath); |
| 435 | ExitOnFailure(hr, "Failed to append Id as payload unverified path."); | 441 | ExitOnFailure(hr, "Failed to append Id as payload unverified path."); |
| 436 | 442 | ||
| 437 | LExit: | 443 | LExit: |
| @@ -448,7 +454,7 @@ extern "C" HRESULT CacheCalculateContainerWorkingPath( | |||
| 448 | 454 | ||
| 449 | HRESULT hr = S_OK; | 455 | HRESULT hr = S_OK; |
| 450 | 456 | ||
| 451 | hr = PathConcatRelativeToBase(pCache->sczAcquisitionFolder, pContainer->sczHash, psczWorkingPath); | 457 | hr = PathConcatRelativeToFullyQualifiedBase(pCache->sczAcquisitionFolder, pContainer->sczHash, psczWorkingPath); |
| 452 | ExitOnFailure(hr, "Failed to append hash as container unverified path."); | 458 | ExitOnFailure(hr, "Failed to append hash as container unverified path."); |
| 453 | 459 | ||
| 454 | LExit: | 460 | LExit: |
| @@ -503,7 +509,7 @@ extern "C" HRESULT CacheGetCompletedPath( | |||
| 503 | // GetRootPath returns S_FALSE if the package cache is redirected elsewhere. | 509 | // GetRootPath returns S_FALSE if the package cache is redirected elsewhere. |
| 504 | fRedirected = S_FALSE == hr; | 510 | fRedirected = S_FALSE == hr; |
| 505 | 511 | ||
| 506 | hr = PathConcatRelativeToBase(sczRootPath, wzCacheId, &sczCurrentCompletedPath); | 512 | hr = PathConcatRelativeToFullyQualifiedBase(sczRootPath, wzCacheId, &sczCurrentCompletedPath); |
| 507 | ExitOnFailure(hr, "Failed to construct cache path."); | 513 | ExitOnFailure(hr, "Failed to construct cache path."); |
| 508 | 514 | ||
| 509 | hr = PathBackslashTerminate(&sczCurrentCompletedPath); | 515 | hr = PathBackslashTerminate(&sczCurrentCompletedPath); |
| @@ -516,7 +522,7 @@ extern "C" HRESULT CacheGetCompletedPath( | |||
| 516 | hr = GetRootPath(pCache, fPerMachine, FALSE, &sczRootPath); | 522 | hr = GetRootPath(pCache, fPerMachine, FALSE, &sczRootPath); |
| 517 | ExitOnFailure(hr, "Failed to get old %hs package cache root directory.", fPerMachine ? "per-machine" : "per-user"); | 523 | ExitOnFailure(hr, "Failed to get old %hs package cache root directory.", fPerMachine ? "per-machine" : "per-user"); |
| 518 | 524 | ||
| 519 | hr = PathConcatRelativeToBase(sczRootPath, wzCacheId, &sczDefaultCompletedPath); | 525 | hr = PathConcatRelativeToFullyQualifiedBase(sczRootPath, wzCacheId, &sczDefaultCompletedPath); |
| 520 | ExitOnFailure(hr, "Failed to construct cache path."); | 526 | ExitOnFailure(hr, "Failed to construct cache path."); |
| 521 | 527 | ||
| 522 | hr = PathBackslashTerminate(&sczDefaultCompletedPath); | 528 | hr = PathBackslashTerminate(&sczDefaultCompletedPath); |
| @@ -957,7 +963,7 @@ extern "C" HRESULT CacheLayoutBundle( | |||
| 957 | HRESULT hr = S_OK; | 963 | HRESULT hr = S_OK; |
| 958 | LPWSTR sczTargetPath = NULL; | 964 | LPWSTR sczTargetPath = NULL; |
| 959 | 965 | ||
| 960 | hr = PathConcatRelativeToBase(wzLayoutDirectory, wzExecutableName, &sczTargetPath); | 966 | hr = PathConcatRelativeToFullyQualifiedBase(wzLayoutDirectory, wzExecutableName, &sczTargetPath); |
| 961 | ExitOnFailure(hr, "Failed to combine completed path with engine file name for layout."); | 967 | ExitOnFailure(hr, "Failed to combine completed path with engine file name for layout."); |
| 962 | 968 | ||
| 963 | LogStringLine(REPORT_STANDARD, "Layout bundle from: '%ls' to: '%ls'", wzSourceBundlePath, sczTargetPath); | 969 | LogStringLine(REPORT_STANDARD, "Layout bundle from: '%ls' to: '%ls'", wzSourceBundlePath, sczTargetPath); |
| @@ -992,7 +998,7 @@ extern "C" HRESULT CacheCompleteBundle( | |||
| 992 | hr = CreateCompletedPath(pCache, fPerMachine, wzBundleId, NULL, &sczTargetDirectory); | 998 | hr = CreateCompletedPath(pCache, fPerMachine, wzBundleId, NULL, &sczTargetDirectory); |
| 993 | ExitOnFailure(hr, "Failed to create completed cache path for bundle."); | 999 | ExitOnFailure(hr, "Failed to create completed cache path for bundle."); |
| 994 | 1000 | ||
| 995 | hr = PathConcatRelativeToBase(sczTargetDirectory, wzExecutableName, &sczTargetPath); | 1001 | hr = PathConcatRelativeToFullyQualifiedBase(sczTargetDirectory, wzExecutableName, &sczTargetPath); |
| 996 | ExitOnFailure(hr, "Failed to combine completed path with engine file name."); | 1002 | ExitOnFailure(hr, "Failed to combine completed path with engine file name."); |
| 997 | 1003 | ||
| 998 | // We can't just use wzExecutablePath because we needed to call CreateCompletedPath to ensure that the destination was secured. | 1004 | // We can't just use wzExecutablePath because we needed to call CreateCompletedPath to ensure that the destination was secured. |
| @@ -1045,7 +1051,7 @@ extern "C" HRESULT CacheLayoutContainer( | |||
| 1045 | HRESULT hr = S_OK; | 1051 | HRESULT hr = S_OK; |
| 1046 | LPWSTR sczCachedPath = NULL; | 1052 | LPWSTR sczCachedPath = NULL; |
| 1047 | 1053 | ||
| 1048 | hr = PathConcatRelativeToBase(wzLayoutDirectory, pContainer->sczFilePath, &sczCachedPath); | 1054 | hr = PathConcatRelativeToFullyQualifiedBase(wzLayoutDirectory, pContainer->sczFilePath, &sczCachedPath); |
| 1049 | ExitOnFailure(hr, "Failed to concat complete cached path."); | 1055 | ExitOnFailure(hr, "Failed to concat complete cached path."); |
| 1050 | 1056 | ||
| 1051 | hr = VerifyThenTransferContainer(pContainer, sczCachedPath, wzUnverifiedContainerPath, fMove, pfnCacheMessageHandler, pfnProgress, pContext); | 1057 | hr = VerifyThenTransferContainer(pContainer, sczCachedPath, wzUnverifiedContainerPath, fMove, pfnCacheMessageHandler, pfnProgress, pContext); |
| @@ -1070,7 +1076,7 @@ extern "C" HRESULT CacheLayoutPayload( | |||
| 1070 | HRESULT hr = S_OK; | 1076 | HRESULT hr = S_OK; |
| 1071 | LPWSTR sczCachedPath = NULL; | 1077 | LPWSTR sczCachedPath = NULL; |
| 1072 | 1078 | ||
| 1073 | hr = PathConcatRelativeToBase(wzLayoutDirectory, pPayload->sczFilePath, &sczCachedPath); | 1079 | hr = PathConcatRelativeToFullyQualifiedBase(wzLayoutDirectory, pPayload->sczFilePath, &sczCachedPath); |
| 1074 | ExitOnFailure(hr, "Failed to concat complete cached path."); | 1080 | ExitOnFailure(hr, "Failed to concat complete cached path."); |
| 1075 | 1081 | ||
| 1076 | hr = VerifyThenTransferPayload(pPayload, sczCachedPath, wzUnverifiedPayloadPath, fMove, pfnCacheMessageHandler, pfnProgress, pContext); | 1082 | hr = VerifyThenTransferPayload(pPayload, sczCachedPath, wzUnverifiedPayloadPath, fMove, pfnCacheMessageHandler, pfnProgress, pContext); |
| @@ -1165,7 +1171,7 @@ extern "C" HRESULT CacheVerifyContainer( | |||
| 1165 | HRESULT hr = S_OK; | 1171 | HRESULT hr = S_OK; |
| 1166 | LPWSTR sczCachedPath = NULL; | 1172 | LPWSTR sczCachedPath = NULL; |
| 1167 | 1173 | ||
| 1168 | hr = PathConcatRelativeToBase(wzCachedDirectory, pContainer->sczFilePath, &sczCachedPath); | 1174 | hr = PathConcatRelativeToFullyQualifiedBase(wzCachedDirectory, pContainer->sczFilePath, &sczCachedPath); |
| 1169 | ExitOnFailure(hr, "Failed to concat complete cached path."); | 1175 | ExitOnFailure(hr, "Failed to concat complete cached path."); |
| 1170 | 1176 | ||
| 1171 | hr = VerifyFileAgainstContainer(pContainer, sczCachedPath, TRUE, BURN_CACHE_STEP_HASH_TO_SKIP_ACQUIRE, pfnCacheMessageHandler, pfnProgress, pContext); | 1177 | hr = VerifyFileAgainstContainer(pContainer, sczCachedPath, TRUE, BURN_CACHE_STEP_HASH_TO_SKIP_ACQUIRE, pfnCacheMessageHandler, pfnProgress, pContext); |
| @@ -1187,7 +1193,7 @@ extern "C" HRESULT CacheVerifyPayload( | |||
| 1187 | HRESULT hr = S_OK; | 1193 | HRESULT hr = S_OK; |
| 1188 | LPWSTR sczCachedPath = NULL; | 1194 | LPWSTR sczCachedPath = NULL; |
| 1189 | 1195 | ||
| 1190 | hr = PathConcatRelativeToBase(wzCachedDirectory, pPayload->sczFilePath, &sczCachedPath); | 1196 | hr = PathConcatRelativeToFullyQualifiedBase(wzCachedDirectory, pPayload->sczFilePath, &sczCachedPath); |
| 1191 | ExitOnFailure(hr, "Failed to concat complete cached path."); | 1197 | ExitOnFailure(hr, "Failed to concat complete cached path."); |
| 1192 | 1198 | ||
| 1193 | hr = VerifyFileAgainstPayload(pPayload, sczCachedPath, TRUE, BURN_CACHE_STEP_HASH_TO_SKIP_ACQUIRE, pfnCacheMessageHandler, pfnProgress, pContext); | 1199 | hr = VerifyFileAgainstPayload(pPayload, sczCachedPath, TRUE, BURN_CACHE_STEP_HASH_TO_SKIP_ACQUIRE, pfnCacheMessageHandler, pfnProgress, pContext); |
| @@ -1478,7 +1484,7 @@ static HRESULT CalculateWorkingFolders( | |||
| 1478 | pCache->wzGuid[GUID_STRING_LENGTH - 1] = L'\\'; | 1484 | pCache->wzGuid[GUID_STRING_LENGTH - 1] = L'\\'; |
| 1479 | pCache->wzGuid[GUID_STRING_LENGTH] = L'\0'; | 1485 | pCache->wzGuid[GUID_STRING_LENGTH] = L'\0'; |
| 1480 | 1486 | ||
| 1481 | hr = PathConcatRelativeToBase(sczBaseAcquisitionPath, pCache->wzGuid, &pCache->sczAcquisitionFolder); | 1487 | hr = PathConcatRelativeToFullyQualifiedBase(sczBaseAcquisitionPath, pCache->wzGuid, &pCache->sczAcquisitionFolder); |
| 1482 | ExitOnFailure(hr, "Failed to append random guid on to temp path for acquisition folder."); | 1488 | ExitOnFailure(hr, "Failed to append random guid on to temp path for acquisition folder."); |
| 1483 | 1489 | ||
| 1484 | LExit: | 1490 | LExit: |
| @@ -1626,7 +1632,7 @@ static HRESULT CreateCompletedPath( | |||
| 1626 | else | 1632 | else |
| 1627 | { | 1633 | { |
| 1628 | // Get the cache completed file path. | 1634 | // Get the cache completed file path. |
| 1629 | hr = PathConcatRelativeToBase(sczCacheDirectory, wzFilePath, &sczCacheFile); | 1635 | hr = PathConcatRelativeToFullyQualifiedBase(sczCacheDirectory, wzFilePath, &sczCacheFile); |
| 1630 | ExitOnFailure(hr, "Failed to construct cache file."); | 1636 | ExitOnFailure(hr, "Failed to construct cache file."); |
| 1631 | 1637 | ||
| 1632 | // Don't reset permissions here. The payload's package must reset its cache folder when it starts caching. | 1638 | // Don't reset permissions here. The payload's package must reset its cache folder when it starts caching. |
| @@ -1664,7 +1670,7 @@ static HRESULT CreateUnverifiedPath( | |||
| 1664 | pCache->fUnverifiedCacheFolderCreated = TRUE; | 1670 | pCache->fUnverifiedCacheFolderCreated = TRUE; |
| 1665 | } | 1671 | } |
| 1666 | 1672 | ||
| 1667 | hr = PathConcatRelativeToBase(sczUnverifiedCacheFolder, wzPayloadId, psczUnverifiedPayloadPath); | 1673 | hr = PathConcatRelativeToFullyQualifiedBase(sczUnverifiedCacheFolder, wzPayloadId, psczUnverifiedPayloadPath); |
| 1668 | ExitOnFailure(hr, "Failed to concat payload id to unverified folder path."); | 1674 | ExitOnFailure(hr, "Failed to concat payload id to unverified folder path."); |
| 1669 | 1675 | ||
| 1670 | LExit: | 1676 | LExit: |
| @@ -2085,13 +2091,13 @@ static HRESULT CopyEngineToWorkingFolder( | |||
| 2085 | hr = CacheEnsureBaseWorkingFolder(pCache, &sczWorkingFolder); | 2091 | hr = CacheEnsureBaseWorkingFolder(pCache, &sczWorkingFolder); |
| 2086 | ExitOnFailure(hr, "Failed to create working path to copy engine."); | 2092 | ExitOnFailure(hr, "Failed to create working path to copy engine."); |
| 2087 | 2093 | ||
| 2088 | hr = PathConcatRelativeToBase(sczWorkingFolder, wzWorkingFolderName, &sczTargetDirectory); | 2094 | hr = PathConcatRelativeToFullyQualifiedBase(sczWorkingFolder, wzWorkingFolderName, &sczTargetDirectory); |
| 2089 | ExitOnFailure(hr, "Failed to calculate the bundle working folder target name."); | 2095 | ExitOnFailure(hr, "Failed to calculate the bundle working folder target name."); |
| 2090 | 2096 | ||
| 2091 | hr = DirEnsureExists(sczTargetDirectory, NULL); | 2097 | hr = DirEnsureExists(sczTargetDirectory, NULL); |
| 2092 | ExitOnFailure(hr, "Failed create bundle working folder."); | 2098 | ExitOnFailure(hr, "Failed create bundle working folder."); |
| 2093 | 2099 | ||
| 2094 | hr = PathConcatRelativeToBase(sczTargetDirectory, wzExecutableName, &sczTargetPath); | 2100 | hr = PathConcatRelativeToFullyQualifiedBase(sczTargetDirectory, wzExecutableName, &sczTargetPath); |
| 2095 | ExitOnFailure(hr, "Failed to combine working path with engine file name."); | 2101 | ExitOnFailure(hr, "Failed to combine working path with engine file name."); |
| 2096 | 2102 | ||
| 2097 | // Copy the engine without any attached containers to the working path. | 2103 | // Copy the engine without any attached containers to the working path. |
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp index 39836bce..8dfa0010 100644 --- a/src/burn/engine/core.cpp +++ b/src/burn/engine/core.cpp | |||
| @@ -2211,7 +2211,7 @@ static HRESULT DetectPackagePayloadsCached( | |||
| 2211 | { | 2211 | { |
| 2212 | BURN_PAYLOAD* pPayload = pPackage->payloads.rgItems[i].pPayload; | 2212 | BURN_PAYLOAD* pPayload = pPackage->payloads.rgItems[i].pPayload; |
| 2213 | 2213 | ||
| 2214 | hr = PathConcatRelativeToBase(sczCachePath, pPayload->sczFilePath, &sczPayloadCachePath); | 2214 | hr = PathConcatRelativeToFullyQualifiedBase(sczCachePath, pPayload->sczFilePath, &sczPayloadCachePath); |
| 2215 | ExitOnFailure(hr, "Failed to concat payload cache path."); | 2215 | ExitOnFailure(hr, "Failed to concat payload cache path."); |
| 2216 | 2216 | ||
| 2217 | if (FileExistsEx(sczPayloadCachePath, NULL)) | 2217 | if (FileExistsEx(sczPayloadCachePath, NULL)) |
diff --git a/src/burn/engine/engine.mc b/src/burn/engine/engine.mc index 9a08fa3f..1c03145b 100644 --- a/src/burn/engine/engine.mc +++ b/src/burn/engine/engine.mc | |||
| @@ -163,6 +163,13 @@ Language=English | |||
| 163 | Failed to use folder as base working folder: %2!ls!, encountered error: %1!ls!. | 163 | Failed to use folder as base working folder: %2!ls!, encountered error: %1!ls!. |
| 164 | . | 164 | . |
| 165 | 165 | ||
| 166 | MessageId=20 | ||
| 167 | Severity=Warning | ||
| 168 | SymbolicName=MSG_INVALID_POLICY_MACHINE_PACKAGE_CACHE | ||
| 169 | Language=English | ||
| 170 | Failed to use folder as machine package cache: %2!ls!, encountered error: %1!ls!. | ||
| 171 | . | ||
| 172 | |||
| 166 | MessageId=51 | 173 | MessageId=51 |
| 167 | Severity=Error | 174 | Severity=Error |
| 168 | SymbolicName=MSG_FAILED_PARSE_CONDITION | 175 | SymbolicName=MSG_FAILED_PARSE_CONDITION |
diff --git a/src/burn/engine/exeengine.cpp b/src/burn/engine/exeengine.cpp index fb852c78..808577bc 100644 --- a/src/burn/engine/exeengine.cpp +++ b/src/burn/engine/exeengine.cpp | |||
| @@ -380,7 +380,7 @@ extern "C" HRESULT ExeEngineExecutePackage( | |||
| 380 | hr = CacheGetCompletedPath(pCache, pPackage->fPerMachine, pPackage->sczCacheId, &sczCachedDirectory); | 380 | hr = CacheGetCompletedPath(pCache, pPackage->fPerMachine, pPackage->sczCacheId, &sczCachedDirectory); |
| 381 | ExitOnFailure(hr, "Failed to get cached path for package: %ls", pPackage->sczId); | 381 | ExitOnFailure(hr, "Failed to get cached path for package: %ls", pPackage->sczId); |
| 382 | 382 | ||
| 383 | hr = PathConcatRelativeToBase(sczCachedDirectory, pPackagePayload->sczFilePath, &sczExecutablePath); | 383 | hr = PathConcatRelativeToFullyQualifiedBase(sczCachedDirectory, pPackagePayload->sczFilePath, &sczExecutablePath); |
| 384 | ExitOnFailure(hr, "Failed to build executable path."); | 384 | ExitOnFailure(hr, "Failed to build executable path."); |
| 385 | } | 385 | } |
| 386 | 386 | ||
diff --git a/src/burn/engine/msiengine.cpp b/src/burn/engine/msiengine.cpp index bfd5710f..edbf4d45 100644 --- a/src/burn/engine/msiengine.cpp +++ b/src/burn/engine/msiengine.cpp | |||
| @@ -1236,7 +1236,7 @@ extern "C" HRESULT MsiEngineExecutePackage( | |||
| 1236 | // Best effort to set the execute package cache folder variable. | 1236 | // Best effort to set the execute package cache folder variable. |
| 1237 | VariableSetString(pVariables, BURN_BUNDLE_EXECUTE_PACKAGE_CACHE_FOLDER, sczCachedDirectory, TRUE, FALSE); | 1237 | VariableSetString(pVariables, BURN_BUNDLE_EXECUTE_PACKAGE_CACHE_FOLDER, sczCachedDirectory, TRUE, FALSE); |
| 1238 | 1238 | ||
| 1239 | hr = PathConcatRelativeToBase(sczCachedDirectory, pPackagePayload->sczFilePath, &sczMsiPath); | 1239 | hr = PathConcatRelativeToFullyQualifiedBase(sczCachedDirectory, pPackagePayload->sczFilePath, &sczMsiPath); |
| 1240 | ExitOnFailure(hr, "Failed to build MSI path."); | 1240 | ExitOnFailure(hr, "Failed to build MSI path."); |
| 1241 | } | 1241 | } |
| 1242 | 1242 | ||
| @@ -2195,7 +2195,7 @@ static HRESULT ConcatPatchProperty( | |||
| 2195 | hr = CacheGetCompletedPath(pCache, pMspPackage->fPerMachine, pMspPackage->sczCacheId, &sczCachedDirectory); | 2195 | hr = CacheGetCompletedPath(pCache, pMspPackage->fPerMachine, pMspPackage->sczCacheId, &sczCachedDirectory); |
| 2196 | ExitOnFailure(hr, "Failed to get cached path for MSP package: %ls", pMspPackage->sczId); | 2196 | ExitOnFailure(hr, "Failed to get cached path for MSP package: %ls", pMspPackage->sczId); |
| 2197 | 2197 | ||
| 2198 | hr = PathConcatRelativeToBase(sczCachedDirectory, pMspPackagePayload->sczFilePath, &sczMspPath); | 2198 | hr = PathConcatRelativeToFullyQualifiedBase(sczCachedDirectory, pMspPackagePayload->sczFilePath, &sczMspPath); |
| 2199 | ExitOnFailure(hr, "Failed to build MSP path."); | 2199 | ExitOnFailure(hr, "Failed to build MSP path."); |
| 2200 | 2200 | ||
| 2201 | if (!sczPatches) | 2201 | if (!sczPatches) |
diff --git a/src/burn/engine/mspengine.cpp b/src/burn/engine/mspengine.cpp index 02e2afe4..81b7b651 100644 --- a/src/burn/engine/mspengine.cpp +++ b/src/burn/engine/mspengine.cpp | |||
| @@ -613,7 +613,7 @@ extern "C" HRESULT MspEngineExecutePackage( | |||
| 613 | // Best effort to set the execute package cache folder variable. | 613 | // Best effort to set the execute package cache folder variable. |
| 614 | VariableSetString(pVariables, BURN_BUNDLE_EXECUTE_PACKAGE_CACHE_FOLDER, sczCachedDirectory, TRUE, FALSE); | 614 | VariableSetString(pVariables, BURN_BUNDLE_EXECUTE_PACKAGE_CACHE_FOLDER, sczCachedDirectory, TRUE, FALSE); |
| 615 | 615 | ||
| 616 | hr = PathConcatRelativeToBase(sczCachedDirectory, pMspPackagePayload->sczFilePath, &sczMspPath); | 616 | hr = PathConcatRelativeToFullyQualifiedBase(sczCachedDirectory, pMspPackagePayload->sczFilePath, &sczMspPath); |
| 617 | ExitOnFailure(hr, "Failed to build MSP path."); | 617 | ExitOnFailure(hr, "Failed to build MSP path."); |
| 618 | 618 | ||
| 619 | wzAppend = sczMspPath; | 619 | wzAppend = sczMspPath; |
diff --git a/src/burn/engine/msuengine.cpp b/src/burn/engine/msuengine.cpp index d78943ac..1b051165 100644 --- a/src/burn/engine/msuengine.cpp +++ b/src/burn/engine/msuengine.cpp | |||
| @@ -320,7 +320,7 @@ extern "C" HRESULT MsuEngineExecutePackage( | |||
| 320 | // Best effort to set the execute package cache folder variable. | 320 | // Best effort to set the execute package cache folder variable. |
| 321 | VariableSetString(pVariables, BURN_BUNDLE_EXECUTE_PACKAGE_CACHE_FOLDER, sczCachedDirectory, TRUE, FALSE); | 321 | VariableSetString(pVariables, BURN_BUNDLE_EXECUTE_PACKAGE_CACHE_FOLDER, sczCachedDirectory, TRUE, FALSE); |
| 322 | 322 | ||
| 323 | hr = PathConcatRelativeToBase(sczCachedDirectory, pPackagePayload->sczFilePath, &sczMsuPath); | 323 | hr = PathConcatRelativeToFullyQualifiedBase(sczCachedDirectory, pPackagePayload->sczFilePath, &sczMsuPath); |
| 324 | ExitOnFailure(hr, "Failed to build MSU path."); | 324 | ExitOnFailure(hr, "Failed to build MSU path."); |
| 325 | 325 | ||
| 326 | // format command | 326 | // format command |
diff --git a/src/burn/engine/payload.cpp b/src/burn/engine/payload.cpp index f57f1310..a4450bf7 100644 --- a/src/burn/engine/payload.cpp +++ b/src/burn/engine/payload.cpp | |||
| @@ -294,7 +294,7 @@ extern "C" HRESULT PayloadExtractUXContainer( | |||
| 294 | ExitOnFailure(hr, "Failed to find embedded payload: %ls", sczStreamName); | 294 | ExitOnFailure(hr, "Failed to find embedded payload: %ls", sczStreamName); |
| 295 | 295 | ||
| 296 | // make file path | 296 | // make file path |
| 297 | hr = PathConcatRelativeToBase(wzTargetDir, pPayload->sczFilePath, &pPayload->sczLocalFilePath); | 297 | hr = PathConcatRelativeToFullyQualifiedBase(wzTargetDir, pPayload->sczFilePath, &pPayload->sczLocalFilePath); |
| 298 | ExitOnFailure(hr, "Failed to concat file paths."); | 298 | ExitOnFailure(hr, "Failed to concat file paths."); |
| 299 | 299 | ||
| 300 | // extract file | 300 | // extract file |
diff --git a/src/burn/engine/plan.cpp b/src/burn/engine/plan.cpp index 68c1d2ba..52bf6298 100644 --- a/src/burn/engine/plan.cpp +++ b/src/burn/engine/plan.cpp | |||
| @@ -432,24 +432,28 @@ extern "C" HRESULT PlanLayoutBundle( | |||
| 432 | { | 432 | { |
| 433 | HRESULT hr = S_OK; | 433 | HRESULT hr = S_OK; |
| 434 | BURN_CACHE_ACTION* pCacheAction = NULL; | 434 | BURN_CACHE_ACTION* pCacheAction = NULL; |
| 435 | LPWSTR sczLayoutDirectory = NULL; | ||
| 435 | LPWSTR sczExecutablePath = NULL; | 436 | LPWSTR sczExecutablePath = NULL; |
| 436 | 437 | ||
| 437 | // Get the layout directory. | 438 | // Get the layout directory. |
| 438 | hr = VariableGetString(pVariables, BURN_BUNDLE_LAYOUT_DIRECTORY, &pPlan->sczLayoutDirectory); | 439 | hr = VariableGetString(pVariables, BURN_BUNDLE_LAYOUT_DIRECTORY, &sczLayoutDirectory); |
| 439 | if (E_NOTFOUND == hr) // if not set, use the current directory as the layout directory. | 440 | if (E_NOTFOUND == hr) // if not set, use the current directory as the layout directory. |
| 440 | { | 441 | { |
| 441 | hr = VariableGetString(pVariables, BURN_BUNDLE_SOURCE_PROCESS_FOLDER, &pPlan->sczLayoutDirectory); | 442 | hr = VariableGetString(pVariables, BURN_BUNDLE_SOURCE_PROCESS_FOLDER, &sczLayoutDirectory); |
| 442 | if (E_NOTFOUND == hr) // if not set, use the current directory as the layout directory. | 443 | if (E_NOTFOUND == hr) // if not set, use the current directory as the layout directory. |
| 443 | { | 444 | { |
| 444 | hr = PathForCurrentProcess(&sczExecutablePath, NULL); | 445 | hr = PathForCurrentProcess(&sczExecutablePath, NULL); |
| 445 | ExitOnFailure(hr, "Failed to get path for current executing process as layout directory."); | 446 | ExitOnFailure(hr, "Failed to get path for current executing process as layout directory."); |
| 446 | 447 | ||
| 447 | hr = PathGetDirectory(sczExecutablePath, &pPlan->sczLayoutDirectory); | 448 | hr = PathGetDirectory(sczExecutablePath, &sczLayoutDirectory); |
| 448 | ExitOnFailure(hr, "Failed to get executing process as layout directory."); | 449 | ExitOnFailure(hr, "Failed to get executing process as layout directory."); |
| 449 | } | 450 | } |
| 450 | } | 451 | } |
| 451 | ExitOnFailure(hr, "Failed to get bundle layout directory property."); | 452 | ExitOnFailure(hr, "Failed to get bundle layout directory property."); |
| 452 | 453 | ||
| 454 | hr = PathGetFullPathName(sczLayoutDirectory, &pPlan->sczLayoutDirectory, NULL, NULL); | ||
| 455 | ExitOnFailure(hr, "Failed to ensure layout directory is fully qualified."); | ||
| 456 | |||
| 453 | hr = PathBackslashTerminate(&pPlan->sczLayoutDirectory); | 457 | hr = PathBackslashTerminate(&pPlan->sczLayoutDirectory); |
| 454 | ExitOnFailure(hr, "Failed to ensure layout directory is backslash terminated."); | 458 | ExitOnFailure(hr, "Failed to ensure layout directory is backslash terminated."); |
| 455 | 459 | ||
| @@ -478,6 +482,7 @@ extern "C" HRESULT PlanLayoutBundle( | |||
| 478 | 482 | ||
| 479 | LExit: | 483 | LExit: |
| 480 | ReleaseStr(sczExecutablePath); | 484 | ReleaseStr(sczExecutablePath); |
| 485 | ReleaseStr(sczLayoutDirectory); | ||
| 481 | 486 | ||
| 482 | return hr; | 487 | return hr; |
| 483 | } | 488 | } |
diff --git a/src/burn/engine/registration.cpp b/src/burn/engine/registration.cpp index 2b3dc4d4..d0e5c677 100644 --- a/src/burn/engine/registration.cpp +++ b/src/burn/engine/registration.cpp | |||
| @@ -1149,7 +1149,7 @@ static HRESULT SetPaths( | |||
| 1149 | ExitOnFailure(hr, "Failed to build cache directory."); | 1149 | ExitOnFailure(hr, "Failed to build cache directory."); |
| 1150 | 1150 | ||
| 1151 | // build cached executable path | 1151 | // build cached executable path |
| 1152 | hr = PathConcatRelativeToBase(sczCacheDirectory, pRegistration->sczExecutableName, &pRegistration->sczCacheExecutablePath); | 1152 | hr = PathConcatRelativeToFullyQualifiedBase(sczCacheDirectory, pRegistration->sczExecutableName, &pRegistration->sczCacheExecutablePath); |
| 1153 | ExitOnFailure(hr, "Failed to build cached executable path."); | 1153 | ExitOnFailure(hr, "Failed to build cached executable path."); |
| 1154 | 1154 | ||
| 1155 | // build state file path | 1155 | // build state file path |
| @@ -1367,7 +1367,7 @@ static HRESULT WriteSoftwareTags( | |||
| 1367 | hr = PathConcat(sczRootFolder, SWIDTAG_FOLDER, &sczTagFolder); | 1367 | hr = PathConcat(sczRootFolder, SWIDTAG_FOLDER, &sczTagFolder); |
| 1368 | ExitOnFailure(hr, "Failed to allocate regid folder path."); | 1368 | ExitOnFailure(hr, "Failed to allocate regid folder path."); |
| 1369 | 1369 | ||
| 1370 | hr = PathConcatRelativeToBase(sczTagFolder, pSoftwareTag->sczFilename, &sczPath); | 1370 | hr = PathConcatRelativeToFullyQualifiedBase(sczTagFolder, pSoftwareTag->sczFilename, &sczPath); |
| 1371 | ExitOnFailure(hr, "Failed to allocate regid file path."); | 1371 | ExitOnFailure(hr, "Failed to allocate regid file path."); |
| 1372 | 1372 | ||
| 1373 | hr = DirEnsureExists(sczTagFolder, NULL); | 1373 | hr = DirEnsureExists(sczTagFolder, NULL); |
| @@ -1405,7 +1405,7 @@ static HRESULT RemoveSoftwareTags( | |||
| 1405 | hr = PathConcat(sczRootFolder, SWIDTAG_FOLDER, &sczTagFolder); | 1405 | hr = PathConcat(sczRootFolder, SWIDTAG_FOLDER, &sczTagFolder); |
| 1406 | ExitOnFailure(hr, "Failed to allocate regid folder path."); | 1406 | ExitOnFailure(hr, "Failed to allocate regid folder path."); |
| 1407 | 1407 | ||
| 1408 | hr = PathConcatRelativeToBase(sczTagFolder, pSoftwareTag->sczFilename, &sczPath); | 1408 | hr = PathConcatRelativeToFullyQualifiedBase(sczTagFolder, pSoftwareTag->sczFilename, &sczPath); |
| 1409 | ExitOnFailure(hr, "Failed to allocate regid file path."); | 1409 | ExitOnFailure(hr, "Failed to allocate regid file path."); |
| 1410 | 1410 | ||
| 1411 | // Best effort to delete the software tag file and the regid folder. | 1411 | // Best effort to delete the software tag file and the regid folder. |
diff --git a/src/libs/dutil/WixToolset.DUtil/inc/pathutil.h b/src/libs/dutil/WixToolset.DUtil/inc/pathutil.h index f36e6ebc..971ef887 100644 --- a/src/libs/dutil/WixToolset.DUtil/inc/pathutil.h +++ b/src/libs/dutil/WixToolset.DUtil/inc/pathutil.h | |||
| @@ -299,6 +299,16 @@ DAPI_(HRESULT) PathConcatRelativeToBase( | |||
| 299 | ); | 299 | ); |
| 300 | 300 | ||
| 301 | /******************************************************************* | 301 | /******************************************************************* |
| 302 | PathConcatRelativeToFullyQualifiedBase - ensures the base path is | ||
| 303 | fully qualified and then calls PathConcatRelativeToBase. | ||
| 304 | *******************************************************************/ | ||
| 305 | DAPI_(HRESULT) PathConcatRelativeToFullyQualifiedBase( | ||
| 306 | __in LPCWSTR wzBase, | ||
| 307 | __in_opt LPCWSTR wzRelative, | ||
| 308 | __deref_out_z LPWSTR* psczCombined | ||
| 309 | ); | ||
| 310 | |||
| 311 | /******************************************************************* | ||
| 302 | PathCompareCanonicalized - canonicalizes the two paths using PathCanonicalizeForComparison | 312 | PathCompareCanonicalized - canonicalizes the two paths using PathCanonicalizeForComparison |
| 303 | which does not resolve relative paths into fully qualified paths. | 313 | which does not resolve relative paths into fully qualified paths. |
| 304 | The strings are then compared using ::CompareStringW(). | 314 | The strings are then compared using ::CompareStringW(). |
diff --git a/src/libs/dutil/WixToolset.DUtil/path2utl.cpp b/src/libs/dutil/WixToolset.DUtil/path2utl.cpp index c6ff608c..3c4b2f88 100644 --- a/src/libs/dutil/WixToolset.DUtil/path2utl.cpp +++ b/src/libs/dutil/WixToolset.DUtil/path2utl.cpp | |||
| @@ -162,6 +162,25 @@ LExit: | |||
| 162 | return hr; | 162 | return hr; |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | DAPI_(HRESULT) PathConcatRelativeToFullyQualifiedBase( | ||
| 166 | __in LPCWSTR wzBase, | ||
| 167 | __in_opt LPCWSTR wzRelative, | ||
| 168 | __deref_out_z LPWSTR* psczCombined | ||
| 169 | ) | ||
| 170 | { | ||
| 171 | HRESULT hr = S_OK; | ||
| 172 | |||
| 173 | if (!PathIsFullyQualified(wzBase)) | ||
| 174 | { | ||
| 175 | PathExitWithRootFailure(hr, E_INVALIDARG, "wzBase must be fully qualified: %ls.", wzBase); | ||
| 176 | } | ||
| 177 | |||
| 178 | hr = PathConcatRelativeToBase(wzBase, wzRelative, psczCombined); | ||
| 179 | |||
| 180 | LExit: | ||
| 181 | return hr; | ||
| 182 | } | ||
| 183 | |||
| 165 | DAPI_(HRESULT) PathCompareCanonicalized( | 184 | DAPI_(HRESULT) PathCompareCanonicalized( |
| 166 | __in_z LPCWSTR wzPath1, | 185 | __in_z LPCWSTR wzPath1, |
| 167 | __in_z LPCWSTR wzPath2, | 186 | __in_z LPCWSTR wzPath2, |
