Adds comment about FILE_FLAG_BACKUP_SEMANTICS use.

This commit is contained in:
Andrea Mazzoleni 2013-04-28 22:25:32 +02:00
parent 1344ae781a
commit 6e091490bb
2 changed files with 3 additions and 14 deletions

11
TODO
View file

@ -46,17 +46,6 @@ on the error message. See: https://sourceforge.net/projects/snapraid/forums/foru
* Support interrupted operations with EINTR. For remote filesystems it could be relevant.
* In Windows to use FILE_FLAG_BACKUP_SEMANTICS we should also get privileges.
See http://www.codeproject.com/Articles/21202/Reparse-Points-in-Vista.
Altought it doesn't seem necessary when used in CreateFile to just open directory.
Anyway, see this snipset found with google:
DWORD access = 0;
DWORD share = FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE;
CreateFile(path1,access,share,NULL,OPEN_EXISTING,
(GetFileAttributes(path1)&FILE_ATTRIBUTE_DIRECTORY)?FILE_FLAG_BACKUP_SEMANTICS:0,NULL);
It seems to use it *exclusively* for directory.
Is it possible that the need of lstat_ex depends on that ?
* In Windows we must be case insensitive, at least for ASCII<128 comparison. For other UTF-8 chars
is too complex.

View file

@ -648,7 +648,7 @@ int lstat_ex(const char* file, struct windows_stat* st)
/*
* Open the handle of the file.
*
* Use FILE_FLAG_BACKUP_SEMANTICS to open directories and to override the file security checks.
* Use FILE_FLAG_BACKUP_SEMANTICS to open directories (it's just ignored for files).
* Use FILE_FLAG_OPEN_REPARSE_POINT to open symbolic links and not the their target.
*/
h = CreateFileW(convert(file), 0, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0);
@ -690,7 +690,7 @@ int windows_stat(const char* file, struct windows_stat* st)
/*
* Open the handle of the file.
*
* Use FILE_FLAG_BACKUP_SEMANTICS to open directories and to override the file security checks.
* Use FILE_FLAG_BACKUP_SEMANTICS to open directories (it's just ignored for files).
*/
h = CreateFileW(convert(file), 0, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
if (h == INVALID_HANDLE_VALUE) {
@ -1015,7 +1015,7 @@ int windows_readlink(const char* file, char* buffer, size_t size)
/*
* Open the handle of the file.
*
* Use FILE_FLAG_BACKUP_SEMANTICS to open directories and to override the file security checks.
* Use FILE_FLAG_BACKUP_SEMANTICS to open directories (it's just ignored for files).
* Use FILE_FLAG_OPEN_REPARSE_POINT to open symbolic links and not the their target.
*/
h = CreateFileW(convert(file), 0, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0);