does anyone know how to check if a file or directory is either a Symbolic Link, Junction Point, Mount Point or Hard Link?
As far as I know a symbolic links are detected by checking a file for its "ReparsePoint" attribute. Junction points are detected by checking a directory for the "ReparsePoint" attribute. So if the "ReparsePoint" attribute is set on a file it must be a symbolic link, otherwise if it's set on a directory it can only be a junction point...right?
Good so far, but I have still no idea how to detect "Mount Points" and "Hard Links". Can anyone tell me how to do this?
Symbolic Links, Junction Points, and Mount Points are all examples of different reparse points. Hard Links, however, are just regular files. On NTFS all files are hard links. You can detect that a file has multiple hard links pointing to it, but there's no "real file" that it points to. You can think of hard links as just different names for the same file.
Here's some information on accessing reparse points from C#: http://www.codeproject.com/KB/vista/ReparsePointID.aspx?display=Print
Here's some information on how to do it in C: http://blog.kalmbach-software.de/2008/02/