From b652e93a460b4b822a01382e5992f96f1d805ffe Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 3 Jun 2022 17:47:54 -0500 Subject: Replace PathCompare with PathCompareCanonicalized. --- src/burn/engine/apply.cpp | 12 ++++++------ src/burn/engine/cache.cpp | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/burn') 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( LPWSTR sczBundlePath = NULL; LPWSTR sczBundleDownloadUrl = NULL; LPWSTR sczDestinationPath = NULL; - int nEquivalentPaths = 0; + BOOL fPathEqual = FALSE; BOOTSTRAPPER_CACHE_OPERATION cacheOperation = BOOTSTRAPPER_CACHE_OPERATION_NONE; BURN_CACHE_PROGRESS_CONTEXT progress = { }; BOOL fRetry = FALSE; @@ -1375,10 +1375,10 @@ static HRESULT LayoutBundle( ExitOnFailure(hr, "Failed to concat layout path for bundle."); // If the destination path is the currently running bundle, bail. - hr = PathCompare(sczBundlePath, sczDestinationPath, &nEquivalentPaths); + hr = PathCompareCanonicalized(sczBundlePath, sczDestinationPath, &fPathEqual); ExitOnFailure(hr, "Failed to determine if layout bundle path was equivalent with current process path."); - if (CSTR_EQUAL == nEquivalentPaths && FileExistsEx(sczDestinationPath, NULL)) + if (fPathEqual && FileExistsEx(sczDestinationPath, NULL)) { hr = UserExperienceOnCacheContainerOrPayloadVerifyBegin(pContext->pUX, NULL, NULL); if (FAILED(hr)) @@ -1533,7 +1533,7 @@ static HRESULT AcquireContainerOrPayload( AssertSz(pContainer || pPayload, "Must provide a container or a payload."); HRESULT hr = S_OK; - int nEquivalentPaths = 0; + BOOL fPathEqual = FALSE; LPCWSTR wzPackageOrContainerId = pContainer ? pContainer->sczId : pPackage ? pPackage->sczId : NULL; LPCWSTR wzPayloadId = pPayload ? pPayload->sczKey : NULL; LPCWSTR wzPayloadContainerId = pPayload && pPayload->pContainer ? pPayload->pContainer->sczId : NULL; @@ -1673,10 +1673,10 @@ static HRESULT AcquireContainerOrPayload( { case BOOTSTRAPPER_CACHE_OPERATION_COPY: // If the source path and destination path are different, do the copy (otherwise there's no point). - hr = PathCompare(pContext->rgSearchPaths[dwChosenSearchPath], wzDestinationPath, &nEquivalentPaths); + hr = PathCompareCanonicalized(pContext->rgSearchPaths[dwChosenSearchPath], wzDestinationPath, &fPathEqual); ExitOnFailure(hr, "Failed to determine if payload paths were equivalent, source: %ls, destination: %ls.", pContext->rgSearchPaths[dwChosenSearchPath], wzDestinationPath); - if (CSTR_EQUAL != nEquivalentPaths) + if (!fPathEqual) { hr = CopyPayload(pProgress, INVALID_HANDLE_VALUE, pContext->rgSearchPaths[dwChosenSearchPath], wzDestinationPath); 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( HRESULT hr = S_OK; LPWSTR sczAppData = NULL; - int nCompare = 0; + BOOL fPathEqual = FALSE; // Cache paths are initialized once so they cannot be changed while the engine is caching payloads. // Always construct the default machine package cache path so we can determine if we're redirected. @@ -199,10 +199,10 @@ extern "C" HRESULT CacheInitialize( ExitOnFailure(hr, "Failed to copy default package cache directory to current package cache directory."); } - hr = PathCompare(pCache->sczDefaultMachinePackageCache, pCache->sczCurrentMachinePackageCache, &nCompare); + hr = PathCompareCanonicalized(pCache->sczDefaultMachinePackageCache, pCache->sczCurrentMachinePackageCache, &fPathEqual); ExitOnFailure(hr, "Failed to compare default and current package cache directories."); - pCache->fCustomMachinePackageCache = CSTR_EQUAL != nCompare; + pCache->fCustomMachinePackageCache = !fPathEqual; hr = PathGetKnownFolder(CSIDL_LOCAL_APPDATA, &sczAppData); @@ -241,7 +241,7 @@ extern "C" HRESULT CacheInitializeSources( LPWSTR sczCompletedPath = NULL; LPWSTR sczOriginalSource = NULL; LPWSTR sczOriginalSourceFolder = NULL; - int nCompare = 0; + BOOL fPathEqual = FALSE; LPCWSTR wzSourceProcessPath = pInternalCommand->sczSourceProcessPath; hr = PathForCurrentProcess(&sczCurrentPath, NULL); @@ -254,10 +254,10 @@ extern "C" HRESULT CacheInitializeSources( hr = PathConcatRelativeToBase(sczCompletedFolder, pRegistration->sczExecutableName, &sczCompletedPath); ExitOnFailure(hr, "Failed to combine working path with engine file name."); - hr = PathCompare(sczCurrentPath, sczCompletedPath, &nCompare); + hr = PathCompareCanonicalized(sczCurrentPath, sczCompletedPath, &fPathEqual); ExitOnFailure(hr, "Failed to compare current path for bundle: %ls", sczCurrentPath); - pCache->fRunningFromCache = (CSTR_EQUAL == nCompare); + pCache->fRunningFromCache = fPathEqual; // If a source process path was not provided (e.g. we are not being // run in a clean room) then use the current process path as the @@ -959,7 +959,7 @@ extern "C" HRESULT CacheCompleteBundle( ) { HRESULT hr = S_OK; - int nCompare = 0; + BOOL fPathEqual = FALSE; LPWSTR sczTargetDirectory = NULL; LPWSTR sczTargetPath = NULL; LPWSTR sczSourceDirectory = NULL; @@ -976,10 +976,10 @@ extern "C" HRESULT CacheCompleteBundle( // If the bundle is running out of the package cache then we don't need to copy it there // (and don't want to since it'll be in use) so bail. - hr = PathCompare(wzSourceBundlePath, sczTargetPath, &nCompare); + hr = PathCompareCanonicalized(wzSourceBundlePath, sczTargetPath, &fPathEqual); ExitOnFailure(hr, "Failed to compare completed cache path for bundle: %ls", wzSourceBundlePath); - if (CSTR_EQUAL == nCompare) + if (fPathEqual) { ExitFunction(); } -- cgit v1.2.3-55-g6feb