Commit ef716e9d authored by Alexandre Julliard's avatar Alexandre Julliard

server: Don't grow the mapped file for read-only mappings.

parent 32c7153f
......@@ -1014,9 +1014,7 @@ static void test_MapViewOfFile(void)
map_size.QuadPart = 0x3457;
status = pNtCreateSection( &mapping, SECTION_QUERY | SECTION_MAP_READ, NULL,
&map_size, PAGE_READONLY, SEC_COMMIT, file );
todo_wine
ok( status == STATUS_SECTION_TOO_BIG, "NtCreateSection failed %x\n", status );
if (!status) CloseHandle( mapping );
status = pNtCreateSection( &mapping, SECTION_QUERY | SECTION_MAP_READ, NULL,
&map_size, PAGE_READONLY, SEC_IMAGE, file );
ok( status == STATUS_INVALID_IMAGE_NOT_MZ, "NtCreateSection failed %x\n", status );
......
......@@ -574,7 +574,15 @@ static struct object *create_mapping( struct object *root, const struct unicode_
goto error;
}
}
else if (st.st_size < mapping->size && !grow_file( unix_fd, mapping->size )) goto error;
else if (st.st_size < mapping->size)
{
if (!(access & FILE_WRITE_DATA))
{
set_error( STATUS_SECTION_TOO_BIG );
goto error;
}
if (!grow_file( unix_fd, mapping->size )) goto error;
}
}
else /* Anonymous mapping (no associated file) */
{
......
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