Commit 181b3cf0 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 923d582f
......@@ -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] );
......
......@@ -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) */
......
......@@ -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 },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment