2016-07-25 16:49:32 -07:00
|
|
|
From 84cdc8afb6575024f2ebab1347cfc6becf41ce06 Mon Sep 17 00:00:00 2001
|
2016-03-10 17:42:52 -08:00
|
|
|
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
|
|
|
Date: Wed, 9 Mar 2016 13:06:13 +0800
|
|
|
|
Subject: server: CreateFileMapping should not fail without SEC_COMMIT for a
|
|
|
|
named file section.
|
|
|
|
|
|
|
|
Anonymous file mapping already behaves this way.
|
|
|
|
---
|
2016-07-25 16:49:32 -07:00
|
|
|
dlls/kernel32/tests/virtual.c | 4 +---
|
2016-03-10 17:42:52 -08:00
|
|
|
server/mapping.c | 5 +++--
|
2016-07-25 16:49:32 -07:00
|
|
|
2 files changed, 4 insertions(+), 5 deletions(-)
|
2016-03-10 17:42:52 -08:00
|
|
|
|
|
|
|
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
|
2016-07-25 16:49:32 -07:00
|
|
|
index 26e5195..866d1b8 100644
|
2016-03-10 17:42:52 -08:00
|
|
|
--- a/dlls/kernel32/tests/virtual.c
|
|
|
|
+++ b/dlls/kernel32/tests/virtual.c
|
2016-07-25 16:49:32 -07:00
|
|
|
@@ -4016,9 +4016,7 @@ todo_wine
|
2016-03-10 17:42:52 -08:00
|
|
|
|
|
|
|
SetLastError(0xdeadbef);
|
|
|
|
mapping = CreateFileMappingA(file, NULL, PAGE_READONLY|SEC_RESERVE, 0, 0, NULL);
|
|
|
|
-todo_wine
|
|
|
|
ok(mapping != 0, "CreateFileMapping error %u\n", GetLastError());
|
|
|
|
- if (!mapping) goto skip1;
|
|
|
|
|
|
|
|
memset(&info, 0x55, sizeof(info));
|
|
|
|
ret = 0xdeadbeef;
|
2016-07-25 16:49:32 -07:00
|
|
|
@@ -4027,10 +4025,10 @@ todo_wine
|
2016-03-10 17:42:52 -08:00
|
|
|
ok(ret == sizeof(info.basic), "wrong returned size %u\n", ret);
|
|
|
|
ok(info.basic.BaseAddress == NULL, "expected NULL, got %p\n", info.basic.BaseAddress);
|
|
|
|
ok(info.basic.Attributes == SEC_FILE, "expected SEC_FILE, got %#x\n", info.basic.Attributes);
|
|
|
|
+todo_wine
|
|
|
|
ok(info.basic.Size.QuadPart == fsize, "expected %#lx, got %#x/%08x\n", fsize, info.basic.Size.HighPart, info.basic.Size.LowPart);
|
|
|
|
|
|
|
|
CloseHandle(mapping);
|
|
|
|
-skip1:
|
|
|
|
CloseHandle(file);
|
|
|
|
|
|
|
|
SetLastError(0xdeadbef);
|
|
|
|
diff --git a/server/mapping.c b/server/mapping.c
|
2016-07-25 16:49:32 -07:00
|
|
|
index 71c3437..c223037 100644
|
2016-03-10 17:42:52 -08:00
|
|
|
--- a/server/mapping.c
|
|
|
|
+++ b/server/mapping.c
|
2016-07-25 16:49:32 -07:00
|
|
|
@@ -529,8 +529,9 @@ static struct object *create_mapping( struct object *root, const struct unicode_
|
2016-03-10 17:42:52 -08:00
|
|
|
|
2016-07-25 16:49:32 -07:00
|
|
|
if (flags & SEC_RESERVE)
|
2016-03-10 17:42:52 -08:00
|
|
|
{
|
|
|
|
- set_error( STATUS_INVALID_PARAMETER );
|
|
|
|
- goto error;
|
|
|
|
+ if (!(mapping->committed = mem_alloc( offsetof(struct ranges, ranges[8]) ))) goto error;
|
|
|
|
+ mapping->committed->count = 0;
|
|
|
|
+ mapping->committed->max = 8;
|
|
|
|
}
|
|
|
|
if (!(file = get_file_obj( current->process, handle, access ))) goto error;
|
|
|
|
fd = get_obj_fd( (struct object *)file );
|
|
|
|
--
|
2016-07-25 16:49:32 -07:00
|
|
|
2.8.0
|
2016-03-10 17:42:52 -08:00
|
|
|
|