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

This commit is contained in:
Alexandre Julliard 2009-11-23 17:29:14 +01:00
parent 923d582f07
commit 181b3cf07f
3 changed files with 4 additions and 1 deletions

View File

@ -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] );

View File

@ -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) */

View File

@ -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 },