alphaleonis / AlphaFS

AlphaFS is a .NET library providing more complete Win32 file system functionality to the .NET platform than the standard System.IO classes.
http://alphafs.alphaleonis.com/
MIT License
558 stars 99 forks source link

CreateJunction doesn't work when the junction target is a volume-prefixed path #516

Open rstarkov opened 5 years ago

rstarkov commented 5 years ago

When creating a junction that targets a volume path like \\?\Volume{01234000-0123-4567-abcd-0123456789ab}\Foo, the junction created doesn't work.

The output of fsutil reparsepoint query on such a broken junction is:

Print Name Length:     0
Substitute Name:       \??\\\?\Volume{01234567-89ab-cdef-0123-456789abcdef}\foo\

mklink /J creates a working junction which looks like this:

Substitute Name:       \??\Volume{01234567-89ab-cdef-0123-456789abcdef}\foo\
Print Name:            \\?\Volume{01234567-89ab-cdef-0123-456789abcdef}\foo\

Observe that the substitute name of the working junction has only the non-interpreted path prefix, without the long path prefix. Replicating this behaviour fixes the junction (see PR #517).