Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
7d93250
Add mount point support to link APIs.
carlossanlop Aug 24, 2021
6f32d5a
Add junction and virtual drive tests.
carlossanlop Aug 24, 2021
51b069f
Move PrintName comment outside of if else of reparseTag check.
carlossanlop Aug 24, 2021
c88890f
Add Windows platform specific attribute to junction and virtual drive…
carlossanlop Aug 24, 2021
347da63
Revert FILE_NAME_OPENED to FILE_NAME_NORMALIZED
carlossanlop Aug 24, 2021
7ea3244
Revert addition of FILE_NAME_OPENED const.
carlossanlop Aug 24, 2021
8c96883
Remove unnecessary enumeration junction test.
carlossanlop Aug 25, 2021
3c3ac16
Rename GetNewCwdPath to ChangeCurrentDirectory
carlossanlop Aug 25, 2021
696c67b
Make Junction_ResolveLinkTarget a theory and test both resolveFinalTa…
carlossanlop Aug 25, 2021
10d7656
Shorter name for targetPath string. Typo in comment. Fix Debug.Assert.
carlossanlop Aug 25, 2021
a4642c6
Clarify test comment. Change PlatformDetection for OperatingSystem ch…
carlossanlop Aug 25, 2021
28b4138
Cleaner unit tests for virtual drive, add indirection test
carlossanlop Aug 26, 2021
5a122a3
Skip virtual drive tests in Windows Nano (subst not available). Small…
carlossanlop Aug 26, 2021
4e27fa0
Simplify Junctions tests, add indirection test
carlossanlop Aug 26, 2021
00d3227
Address test suggestions.
carlossanlop Aug 26, 2021
a1e45b1
Revert MountHelper.CreateSymbolicLink changes. Unrelated, and will be…
carlossanlop Aug 27, 2021
22ee205
Add dwReserved0 check for mount points in GetFinalLinkTarget.
carlossanlop Aug 27, 2021
628b96f
Use Yoda we don't.
carlossanlop Aug 27, 2021
128a333
Fix CI issues
jozkee Aug 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Shorter name for targetPath string. Typo in comment. Fix Debug.Assert.
  • Loading branch information
carlossanlop authored and github-actions committed Aug 27, 2021
commit 10d76569ab8b278533b394ef3c822eab90c02e61
Original file line number Diff line number Diff line change
Expand Up @@ -514,16 +514,16 @@ internal static void CreateSymbolicLink(string path, string pathToTarget, bool i
int printNameOffset = sizeof(Interop.Kernel32.SymbolicLinkReparseBuffer) + rbSymlink.PrintNameOffset;
int printNameLength = rbSymlink.PrintNameLength;

Span<char> targetPathSymlink = MemoryMarshal.Cast<byte, char>(bufferSpan.Slice(printNameOffset, printNameLength));
Debug.Assert((rbSymlink.Flags & Interop.Kernel32.SYMLINK_FLAG_RELATIVE) == 0 || !PathInternal.IsExtended(targetPathSymlink));
Span<char> targetPath = MemoryMarshal.Cast<byte, char>(bufferSpan.Slice(printNameOffset, printNameLength));
Debug.Assert((rbSymlink.Flags & Interop.Kernel32.SYMLINK_FLAG_RELATIVE) == 0 || !PathInternal.IsExtended(targetPath));

if (returnFullPath && (rbSymlink.Flags & Interop.Kernel32.SYMLINK_FLAG_RELATIVE) != 0)
{
// Target path is relative and is for ResolveLinkTarget(), we need to append the link directory.
return Path.Join(Path.GetDirectoryName(linkPath.AsSpan()), targetPathSymlink);
return Path.Join(Path.GetDirectoryName(linkPath.AsSpan()), targetPath);
}

return targetPathSymlink.ToString();
return targetPath.ToString();
}
else if (rbSymlink.ReparseTag == Interop.Kernel32.IOReparseOptions.IO_REPARSE_TAG_MOUNT_POINT)
{
Expand All @@ -533,11 +533,11 @@ internal static void CreateSymbolicLink(string path, string pathToTarget, bool i
int printNameOffset = sizeof(Interop.Kernel32.MountPointReparseBuffer) + rbMountPoint.PrintNameOffset;
int printNameLength = rbMountPoint.PrintNameLength;

Span<char> targetPathMountPoint = MemoryMarshal.Cast<byte, char>(bufferSpan.Slice(printNameOffset, printNameLength));
Span<char> targetPath = MemoryMarshal.Cast<byte, char>(bufferSpan.Slice(printNameOffset, printNameLength));

// Unlink symlinks, mount point paths cannot be relative
Debug.Assert(!PathInternal.IsExtended(targetPathMountPoint));
return targetPathMountPoint.ToString();
// Unlike symlinks, mount point paths cannot be relative
Debug.Assert(!PathInternal.IsPartiallyQualified(targetPath));
return targetPath.ToString();
}

return null;
Expand Down