wine-staging/patches/ntdll-NtQuerySection/0003-server-CreateFileMapping-should-not-fail-without-SEC.patch

60 lines
2.2 KiB
Diff

From e25dd58ca9b187745ddfb4b8eb10cbcef24992de Mon Sep 17 00:00:00 2001
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.
---
dlls/kernel32/tests/virtual.c | 5 ++---
server/mapping.c | 5 +++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index 10e72b2..6d25b5f 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -3961,9 +3961,7 @@ todo_wine
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;
@@ -3971,11 +3969,12 @@ todo_wine
ok(status == STATUS_SUCCESS, "NtQuerySection error %#x\n", status);
ok(ret == sizeof(info.basic), "wrong returned size %u\n", ret);
ok(info.basic.BaseAddress == NULL, "expected NULL, got %p\n", info.basic.BaseAddress);
+todo_wine
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
index ec0ef98..aa38193 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -539,8 +539,9 @@ static struct object *create_mapping( struct object *root, const struct unicode_
if (!(protect & VPROT_COMMITTED))
{
- 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 );
--
2.7.1