Rebase against 917e86dd7a4cca1da47262caaded2bef9e022f99.

This commit is contained in:
Sebastian Lackner
2017-09-09 00:10:28 +02:00
parent 36f5d4da6c
commit f85692946e
10 changed files with 23 additions and 623 deletions

View File

@@ -1,14 +1,14 @@
From 9b893a6f231547a99090342749bc60ae58d02272 Mon Sep 17 00:00:00 2001
From f4e45bfd295d4d8d8312502d367c648575a36f46 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Thu, 16 Oct 2014 23:26:35 +0200
Subject: kernel32/tests: Add tests for NtQuerySection. (try 2)
---
dlls/kernel32/tests/virtual.c | 248 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 248 insertions(+)
dlls/kernel32/tests/virtual.c | 245 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 245 insertions(+)
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index 583abf6..3d60557 100644
index 9b994645bc5..5191d6ce9b0 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -56,6 +56,23 @@ static NTSTATUS (WINAPI *pNtFreeVirtualMemory)(HANDLE, PVOID *, SIZE_T *, ULONG)
@@ -35,7 +35,7 @@ index 583abf6..3d60557 100644
static HANDLE create_target_process(const char *arg)
{
char **argv;
@@ -3845,6 +3862,236 @@ static void test_shared_memory_ro(BOOL is_child, DWORD child_access)
@@ -4143,6 +4160,233 @@ static void test_shared_memory_ro(BOOL is_child, DWORD child_access)
CloseHandle(mapping);
}
@@ -207,9 +207,7 @@ index 583abf6..3d60557 100644
+
+ 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;
@@ -221,7 +219,6 @@ index 583abf6..3d60557 100644
+ 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);
@@ -272,7 +269,7 @@ index 583abf6..3d60557 100644
START_TEST(virtual)
{
int argc;
@@ -3908,6 +4155,7 @@ START_TEST(virtual)
@@ -4206,6 +4450,7 @@ START_TEST(virtual)
test_shared_memory_ro(FALSE, FILE_MAP_COPY);
test_shared_memory_ro(FALSE, FILE_MAP_COPY|FILE_MAP_WRITE);
test_mapping();
@@ -281,5 +278,5 @@ index 583abf6..3d60557 100644
test_VirtualAlloc_protection();
test_VirtualProtect();
--
2.8.0
2.14.1

View File

@@ -1,53 +0,0 @@
From a02d5eb0b87c5358e2431cd3c96e76f20bb51e88 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 | 3 ---
server/mapping.c | 5 +++--
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index 3d60557..c6e7ebe 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -4030,9 +4030,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;
@@ -4044,7 +4042,6 @@ 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 b68f281..1f18c5c 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -533,8 +533,9 @@ static struct object *create_mapping( struct object *root, const struct unicode_
if (flags & SEC_RESERVE)
{
- 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.8.0