Rebase against b54a8dda844a1a43d1dff22eff0ea206be5c630c.

[d3dx9_36-D3DXDisassembleShader]
Removed patch to implement d3dx9_36.D3DXCreateTextureShader with stub interface
(accepted upstream).

[ntdll-NtQuerySection]
Partially removed patches to implement NtQuerySection (fixed upstream).
This commit is contained in:
Sebastian Lackner
2016-07-26 01:49:32 +02:00
parent e7778c5622
commit 104c5b24f1
12 changed files with 53 additions and 795 deletions

View File

@@ -1,292 +0,0 @@
From 11aafdc465774d1b89836aa681f4af8b2bc85407 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Thu, 16 Oct 2014 23:24:37 +0200
Subject: ntdll: Implement NtQuerySection. (try 2)
Some small modifications by Sebastian Lackner <sebastian@fds-team.de>
---
dlls/ntdll/nt.c | 19 --------
dlls/ntdll/ntdll.spec | 4 +-
dlls/ntdll/virtual.c | 95 +++++++++++++++++++++++++++++++++++++
dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +-
server/mapping.c | 42 ++++++++++++++++
server/protocol.def | 7 +++
6 files changed, 147 insertions(+), 22 deletions(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 47d7b31..f4d77a4 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -646,25 +646,6 @@ NTSTATUS WINAPI NtPrivilegeCheck(
}
/*
- * Section
- */
-
-/******************************************************************************
- * NtQuerySection [NTDLL.@]
- */
-NTSTATUS WINAPI NtQuerySection(
- IN HANDLE SectionHandle,
- IN SECTION_INFORMATION_CLASS SectionInformationClass,
- OUT PVOID SectionInformation,
- IN ULONG Length,
- OUT PULONG ResultLength)
-{
- FIXME("(%p,%d,%p,0x%08x,%p) stub!\n",
- SectionHandle,SectionInformationClass,SectionInformation,Length,ResultLength);
- return 0;
-}
-
-/*
* ports
*/
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 0a68144..c69934f 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -269,7 +269,7 @@
@ stdcall NtQueryPerformanceCounter(ptr ptr)
# @ stub NtQueryPortInformationProcess
# @ stub NtQueryQuotaInformationFile
-@ stdcall NtQuerySection (long long long long long)
+@ stdcall NtQuerySection(long long ptr long ptr)
@ stdcall NtQuerySecurityObject (long long long long long)
@ stdcall NtQuerySemaphore (long long ptr long ptr)
@ stdcall NtQuerySymbolicLinkObject(long ptr ptr)
@@ -1190,7 +1190,7 @@
@ stdcall ZwQueryPerformanceCounter(ptr ptr) NtQueryPerformanceCounter
# @ stub ZwQueryPortInformationProcess
# @ stub ZwQueryQuotaInformationFile
-@ stdcall ZwQuerySection (long long long long long) NtQuerySection
+@ stdcall ZwQuerySection(long long ptr long ptr) NtQuerySection
@ stdcall ZwQuerySecurityObject (long long long long long) NtQuerySecurityObject
@ stdcall ZwQuerySemaphore(long long ptr long ptr) NtQuerySemaphore
@ stdcall ZwQuerySymbolicLinkObject(long ptr ptr) NtQuerySymbolicLinkObject
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 5c43d26..4f0e711 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -2517,6 +2517,101 @@ NTSTATUS WINAPI NtOpenSection( HANDLE *handle, ACCESS_MASK access, const OBJECT_
/***********************************************************************
+ * NtQuerySection (NTDLL.@)
+ */
+NTSTATUS WINAPI NtQuerySection( HANDLE handle, SECTION_INFORMATION_CLASS info_class,
+ PVOID buffer, ULONG len, PULONG ret_len )
+{
+ HANDLE dup_mapping, shared_file;
+ unsigned protect;
+ LARGE_INTEGER size;
+ void *entry;
+ short machine, subsystem;
+ short major_subsystem, minor_subsystem;
+ short characteristics, dll_characteristics;
+ NTSTATUS res;
+
+ if (info_class == SectionBasicInformation)
+ {
+ if (len < sizeof(SECTION_BASIC_INFORMATION))
+ return STATUS_INFO_LENGTH_MISMATCH;
+ }
+ else if (info_class == SectionImageInformation)
+ {
+ if (len < sizeof(SECTION_IMAGE_INFORMATION))
+ return STATUS_INFO_LENGTH_MISMATCH;
+ }
+ else
+ {
+ FIXME("%p,info_class=%d,%p,%u,%p) Unknown information class\n",
+ handle, info_class, buffer, len, ret_len);
+ return STATUS_INVALID_INFO_CLASS;
+ }
+
+ if (!buffer) return STATUS_ACCESS_VIOLATION;
+
+ SERVER_START_REQ( get_mapping_info )
+ {
+ req->handle = wine_server_obj_handle( handle );
+ req->access = SECTION_QUERY;
+ res = wine_server_call( req );
+ protect = reply->protect;
+ size.QuadPart = reply->size;
+ dup_mapping = wine_server_ptr_handle( reply->mapping );
+ shared_file = wine_server_ptr_handle( reply->shared_file );
+ entry = wine_server_get_ptr( reply->entry );
+ subsystem = reply->subsystem;
+ major_subsystem = reply->major_subsystem;
+ minor_subsystem = reply->minor_subsystem;
+ characteristics = reply->characteristics;
+ dll_characteristics = reply->dll_characteristics;
+ machine = reply->machine;
+ }
+ SERVER_END_REQ;
+ if (res) return res;
+
+ if (dup_mapping) close_handle( dup_mapping );
+ if (shared_file) close_handle( shared_file );
+
+ if (info_class == SectionBasicInformation)
+ {
+ SECTION_BASIC_INFORMATION *info = buffer;
+
+ info->BaseAddress = NULL;
+ info->Size = size;
+ info->Attributes = (protect & VPROT_COMMITTED) ? SEC_COMMIT : SEC_RESERVE;
+ if (protect & VPROT_NOCACHE) info->Attributes |= SEC_NOCACHE;
+ if (protect & VPROT_IMAGE) info->Attributes |= SEC_IMAGE;
+ /* FIXME: SEC_FILE */
+ if (ret_len) *ret_len = sizeof(*info);
+ }
+ else
+ {
+ SECTION_IMAGE_INFORMATION *info = buffer;
+
+ if (!(protect & VPROT_IMAGE))
+ return STATUS_SECTION_NOT_IMAGE;
+
+ memset( info, 0, sizeof(*info) );
+ info->TransferAddress = entry;
+ info->ZeroBits = 0; /* FIXME */
+ info->MaximumStackSize = 0; /* FIXME */
+ info->CommittedStackSize = 0; /* FIXME */
+ info->SubSystemType = subsystem;
+ info->SubsystemVersionHigh = major_subsystem;
+ info->SubsystemVersionLow = minor_subsystem;
+ info->ImageCharacteristics = characteristics;
+ info->DllCharacteristics = dll_characteristics;
+ info->Machine = machine;
+ info->ImageContainsCode = TRUE; /* FIXME */
+ if (ret_len) *ret_len = sizeof(*info);
+ }
+
+ return STATUS_SUCCESS;
+}
+
+
+/***********************************************************************
* NtMapViewOfSection (NTDLL.@)
* ZwMapViewOfSection (NTDLL.@)
*/
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
index b688a3f..0c94d8e 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
@@ -1351,7 +1351,7 @@
@ stdcall ZwQueryInstallUILanguage(ptr) ntdll.ZwQueryInstallUILanguage
@ stdcall ZwQueryKey(long long ptr long ptr) ntdll.ZwQueryKey
@ stdcall ZwQueryObject(long long long long long) ntdll.ZwQueryObject
-@ stdcall ZwQuerySection(long long long long long) ntdll.ZwQuerySection
+@ stdcall ZwQuerySection(long long ptr long ptr) ntdll.ZwQuerySection
@ stdcall ZwQuerySecurityObject(long long long long long) ntdll.ZwQuerySecurityObject
@ stdcall ZwQuerySymbolicLinkObject(long ptr ptr) ntdll.ZwQuerySymbolicLinkObject
@ stdcall ZwQuerySystemInformation(long long long long) ntdll.ZwQuerySystemInformation
diff --git a/server/mapping.c b/server/mapping.c
index fe30450..ec0ef98 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -64,6 +64,15 @@ struct mapping
enum cpu_type cpu; /* client CPU (for PE image mapping) */
int header_size; /* size of headers (for PE image mapping) */
client_ptr_t base; /* default base addr (for PE image mapping) */
+ client_ptr_t entry; /* entry point addr (for PE image mapping) */
+ mem_size_t stack_reserve; /* stack reserve (for PE image mapping) */
+ mem_size_t stack_commit; /* stack commit (for PE image mapping) */
+ int subsystem; /* subsystem (for PE image mapping) */
+ int major_subsystem; /* major subsystem version (for PE image mapping) */
+ int minor_subsystem; /* minor subsystem version (for PE image mapping) */
+ int characteristics; /* image characteristics (for PE image mapping) */
+ int dll_characteristics; /* dll characteristics (for PE image mapping) */
+ int machine; /* image machine type (for PE image mapping) */
struct ranges *committed; /* list of committed ranges in this mapping */
struct file *shared_file; /* temp file for shared PE mapping */
struct list shared_entry; /* entry in global shared PE mappings list */
@@ -434,17 +443,34 @@ static unsigned int get_image_params( struct mapping *mapping, int unix_fd, int
return STATUS_INVALID_IMAGE_FORMAT;
}
+ mapping->characteristics = nt.FileHeader.Characteristics;
+ mapping->machine = nt.FileHeader.Machine;
+
switch (nt.opt.hdr32.Magic)
{
case IMAGE_NT_OPTIONAL_HDR32_MAGIC:
mapping->size = ROUND_SIZE( nt.opt.hdr32.SizeOfImage );
mapping->base = nt.opt.hdr32.ImageBase;
mapping->header_size = nt.opt.hdr32.SizeOfHeaders;
+ mapping->entry = mapping->base + nt.opt.hdr32.AddressOfEntryPoint;
+ mapping->stack_reserve = nt.opt.hdr32.SizeOfStackReserve;
+ mapping->stack_commit = nt.opt.hdr32.SizeOfStackCommit;
+ mapping->subsystem = nt.opt.hdr32.Subsystem;
+ mapping->major_subsystem = nt.opt.hdr32.MajorSubsystemVersion;
+ mapping->minor_subsystem = nt.opt.hdr32.MinorSubsystemVersion;
+ mapping->dll_characteristics = nt.opt.hdr32.DllCharacteristics;
break;
case IMAGE_NT_OPTIONAL_HDR64_MAGIC:
mapping->size = ROUND_SIZE( nt.opt.hdr64.SizeOfImage );
mapping->base = nt.opt.hdr64.ImageBase;
mapping->header_size = nt.opt.hdr64.SizeOfHeaders;
+ mapping->entry = mapping->base + nt.opt.hdr64.AddressOfEntryPoint;
+ mapping->stack_reserve = nt.opt.hdr64.SizeOfStackReserve;
+ mapping->stack_commit = nt.opt.hdr64.SizeOfStackCommit;
+ mapping->subsystem = nt.opt.hdr64.Subsystem;
+ mapping->major_subsystem = nt.opt.hdr64.MajorSubsystemVersion;
+ mapping->minor_subsystem = nt.opt.hdr64.MinorSubsystemVersion;
+ mapping->dll_characteristics = nt.opt.hdr64.DllCharacteristics;
break;
}
@@ -490,6 +516,15 @@ static struct object *create_mapping( struct object *root, const struct unicode_
mapping->header_size = 0;
mapping->base = 0;
+ mapping->entry = 0;
+ mapping->stack_reserve = 0;
+ mapping->stack_commit = 0;
+ mapping->subsystem = 0;
+ mapping->major_subsystem = 0;
+ mapping->minor_subsystem = 0;
+ mapping->characteristics = 0;
+ mapping->dll_characteristics = 0;
+ mapping->machine = 0;
mapping->fd = NULL;
mapping->shared_file = NULL;
mapping->committed = NULL;
@@ -706,6 +741,13 @@ DECL_HANDLER(get_mapping_info)
reply->protect = mapping->protect;
reply->header_size = mapping->header_size;
reply->base = mapping->base;
+ reply->entry = mapping->entry;
+ reply->subsystem = mapping->subsystem;
+ reply->major_subsystem = mapping->major_subsystem;
+ reply->minor_subsystem = mapping->minor_subsystem;
+ reply->characteristics = mapping->characteristics;
+ reply->dll_characteristics = mapping->dll_characteristics;
+ reply->machine = mapping->machine;
reply->shared_file = 0;
if ((fd = get_obj_fd( &mapping->obj )))
{
diff --git a/server/protocol.def b/server/protocol.def
index a5a45eb..fdc07a3 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -1675,6 +1675,13 @@ enum char_info_mode
int protect; /* protection flags */
int header_size; /* header size (for VPROT_IMAGE mapping) */
client_ptr_t base; /* default base addr (for VPROT_IMAGE mapping) */
+ client_ptr_t entry; /* entry point addr (for PE image mapping) */
+ short int subsystem; /* subsystem (for PE image mapping) */
+ short int major_subsystem; /* major subsystem version (for PE image mapping) */
+ short int minor_subsystem; /* minor subsystem version (for PE image mapping) */
+ short int characteristics; /* image characteristics (for PE image mapping) */
+ short int dll_characteristics; /* dll characteristics (for PE image mapping) */
+ short int machine; /* image machine type (for PE image mapping) */
obj_handle_t mapping; /* duplicate mapping handle unless removable */
obj_handle_t shared_file; /* shared mapping file handle */
@END
--
2.8.0

View File

@@ -1,24 +1,17 @@
From f781fe643462f94c07cef57b28403ab6a3b5348a Mon Sep 17 00:00:00 2001
From b28aedb793ed3367b42906a19da394d4e8b93753 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 | 258 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 258 insertions(+)
dlls/kernel32/tests/virtual.c | 251 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 251 insertions(+)
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index 5503e25..fb8d598 100644
index 40b1bc9..26e5195 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -47,12 +47,30 @@ static PVOID (WINAPI *pRtlAddVectoredExceptionHandler)(ULONG, PVECTORED_EXCEPTI
static ULONG (WINAPI *pRtlRemoveVectoredExceptionHandler)(PVOID);
static BOOL (WINAPI *pGetProcessDEPPolicy)(HANDLE, LPDWORD, PBOOL);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
+static NTSTATUS (WINAPI *pNtQuerySection)(HANDLE, int, PVOID, ULONG, PULONG);
static NTSTATUS (WINAPI *pNtProtectVirtualMemory)(HANDLE, PVOID *, SIZE_T *, ULONG, ULONG *);
static NTSTATUS (WINAPI *pNtAllocateVirtualMemory)(HANDLE, PVOID *, ULONG, SIZE_T *, ULONG, ULONG);
static NTSTATUS (WINAPI *pNtFreeVirtualMemory)(HANDLE, PVOID *, SIZE_T *, ULONG);
@@ -56,6 +56,23 @@ static NTSTATUS (WINAPI *pNtFreeVirtualMemory)(HANDLE, PVOID *, SIZE_T *, ULONG)
/* ############################### */
@@ -42,7 +35,7 @@ index 5503e25..fb8d598 100644
static HANDLE create_target_process(const char *arg)
{
char **argv;
@@ -3768,6 +3786,244 @@ static void test_shared_memory_ro(BOOL is_child, DWORD child_access)
@@ -3828,6 +3845,239 @@ static void test_shared_memory_ro(BOOL is_child, DWORD child_access)
CloseHandle(mapping);
}
@@ -103,7 +96,6 @@ index 5503e25..fb8d598 100644
+ 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);
@@ -127,7 +119,6 @@ index 5503e25..fb8d598 100644
+ 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);
@@ -148,7 +139,6 @@ index 5503e25..fb8d598 100644
+ 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|SEC_IMAGE), "expected SEC_FILE|SEC_IMAGE, got %#x\n", info.basic.Attributes);
+ ok(info.basic.Size.QuadPart == image_size, "expected %#lx, got %#x/%08x\n", image_size, info.basic.Size.HighPart, info.basic.Size.LowPart);
+
@@ -178,9 +168,7 @@ index 5503e25..fb8d598 100644
+ ok((ULONG_PTR)info.image.TransferAddress == nt->OptionalHeader.ImageBase + nt->OptionalHeader.AddressOfEntryPoint,
+ "expected %#lx, got %p\n", (SIZE_T)(nt->OptionalHeader.ImageBase + nt->OptionalHeader.AddressOfEntryPoint), info.image.TransferAddress);
+ ok(info.image.ZeroBits == 0, "expected 0, got %#x\n", info.image.ZeroBits);
+todo_wine
+ ok(info.image.MaximumStackSize == nt->OptionalHeader.SizeOfStackReserve, "expected %#lx, got %#lx\n", (SIZE_T)nt->OptionalHeader.SizeOfStackReserve, info.image.MaximumStackSize);
+todo_wine
+ ok(info.image.CommittedStackSize == nt->OptionalHeader.SizeOfStackCommit, "expected %#lx, got %#lx\n", (SIZE_T)nt->OptionalHeader.SizeOfStackCommit, info.image.CommittedStackSize);
+ ok(info.image.SubSystemType == nt->OptionalHeader.Subsystem, "expected %#x, got %#x\n", nt->OptionalHeader.Subsystem, info.image.SubSystemType);
+ ok(info.image.SubsystemVersionLow == nt->OptionalHeader.MinorSubsystemVersion, "expected %#x, got %#x\n", nt->OptionalHeader.MinorSubsystemVersion, info.image.SubsystemVersionLow);
@@ -188,6 +176,7 @@ index 5503e25..fb8d598 100644
+ ok(info.image.ImageCharacteristics == nt->FileHeader.Characteristics, "expected %#x, got %#x\n", nt->FileHeader.Characteristics, info.image.ImageCharacteristics);
+ ok(info.image.DllCharacteristics == nt->OptionalHeader.DllCharacteristics, "expected %#x, got %#x\n", nt->OptionalHeader.DllCharacteristics, info.image.DllCharacteristics);
+ ok(info.image.Machine == nt->FileHeader.Machine, "expected %#x, got %#x\n", nt->FileHeader.Machine, info.image.Machine);
+todo_wine
+ ok(info.image.ImageContainsCode == TRUE, "expected 1, got %#x\n", info.image.ImageContainsCode);
+
+ memset(&info, 0x55, sizeof(info));
@@ -196,7 +185,6 @@ index 5503e25..fb8d598 100644
+ 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|SEC_IMAGE), "expected SEC_FILE|SEC_IMAGE, got %#x\n", info.basic.Attributes);
+ ok(info.basic.Size.QuadPart == image_size, "expected %#lx, got %#x/%08x\n", image_size, info.basic.Size.HighPart, info.basic.Size.LowPart);
+
@@ -287,15 +275,7 @@ index 5503e25..fb8d598 100644
START_TEST(virtual)
{
int argc;
@@ -3820,6 +4076,7 @@ START_TEST(virtual)
pNtUnmapViewOfSection = (void *)GetProcAddress( hntdll, "NtUnmapViewOfSection" );
pRtlAddVectoredExceptionHandler = (void *)GetProcAddress( hntdll, "RtlAddVectoredExceptionHandler" );
pRtlRemoveVectoredExceptionHandler = (void *)GetProcAddress( hntdll, "RtlRemoveVectoredExceptionHandler" );
+ pNtQuerySection = (void *)GetProcAddress( hntdll, "NtQuerySection" );
pNtProtectVirtualMemory = (void *)GetProcAddress( hntdll, "NtProtectVirtualMemory" );
pNtAllocateVirtualMemory = (void *)GetProcAddress( hntdll, "NtAllocateVirtualMemory" );
pNtFreeVirtualMemory = (void *)GetProcAddress( hntdll, "NtFreeVirtualMemory" );
@@ -3829,6 +4086,7 @@ START_TEST(virtual)
@@ -3891,6 +4141,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();
@@ -304,5 +284,5 @@ index 5503e25..fb8d598 100644
test_VirtualAlloc_protection();
test_VirtualProtect();
--
2.7.1
2.8.0

View File

@@ -1,4 +1,4 @@
From e25dd58ca9b187745ddfb4b8eb10cbcef24992de Mon Sep 17 00:00:00 2001
From 84cdc8afb6575024f2ebab1347cfc6becf41ce06 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
@@ -6,15 +6,15 @@ Subject: server: CreateFileMapping should not fail without SEC_COMMIT for a
Anonymous file mapping already behaves this way.
---
dlls/kernel32/tests/virtual.c | 5 ++---
dlls/kernel32/tests/virtual.c | 4 +---
server/mapping.c | 5 +++--
2 files changed, 5 insertions(+), 5 deletions(-)
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index 10e72b2..6d25b5f 100644
index 26e5195..866d1b8 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -3961,9 +3961,7 @@ todo_wine
@@ -4016,9 +4016,7 @@ todo_wine
SetLastError(0xdeadbef);
mapping = CreateFileMappingA(file, NULL, PAGE_READONLY|SEC_RESERVE, 0, 0, NULL);
@@ -24,11 +24,9 @@ index 10e72b2..6d25b5f 100644
memset(&info, 0x55, sizeof(info));
ret = 0xdeadbeef;
@@ -3971,11 +3969,12 @@ todo_wine
ok(status == STATUS_SUCCESS, "NtQuerySection error %#x\n", status);
@@ -4027,10 +4025,10 @@ todo_wine
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);
@@ -39,12 +37,12 @@ index 10e72b2..6d25b5f 100644
SetLastError(0xdeadbef);
diff --git a/server/mapping.c b/server/mapping.c
index ec0ef98..aa38193 100644
index 71c3437..c223037 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -539,8 +539,9 @@ static struct object *create_mapping( struct object *root, const struct unicode_
@@ -529,8 +529,9 @@ static struct object *create_mapping( struct object *root, const struct unicode_
if (!(protect & VPROT_COMMITTED))
if (flags & SEC_RESERVE)
{
- set_error( STATUS_INVALID_PARAMETER );
- goto error;
@@ -55,5 +53,5 @@ index ec0ef98..aa38193 100644
if (!(file = get_file_obj( current->process, handle, access ))) goto error;
fd = get_obj_fd( (struct object *)file );
--
2.7.1
2.8.0

View File

@@ -1,76 +0,0 @@
From 83766ac8e17968e234462a35588bc0765a0f35aa Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Wed, 9 Mar 2016 13:51:59 +0800
Subject: ntdll: For section queries return real file size.
---
dlls/kernel32/tests/virtual.c | 4 ----
dlls/ntdll/virtual.c | 9 +++++++++
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index 6d25b5f..485e2f3 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -3844,7 +3844,6 @@ static void test_NtQuerySection(void)
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);
status = pNtQuerySection(mapping, SectionImageInformation, &info, sizeof(info.basic), &ret);
@@ -3868,7 +3867,6 @@ todo_wine
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);
UnmapViewOfFile(p);
@@ -3954,7 +3952,6 @@ todo_wine
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);
@@ -3971,7 +3968,6 @@ todo_wine
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);
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 5a8d85c..f00aae9 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -2538,6 +2538,7 @@ NTSTATUS WINAPI SYSCALL(NtQuerySection)( HANDLE handle, SECTION_INFORMATION_CLAS
short machine, subsystem;
short major_subsystem, minor_subsystem;
short characteristics, dll_characteristics;
+ int unix_fd, needs_close;
NTSTATUS res;
if (info_class == SectionBasicInformation)
@@ -2579,6 +2580,14 @@ NTSTATUS WINAPI SYSCALL(NtQuerySection)( HANDLE handle, SECTION_INFORMATION_CLAS
SERVER_END_REQ;
if (res) return res;
+ if (!(protect & VPROT_IMAGE) && dup_mapping &&
+ !server_get_unix_fd( dup_mapping, 0, &unix_fd, &needs_close, NULL, NULL ))
+ {
+ struct stat st;
+ if (!fstat( unix_fd, &st )) size.QuadPart = st.st_size;
+ if (needs_close) close( unix_fd );
+ }
+
if (dup_mapping) close_handle( dup_mapping );
if (shared_file) close_handle( shared_file );
--
2.7.1

View File

@@ -1,2 +0,0 @@
Fixes: [37338] Support for NtQuerySection
# Depends: ntdll-Syscall_Wrappers