Utilize reparse points for symlinks

Corinna Vinschen corinna-cygwin@cygwin.com
Sat Sep 25 18:31:00 GMT 2010

On Sep 25 09:27, Andy Koppe wrote:
> On 24 September 2010 14:16, Corinna Vinschen wrote:
> > On Sep 24 14:03, Andy Koppe wrote:
> >> On 23 September 2010 16:26, Corinna Vinschen wrote:
> >> > I experimented a bit further with reparse points, since it occured to me
> >> > that they are still an excellent method to implement symlinks on NTFS.
> >> >
> >> > What we can't do is to use the offical symlink reparse point introduced
> >> > with Windows Vista for the well-known reasons.
> >> >
> >> > However, what we *could* do is to go the official way and request a
> >> > Cygwin reparse point tag at Microsoft(*).  For testing I implemented
> >> > this method locally, using the offical REPARSE_GUID_DATA_BUFFER reserved
> >> > for 3PPs, a reparse tag 0x20007654, and a GUID I generated by using the
> >> > uuidgen tool from the Microsoft SDK.  Works fine, even as non-admin user,
> >> > unlike the native Vista symlinks.
> >> >
> >> > Why am I pursuing this at all?
> >> >
> >> > The reason is that a reparse point can be easily (read: quickly)
> >> > recognized by the DOS reparse attribute.  The reparse point content can
> >> > be read without having to use ReadFile, so the access time doesn't
> >> > change when reading it.  The reparse tag can even be recognized already
> >> > in readdir for free(**).
> >>
> >> Sounds like a good idea. I assume these still wouldn't work for
> >> non-Cygwin programs though? Could they still support them by reading
> >> them themselves (using DeviceIoControl with FSCTL_GET_REPARSE_POINT)?
> >
> > Yes, sure they could, the format will be documented.  But the POSIX
> > target path only makes sense if you know the Cygwin mount table, of
> > course.
> Yep, whereby the most awkward question would be: the mount table of
> which Cygwin?

...as with any other symlink containing a POSIX path.

> Anyways, a few more questions about these reparse
> points:
> How do they appear in Explorer? What happens if you try to open one?
> Is Explorer able to delete them? (Just wondering what complaints to
> expect.)

They appear as normal files of size 0 in explorer.  If you try to
open one, the "open with" dialog appears.  Since they are normal
files, explorer can delete them.

> Is there a useful error message when trying to execute one from cmd?
> (C:\cygwin\bin\gcc is particularly popular for that. The current
> format results in "Access is denied", which isn't great).

I get this:

  "'foo' is not recognized as an internal or external command,
  operable program or batch file.

> Finally, would it be possible to write a system-wide handler for these
> reparse points that would make them transparent to all non-Cygwin
> programs?

In theory you could write a filesystem minifilter using the IFS kit
from WDK.  However, the file contains POSIX-specific info which makes
no sense from the Win32 POV.  What is the filter supposed to do?
Searching for a Cygwin DLL and loading it?  Seaching for a fstab file
and trying to evaluate the path by itself?


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-developers mailing list