Let's say some application exposes a named pipe with the name "Pipe1". If I want to express the named pipe as a file path that can be used for writing or reading, the path
\\?\pipe\Pipe1 is valid and points to the named pipe.
Now for easier validation of the path (some applications may not like the
\\.\), I thought maybe a symlink could be used to point to the named pipe device. I tried creating the link via
mklink link \\.\pipe\Pipe1,
mklink link \\?\pipe\Pipe1, and also
mklink link \\?\GlobalRoot\Device\NamedPipe\Pipe1, but all of these fail when trying to open the link, with the following error:
The data present in the reparse point buffer is invalid
Does it make sense what I am trying to do? Can a symlink point to any path and not just into the file system? Is there a better way to accomplish what I am trying to do?
Strangely, I kinda remember that I was trying to solve this problem before, and the symlink worked this way, more or less. Also a symbolic link is the only usable type, creating a hard link fails (because pipe is not on an NTFS partition) and a directory link or a junction cannot be used for i/o.