Dmitry Timoshkov : server: FILE_OVERWRITE and FILE_OVERWRITE_IF need the FILE_WRITE_ATTRIBUTES permission .

Alexandre Julliard julliard at winehq.org
Wed Mar 30 13:15:41 CDT 2011


Module: wine
Branch: master
Commit: f834d2319738c57f9a1eebd69bca88eecb75f6a4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f834d2319738c57f9a1eebd69bca88eecb75f6a4

Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date:   Wed Mar 30 18:08:49 2011 +0900

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 4f6c7dc..ac4ff19 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 ee7202b..8cf474b 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;
     }
 




More information about the wine-cvs mailing list