From 1230f097a03950e6a871e553850f4d1375ff9d77 Mon Sep 17 00:00:00 2001 From: Nir Bar Date: Mon, 11 Nov 2024 15:59:49 +0200 Subject: [PATCH] Fix deleting symbolic links in WixRemoveFoldersEx --- .github/workflows/wix3-build.yml | 6 +++--- src/ext/ca/wixca/dll/RemoveFoldersEx.cpp | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/wix3-build.yml b/.github/workflows/wix3-build.yml index b6393be31..062a15d05 100644 --- a/.github/workflows/wix3-build.yml +++ b/.github/workflows/wix3-build.yml @@ -16,8 +16,8 @@ jobs: WiX3-Build: runs-on: windows-2019 steps: - - uses: actions/checkout@v2 - - uses: microsoft/setup-msbuild@v1.0.2 + - uses: actions/checkout@v4 + - uses: microsoft/setup-msbuild@v2 - name: Decrypt snk run: gpg --quiet --batch --yes --decrypt --passphrase="${{ secrets.GPG_PASSPHRASE }}" --output "${{ github.workspace }}\psw-wix.snk" "${{ github.workspace }}\psw-wix.snk.gpg" @@ -34,7 +34,7 @@ jobs: - name: Create nuget package run: nuget.exe pack "${{ github.workspace }}\src\Setup\Nupkg\WiX.nuspec" -Version "${{ env.NUPKG_VERSION }}" -BasePath "${{ github.workspace }}" -OutputDirectory "${{ github.workspace }}\build\nuget-out" - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4.4.3 with: name: nuget path: ${{ github.workspace }}\build\nuget-out\PanelSW.Custom.WiX.${{ env.NUPKG_VERSION }}.nupkg diff --git a/src/ext/ca/wixca/dll/RemoveFoldersEx.cpp b/src/ext/ca/wixca/dll/RemoveFoldersEx.cpp index af138ebd4..30e6516a8 100644 --- a/src/ext/ca/wixca/dll/RemoveFoldersEx.cpp +++ b/src/ext/ca/wixca/dll/RemoveFoldersEx.cpp @@ -62,21 +62,18 @@ static HRESULT RecursePath( // See https://learn.microsoft.com/en-us/windows/win32/fileio/reparse-point-tags, https://learn.microsoft.com/en-us/windows/win32/fileio/determining-whether-a-directory-is-a-volume-mount-point if (FILE_ATTRIBUTE_REPARSE_POINT == (wfd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) && (IO_REPARSE_TAG_SYMLINK == wfd.dwReserved0 || IO_REPARSE_TAG_MOUNT_POINT == wfd.dwReserved0)) { - hr = StrAllocFormatted(&sczNext, L"%s%s", wzPath, wfd.cFileName); - ExitOnFailure(hr, "Failed to concat filename '%S' to string: %S", wfd.cFileName, wzPath); - hr = StrAllocFormatted(&sczProperty, L"_%s_%u", wzProperty, *pdwCounter); ExitOnFailure(hr, "Failed to allocate Property for RemoveFile table with property: %S.", wzProperty); ++(*pdwCounter); - hr = WcaSetProperty(sczProperty, sczNext); + hr = WcaSetProperty(sczProperty, wzPath); ExitOnFailure(hr, "Failed to set Property: %S with path: %S", sczProperty, wzPath); - hr = WcaAddTempRecord(phTable, phColumns, L"RemoveFile", NULL, 1, 5, L"RfxFolder", wzComponent, NULL, sczProperty, iMode); + hr = WcaAddTempRecord(phTable, phColumns, L"RemoveFile", NULL, 1, 5, L"RfxFile", wzComponent, wfd.cFileName, sczProperty, iMode); ExitOnFailure(hr, "Failed to add row to remove reparse point for WixRemoveFolderEx row: %S under path: %S", wzId, wzPath); - WcaLog(LOGLEVEL::LOGMSG_STANDARD, "Path '%ls' is a symbolic link or a mounted folder. The link itself will be removed and its target will not be changed", sczNext); + WcaLog(LOGLEVEL::LOGMSG_STANDARD, "Path '%ls%ls' is a symbolic link or a mounted folder. The link itself will be removed and its target will not be changed", wzPath, wfd.cFileName); continue; }