aboutsummaryrefslogtreecommitdiff
path: root/src/burn
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-06-03 17:47:54 -0500
committerSean Hall <r.sean.hall@gmail.com>2022-06-07 19:44:36 -0500
commitb652e93a460b4b822a01382e5992f96f1d805ffe (patch)
tree0c8ec0f0eba23d65fd404eb3f510944b244de65b /src/burn
parent8a4d03207633e9fdc364aaed82bd167f844679f9 (diff)
downloadwix-b652e93a460b4b822a01382e5992f96f1d805ffe.tar.gz
wix-b652e93a460b4b822a01382e5992f96f1d805ffe.tar.bz2
wix-b652e93a460b4b822a01382e5992f96f1d805ffe.zip
Replace PathCompare with PathCompareCanonicalized.
Diffstat (limited to 'src/burn')
-rw-r--r--src/burn/engine/apply.cpp12
-rw-r--r--src/burn/engine/cache.cpp18
2 files changed, 15 insertions, 15 deletions
diff --git a/src/burn/engine/apply.cpp b/src/burn/engine/apply.cpp
index f9b33333..4ebed191 100644
--- a/src/burn/engine/apply.cpp
+++ b/src/burn/engine/apply.cpp
@@ -1350,7 +1350,7 @@ static HRESULT LayoutBundle(
1350 LPWSTR sczBundlePath = NULL; 1350 LPWSTR sczBundlePath = NULL;
1351 LPWSTR sczBundleDownloadUrl = NULL; 1351 LPWSTR sczBundleDownloadUrl = NULL;
1352 LPWSTR sczDestinationPath = NULL; 1352 LPWSTR sczDestinationPath = NULL;
1353 int nEquivalentPaths = 0; 1353 BOOL fPathEqual = FALSE;
1354 BOOTSTRAPPER_CACHE_OPERATION cacheOperation = BOOTSTRAPPER_CACHE_OPERATION_NONE; 1354 BOOTSTRAPPER_CACHE_OPERATION cacheOperation = BOOTSTRAPPER_CACHE_OPERATION_NONE;
1355 BURN_CACHE_PROGRESS_CONTEXT progress = { }; 1355 BURN_CACHE_PROGRESS_CONTEXT progress = { };
1356 BOOL fRetry = FALSE; 1356 BOOL fRetry = FALSE;
@@ -1375,10 +1375,10 @@ static HRESULT LayoutBundle(
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.
1378 hr = PathCompare(sczBundlePath, sczDestinationPath, &nEquivalentPaths); 1378 hr = PathCompareCanonicalized(sczBundlePath, sczDestinationPath, &fPathEqual);
1379 ExitOnFailure(hr, "Failed to determine if layout bundle path was equivalent with current process path."); 1379 ExitOnFailure(hr, "Failed to determine if layout bundle path was equivalent with current process path.");
1380 1380
1381 if (CSTR_EQUAL == nEquivalentPaths && FileExistsEx(sczDestinationPath, NULL)) 1381 if (fPathEqual && FileExistsEx(sczDestinationPath, NULL))
1382 { 1382 {
1383 hr = UserExperienceOnCacheContainerOrPayloadVerifyBegin(pContext->pUX, NULL, NULL); 1383 hr = UserExperienceOnCacheContainerOrPayloadVerifyBegin(pContext->pUX, NULL, NULL);
1384 if (FAILED(hr)) 1384 if (FAILED(hr))
@@ -1533,7 +1533,7 @@ static HRESULT AcquireContainerOrPayload(
1533 AssertSz(pContainer || pPayload, "Must provide a container or a payload."); 1533 AssertSz(pContainer || pPayload, "Must provide a container or a payload.");
1534 1534
1535 HRESULT hr = S_OK; 1535 HRESULT hr = S_OK;
1536 int nEquivalentPaths = 0; 1536 BOOL fPathEqual = FALSE;
1537 LPCWSTR wzPackageOrContainerId = pContainer ? pContainer->sczId : pPackage ? pPackage->sczId : NULL; 1537 LPCWSTR wzPackageOrContainerId = pContainer ? pContainer->sczId : pPackage ? pPackage->sczId : NULL;
1538 LPCWSTR wzPayloadId = pPayload ? pPayload->sczKey : NULL; 1538 LPCWSTR wzPayloadId = pPayload ? pPayload->sczKey : NULL;
1539 LPCWSTR wzPayloadContainerId = pPayload && pPayload->pContainer ? pPayload->pContainer->sczId : NULL; 1539 LPCWSTR wzPayloadContainerId = pPayload && pPayload->pContainer ? pPayload->pContainer->sczId : NULL;
@@ -1673,10 +1673,10 @@ static HRESULT AcquireContainerOrPayload(
1673 { 1673 {
1674 case BOOTSTRAPPER_CACHE_OPERATION_COPY: 1674 case BOOTSTRAPPER_CACHE_OPERATION_COPY:
1675 // If the source path and destination path are different, do the copy (otherwise there's no point). 1675 // If the source path and destination path are different, do the copy (otherwise there's no point).
1676 hr = PathCompare(pContext->rgSearchPaths[dwChosenSearchPath], wzDestinationPath, &nEquivalentPaths); 1676 hr = PathCompareCanonicalized(pContext->rgSearchPaths[dwChosenSearchPath], wzDestinationPath, &fPathEqual);
1677 ExitOnFailure(hr, "Failed to determine if payload paths were equivalent, source: %ls, destination: %ls.", pContext->rgSearchPaths[dwChosenSearchPath], wzDestinationPath); 1677 ExitOnFailure(hr, "Failed to determine if payload paths were equivalent, source: %ls, destination: %ls.", pContext->rgSearchPaths[dwChosenSearchPath], wzDestinationPath);
1678 1678
1679 if (CSTR_EQUAL != nEquivalentPaths) 1679 if (!fPathEqual)
1680 { 1680 {
1681 hr = CopyPayload(pProgress, INVALID_HANDLE_VALUE, pContext->rgSearchPaths[dwChosenSearchPath], wzDestinationPath); 1681 hr = CopyPayload(pProgress, INVALID_HANDLE_VALUE, pContext->rgSearchPaths[dwChosenSearchPath], wzDestinationPath);
1682 ExitOnFailure(hr, "Failed to copy payload: %ls", wzPayloadId); 1682 ExitOnFailure(hr, "Failed to copy payload: %ls", wzPayloadId);
diff --git a/src/burn/engine/cache.cpp b/src/burn/engine/cache.cpp
index 04b2f0ca..b311a195 100644
--- a/src/burn/engine/cache.cpp
+++ b/src/burn/engine/cache.cpp
@@ -170,7 +170,7 @@ extern "C" HRESULT CacheInitialize(
170 170
171 HRESULT hr = S_OK; 171 HRESULT hr = S_OK;
172 LPWSTR sczAppData = NULL; 172 LPWSTR sczAppData = NULL;
173 int nCompare = 0; 173 BOOL fPathEqual = FALSE;
174 174
175 // Cache paths are initialized once so they cannot be changed while the engine is caching payloads. 175 // Cache paths are initialized once so they cannot be changed while the engine is caching payloads.
176 // Always construct the default machine package cache path so we can determine if we're redirected. 176 // Always construct the default machine package cache path so we can determine if we're redirected.
@@ -199,10 +199,10 @@ extern "C" HRESULT CacheInitialize(
199 ExitOnFailure(hr, "Failed to copy default package cache directory to current package cache directory."); 199 ExitOnFailure(hr, "Failed to copy default package cache directory to current package cache directory.");
200 } 200 }
201 201
202 hr = PathCompare(pCache->sczDefaultMachinePackageCache, pCache->sczCurrentMachinePackageCache, &nCompare); 202 hr = PathCompareCanonicalized(pCache->sczDefaultMachinePackageCache, pCache->sczCurrentMachinePackageCache, &fPathEqual);
203 ExitOnFailure(hr, "Failed to compare default and current package cache directories."); 203 ExitOnFailure(hr, "Failed to compare default and current package cache directories.");
204 204
205 pCache->fCustomMachinePackageCache = CSTR_EQUAL != nCompare; 205 pCache->fCustomMachinePackageCache = !fPathEqual;
206 206
207 207
208 hr = PathGetKnownFolder(CSIDL_LOCAL_APPDATA, &sczAppData); 208 hr = PathGetKnownFolder(CSIDL_LOCAL_APPDATA, &sczAppData);
@@ -241,7 +241,7 @@ extern "C" HRESULT CacheInitializeSources(
241 LPWSTR sczCompletedPath = NULL; 241 LPWSTR sczCompletedPath = NULL;
242 LPWSTR sczOriginalSource = NULL; 242 LPWSTR sczOriginalSource = NULL;
243 LPWSTR sczOriginalSourceFolder = NULL; 243 LPWSTR sczOriginalSourceFolder = NULL;
244 int nCompare = 0; 244 BOOL fPathEqual = FALSE;
245 LPCWSTR wzSourceProcessPath = pInternalCommand->sczSourceProcessPath; 245 LPCWSTR wzSourceProcessPath = pInternalCommand->sczSourceProcessPath;
246 246
247 hr = PathForCurrentProcess(&sczCurrentPath, NULL); 247 hr = PathForCurrentProcess(&sczCurrentPath, NULL);
@@ -254,10 +254,10 @@ extern "C" HRESULT CacheInitializeSources(
254 hr = PathConcatRelativeToBase(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 = PathCompareCanonicalized(sczCurrentPath, sczCompletedPath, &fPathEqual);
258 ExitOnFailure(hr, "Failed to compare current path for bundle: %ls", sczCurrentPath); 258 ExitOnFailure(hr, "Failed to compare current path for bundle: %ls", sczCurrentPath);
259 259
260 pCache->fRunningFromCache = (CSTR_EQUAL == nCompare); 260 pCache->fRunningFromCache = fPathEqual;
261 261
262 // If a source process path was not provided (e.g. we are not being 262 // If a source process path was not provided (e.g. we are not being
263 // run in a clean room) then use the current process path as the 263 // run in a clean room) then use the current process path as the
@@ -959,7 +959,7 @@ extern "C" HRESULT CacheCompleteBundle(
959 ) 959 )
960{ 960{
961 HRESULT hr = S_OK; 961 HRESULT hr = S_OK;
962 int nCompare = 0; 962 BOOL fPathEqual = FALSE;
963 LPWSTR sczTargetDirectory = NULL; 963 LPWSTR sczTargetDirectory = NULL;
964 LPWSTR sczTargetPath = NULL; 964 LPWSTR sczTargetPath = NULL;
965 LPWSTR sczSourceDirectory = NULL; 965 LPWSTR sczSourceDirectory = NULL;
@@ -976,10 +976,10 @@ extern "C" HRESULT CacheCompleteBundle(
976 976
977 // If the bundle is running out of the package cache then we don't need to copy it there 977 // If the bundle is running out of the package cache then we don't need to copy it there
978 // (and don't want to since it'll be in use) so bail. 978 // (and don't want to since it'll be in use) so bail.
979 hr = PathCompare(wzSourceBundlePath, sczTargetPath, &nCompare); 979 hr = PathCompareCanonicalized(wzSourceBundlePath, sczTargetPath, &fPathEqual);
980 ExitOnFailure(hr, "Failed to compare completed cache path for bundle: %ls", wzSourceBundlePath); 980 ExitOnFailure(hr, "Failed to compare completed cache path for bundle: %ls", wzSourceBundlePath);
981 981
982 if (CSTR_EQUAL == nCompare) 982 if (fPathEqual)
983 { 983 {
984 ExitFunction(); 984 ExitFunction();
985 } 985 }