Skip to content

Commit

Permalink
Fix deleting symbolic links in WixRemoveFoldersEx
Browse files Browse the repository at this point in the history
  • Loading branch information
nirbar committed Nov 12, 2024
1 parent 9c2cbd4 commit 1230f09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/wix3-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
9 changes: 3 additions & 6 deletions src/ext/ca/wixca/dll/RemoveFoldersEx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 1230f09

Please sign in to comment.