Alexandre Julliard : server: Implement the file sharing check for delete on close with an existing image mapping .

Alexandre Julliard julliard at winehq.org
Tue Nov 24 12:40:20 CST 2009


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Nov 23 17:29:14 2009 +0100

server: Implement the file sharing check for delete on close with an existing image mapping.

---

 dlls/kernel32/tests/file.c |    2 +-
 server/fd.c                |    2 ++
 server/trace.c             |    1 +
 3 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index 35ca3c6..3d0e258 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -1872,7 +1872,7 @@ static void test_file_sharing(void)
             ok( h2 == INVALID_HANDLE_VALUE, "create succeeded for map %x\n", mapping_modes[a1] );
             ok( ret == ERROR_SHARING_VIOLATION, "wrong error code %d for %x\n", ret, mapping_modes[a1] );
         }
-        else if (mapping_modes[a1] & SEC_IMAGE) todo_wine
+        else if (mapping_modes[a1] & SEC_IMAGE)
         {
             ok( h2 == INVALID_HANDLE_VALUE, "create succeeded for map %x\n", mapping_modes[a1] );
             ok( ret == ERROR_ACCESS_DENIED, "wrong error code %d for %x\n", ret, mapping_modes[a1] );
diff --git a/server/fd.c b/server/fd.c
index ee1a9d3..9d2ac9d 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1577,6 +1577,8 @@ static unsigned int check_sharing( struct fd *fd, unsigned int access, unsigned
     if (((existing_access & FILE_MAPPING_WRITE) && !(sharing & FILE_SHARE_WRITE)) ||
         ((existing_access & FILE_MAPPING_IMAGE) && (access & FILE_SHARE_WRITE)))
         return STATUS_SHARING_VIOLATION;
+    if ((existing_access & FILE_MAPPING_IMAGE) && (options & FILE_DELETE_ON_CLOSE))
+        return STATUS_CANNOT_DELETE;
     if ((existing_access & FILE_MAPPING_ACCESS) && (open_flags & O_TRUNC))
         return STATUS_USER_MAPPED_FILE;
     if (!access) return 0;  /* if access mode is 0, sharing mode is ignored (except for mappings) */
diff --git a/server/trace.c b/server/trace.c
index 6c503f9..6cb4cc9 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -4555,6 +4555,7 @@ static const struct
     { "BUFFER_OVERFLOW",             STATUS_BUFFER_OVERFLOW },
     { "BUFFER_TOO_SMALL",            STATUS_BUFFER_TOO_SMALL },
     { "CANCELLED",                   STATUS_CANCELLED },
+    { "CANNOT_DELETE",               STATUS_CANNOT_DELETE },
     { "CANT_OPEN_ANONYMOUS",         STATUS_CANT_OPEN_ANONYMOUS },
     { "CHILD_MUST_BE_VOLATILE",      STATUS_CHILD_MUST_BE_VOLATILE },
     { "DEBUGGER_INACTIVE",           STATUS_DEBUGGER_INACTIVE },




More information about the wine-cvs mailing list