From f834d2319738c57f9a1eebd69bca88eecb75f6a4 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Wed, 30 Mar 2011 18:08:49 +0900 Subject: [PATCH] server: FILE_OVERWRITE and FILE_OVERWRITE_IF need the FILE_WRITE_ATTRIBUTES permission. --- dlls/ntdll/tests/file.c | 14 -------------- server/file.c | 4 +++- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 4f6c7dc9335..ac4ff19cdfc 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -1609,20 +1609,6 @@ static void test_NtCreateFile(void) td[i].attrib_in, FILE_SHARE_READ|FILE_SHARE_WRITE, td[i].disposition, 0, NULL, 0); - /* FIXME: completely remove once Wine is fixed */ - if (td[i].status == STATUS_ACCESS_DENIED) - { - todo_wine - ok(status == td[i].status, "%d: expected %#x got %#x\n", i, td[i].status, status); - CloseHandle(handle); - SetFileAttributesW(path, FILE_ATTRIBUTE_ARCHIVE); - - if (td[i].needs_cleanup) - DeleteFileW(path); - - continue; - } - ok(status == td[i].status, "%d: expected %#x got %#x\n", i, td[i].status, status); if (!status) diff --git a/server/file.c b/server/file.c index ee7202b990a..8cf474bd797 100644 --- a/server/file.c +++ b/server/file.c @@ -179,10 +179,12 @@ static struct object *create_file( struct fd *root, const char *nameptr, data_si { case FILE_CREATE: flags = O_CREAT | O_EXCL; break; case FILE_OVERWRITE_IF: /* FIXME: the difference is whether we trash existing attr or not */ + access |= FILE_WRITE_ATTRIBUTES; case FILE_SUPERSEDE: flags = O_CREAT | O_TRUNC; break; case FILE_OPEN: flags = 0; break; case FILE_OPEN_IF: flags = O_CREAT; break; - case FILE_OVERWRITE: flags = O_TRUNC; break; + case FILE_OVERWRITE: flags = O_TRUNC; + access |= FILE_WRITE_ATTRIBUTES; break; default: set_error( STATUS_INVALID_PARAMETER ); goto done; } -- 2.11.4.GIT