You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If on Windows, one process has an open file handle to a file without FILE_SHARE_READ, trying to create a handle with GENERIC_READ in another process fails.
This means that creation_time, last_write_time fail with ERROR_SHARING_VIOLATION.
This regression was introduced in 1db4474 with this comment in the commit message:
Also, use GENERIC_READ access mode when we call GetFileTime on the handle
afterwards. GetFileTime documentation explicitly mentions that GENERIC_READ
is required for it.
While it is true that the GetFileTime documentation mentions this, this is obviously a bug in the documentation. Until boost 1.79, a value of 0 was passed for the dwDesiredAccess parameter, which apparently worked just fine and is also documented to work in the CreateFileW documentation:
If this parameter is zero, the application can query certain metadata such as file, directory, or device attributes without accessing that file or device, even if GENERIC_READ access would have been denied.
To fix this, the dwDesiredAccess parameter changes in creation_time and last_write_time need to be reverted, either to FILE_READ_ATTRIBUTES or to 0.
The text was updated successfully, but these errors were encountered:
The thing is apparently these access modes are handled separately by each and every filesystem. What works on NTFS may not work on SMB or FAT or any other third party filesystem driver. The commit you referenced works around precisely such discrepancy in behavior. In a mess like this, at least following the documentation is the most reasonable way to go.
Re. CreateFileW, it only mentions file attributes. I do not think file times are considered as attributes.
If on Windows, one process has an open file handle to a file without
FILE_SHARE_READ
, trying to create a handle withGENERIC_READ
in another process fails.This means that
creation_time
,last_write_time
fail withERROR_SHARING_VIOLATION
.This regression was introduced in 1db4474 with this comment in the commit message:
While it is true that the
GetFileTime
documentation mentions this, this is obviously a bug in the documentation. Until boost 1.79, a value of0
was passed for thedwDesiredAccess
parameter, which apparently worked just fine and is also documented to work in the CreateFileW documentation:To fix this, the
dwDesiredAccess
parameter changes increation_time
andlast_write_time
need to be reverted, either toFILE_READ_ATTRIBUTES
or to0
.The text was updated successfully, but these errors were encountered: