From: David Sirovsky (david.sirovsky_at_[hidden])
Date: 2008-03-05 05:33:56
As far as I understand Boost.Filesystem assumes that there is no symbolic
link support in Windows (is_symlink() always returns false, it is
impossible to create, etc.), but only hardlinks (using the CreateHardLink
As you probably know, symlinks have been introduced in Vista (NTFS only):
the API now includes CreateSymbolicLink and a user is able to create
symlinks using mklink and see them using dir. [
However, creating fully functional symbolic links was quite possible already
in Windows 2000 on NTFS drives - using junction reparse points. [
A junction is created with 2 main API calls:
hFile = CreateFile( LinkDirectory, GENERIC_WRITE, 0,
FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL );
. . .
DeviceIoControl( hFile, FSCTL_SET_REPARSE_POINT,
reparseInfo->ReparseDataLength + REPARSE_MOUNTPOINT_HEADER_SIZE,
NULL, 0, &returnedLength, NULL )
. . .
A popular free SysInternals'
is usually used to create/list junctions in Win2000, XP, Vista. Its
source-code can be found here:
[At the Web-Archive, as the source-code has not yet been officially
re-released by Microsoft since SysInternals migration to Technet]
(There is also another pre-Vista tool - the Microsoft's
As far as I understand, junctions behave similar to symbolic links - they
point to specific "real" locations not only on the same drive, they can be
deleted without deleting the target, they still point to already deleted
They are even in formal use in Windows Vista: for example, "Documents and
Settings" is no longer a directory but a junction pointing to some newly
introduced user folder; junctions are supported in the mklink tool and are
shown using dir.
Maybe it is worth considering to introduce Windows NTFS symlinks support in
Boost.FileSystem - a straightforward approach would be to use new symbolic
link API for Vista target build and junctions for 2000 and XP.
[I am sorry if this subject has already been discussed - I have not found
any posts on it]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk