Boost logo

Boost :

From: David Sirovsky (david.sirovsky_at_[hidden])
Date: 2008-03-05 05:33:56

Hello All,

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
API call).

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,
. . .
DeviceIoControl( hFile, FSCTL_SET_REPARSE_POINT,
  reparseInfo->ReparseDataLength + REPARSE_MOUNTPOINT_HEADER_SIZE,
  NULL, 0, &returnedLength, NULL )
. . .

A popular free SysInternals' tool
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
file/directory, etc.

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]

Best Regards,

David Sirovsky.

Boost list run by bdawes at, gregod at, cpdaniel at, john at