[RFD]: GetFileAttributes and W2K
Mon May 22 14:50:00 GMT 2000
I want to start a discussion because of what I read in MSDN
When GetFileAttributes is called on a directory
containing a volume mount point, the file attributes
returned are those of the directory where the volume
mount point is set, not those of the root directory
in the target mounted volume. To obtain the file
attributes of the mounted volume, call
GetVolumeNameForVolumeMountPoint to obtain the name
of the target volume. Then use the resulting name
in a call to GetFileAttributes. The result will be the
attributes of the root directory on the target volume.
This has the side effect in Cygwin that the usage of
GetFileAttributes in nearly all functions in Cygwin should be
replaced by a new function call (eg. cygwin_get_file_attributes)
with that function sth. like that:
cygwin_get_file_attributes(const char *name)
attr = GetFileAttributes(name);
if (attr != -1 && attr & DIRECTORY && attr & REPARSE_POINT)
newname = GetVolumeNameForVolumeMountPoint(name);
attr = GetFileAttributes(newname);
Other problems are fhandler_disk_file::fstat() and stat_worker().
In both cases the handle to the wrong directory is opened. In
both cases we would need the new win32 name for further investigation.
Because all that would be too complicated (too many source
to change) I would like to suggest that we change path_conv
according to the above:
If the input file name is the cygwin name of a directory
which has a volume mounted to it, path_conv should return
the name of the mounted volume as w32 name.
Moreover some additions to w32api would be needed for W2K...
More information about the Cygwin-developers