|
Boost : |
From: Jeremy Maitin-Shepard (jbms_at_[hidden])
Date: 2003-11-25 14:32:14
"Bronek Kozicki" <brok_at_[hidden]> writes:
> Victor A. Wagner, Jr. <vawjr_at_[hidden]> wrote:
>> There _is_ a mechanism for creating hard links to directories on
>> NTFS. I don't know what the relevant runtime calls are, but I have a
>> utility that creates them. When you do a dir on a directory which
> the same mechanism can be used to create hard links to files on NTFS.
> This mechanism is called "reparse points". You can create hard links
> with DeviceIoControl (Win32 Storage API) function called with control
> code FSCTL_SET_REPARSE_POINT. Another code FSCTL_GET_REPARSE_POINT can
> be used to query for hard links. It's documented here:
> http://msdn.microsoft.com/library/en-us/fileio/base/hard_links_and_junctions.asp
> http://msdn.microsoft.com/library/en-us/fileio/base/reparse_points.asp
> http://msdn.microsoft.com/library/en-us/fileio/base/file_systems_control_codes.asp
> Simple utility for managing junctions (directory hard links) is
> available here, with source:
> http://www.sysinternals.com/ntw2k/source/misc.shtml#junction
AFAIK, junctions are not like POSIX hard links because they do not
involve a reference count, and can refer to directories on other
filesystems. Thus, they are like (absolute-path) symbolic links. The
real question, I suppose, is whether NTFS supports these "junctions" or
symbolic links to files in addition to directories. I am guessing the
answer in no, and in any case the filesystem library could simply throw
an exception if the user attempted to create a file symbolic link on
NTFS.
(Note that the hard links created by CreateHardLink and BackupWrite
_are_ like POSIX hard links, but these can only be used on files, not
directories.)
-- Jeremy Maitin-Shepard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk