mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Added patch to support AT_ROUND_TO_PAGE flag in NtMapViewOfSection.
This commit is contained in:
parent
4d919d4d83
commit
0af6df6bc0
@ -39,7 +39,7 @@ Wine. All those differences are also documented on the
|
||||
Included bug fixes and improvements
|
||||
-----------------------------------
|
||||
|
||||
**Bug fixes and features included in the next upcoming release [8]:**
|
||||
**Bug fixes and features included in the next upcoming release [9]:**
|
||||
|
||||
* Add implementation for kernel32.GetNumaProcessorNode ([Wine Bug #38660](https://bugs.winehq.org/show_bug.cgi?id=38660))
|
||||
* Allow to set pixel format for desktop window
|
||||
@ -47,6 +47,7 @@ Included bug fixes and improvements
|
||||
* Implement proper handling of CLI .NET images in Wine library loader ([Wine Bug #38661](https://bugs.winehq.org/show_bug.cgi?id=38661))
|
||||
* Multiple applications needs better NtQueryInformationJobObject stub ([Wine Bug #38658](https://bugs.winehq.org/show_bug.cgi?id=38658))
|
||||
* Set NamedPipeState to FILE_PIPE_CLOSING_STATE on broken pipe in NtQueryInformationFile
|
||||
* Support for AT_ROUND_TO_PAGE flag in NtMapViewOfSection
|
||||
* Support for NtSetInformationFile class FileLinkInformation
|
||||
* Support for NtSetInformationFile class FileRenameInformation ([Wine Bug #30399](https://bugs.winehq.org/show_bug.cgi?id=30399))
|
||||
|
||||
|
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -24,6 +24,8 @@ wine-staging (1.7.45) UNRELEASED; urgency=low
|
||||
* Added patch to allow setting pixel format for desktop window.
|
||||
* Added patch to set a proper caption for shell32 Run dialog (by Jared
|
||||
Smudde).
|
||||
* Added patch to support AT_ROUND_TO_PAGE flag in NtMapViewOfSection (fixes
|
||||
Wine Staging Bug 347).
|
||||
* Removed patch to handle '\r' as whitespace in wbemprox queries (accepted
|
||||
upstream).
|
||||
* Removed patch to make sure OpenClipboard with current owner doesn't fail
|
||||
|
@ -0,0 +1,283 @@
|
||||
From ba356b408f62fe5b7e772eb3fff46494e77542e9 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Fri, 5 Jun 2015 07:32:40 +0200
|
||||
Subject: kernel32/tests: Add tests for virtual memory align behaviour.
|
||||
|
||||
---
|
||||
dlls/kernel32/tests/virtual.c | 194 +++++++++++++++++++++++++++++++++++++++++-
|
||||
include/winnt.h | 1 +
|
||||
2 files changed, 194 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
|
||||
index 4f50df8..15fa903 100644
|
||||
--- a/dlls/kernel32/tests/virtual.c
|
||||
+++ b/dlls/kernel32/tests/virtual.c
|
||||
@@ -47,7 +47,10 @@ static struct _TEB * (WINAPI *pNtCurrentTeb)(void);
|
||||
static PVOID (WINAPI *pRtlAddVectoredExceptionHandler)(ULONG, PVECTORED_EXCEPTION_HANDLER);
|
||||
static ULONG (WINAPI *pRtlRemoveVectoredExceptionHandler)(PVOID);
|
||||
static BOOL (WINAPI *pGetProcessDEPPolicy)(HANDLE, LPDWORD, PBOOL);
|
||||
+static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
|
||||
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);
|
||||
|
||||
/* ############################### */
|
||||
|
||||
@@ -237,6 +240,8 @@ static void test_VirtualAlloc(void)
|
||||
void *addr1, *addr2;
|
||||
DWORD old_prot;
|
||||
MEMORY_BASIC_INFORMATION info;
|
||||
+ NTSTATUS status;
|
||||
+ SIZE_T size;
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
addr1 = VirtualAlloc(0, 0, MEM_RESERVE, PAGE_NOACCESS);
|
||||
@@ -372,6 +377,42 @@ static void test_VirtualAlloc(void)
|
||||
"got %d, expected ERROR_INVALID_PARAMETER\n", GetLastError());
|
||||
|
||||
ok(VirtualFree(addr1, 0, MEM_RELEASE), "VirtualFree failed\n");
|
||||
+
|
||||
+ addr1 = VirtualAlloc(0, 0x1000, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
+ ok(addr1 != NULL, "VirtualAlloc failed\n");
|
||||
+ ok(!((ULONG_PTR)addr1 & 0xffff), "returned memory %p is not aligned to 64k\n", addr1);
|
||||
+
|
||||
+ /* allocation conflicts because of 64k align */
|
||||
+ size = 0x1000;
|
||||
+ addr2 = (char *)addr1 + 0x1000;
|
||||
+ status = pNtAllocateVirtualMemory(GetCurrentProcess(), &addr2, 0, &size,
|
||||
+ MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
+ ok(status == STATUS_CONFLICTING_ADDRESSES, "NtAllocateVirtualMemory returned %08x\n", status);
|
||||
+
|
||||
+ /* it should conflict, even when zero_bits is explicitly set */
|
||||
+ size = 0x1000;
|
||||
+ addr2 = (char *)addr1 + 0x1000;
|
||||
+ status = pNtAllocateVirtualMemory(GetCurrentProcess(), &addr2, 12, &size,
|
||||
+ MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
+ todo_wine
|
||||
+ ok(status == STATUS_CONFLICTING_ADDRESSES, "NtAllocateVirtualMemory returned %08x\n", status);
|
||||
+ if (status == STATUS_SUCCESS) ok(VirtualFree(addr2, 0, MEM_RELEASE), "VirtualFree failed\n");
|
||||
+
|
||||
+ /* AT_ROUND_TO_PAGE flag is not supported for VirtualAlloc */
|
||||
+ SetLastError(0xdeadbeef);
|
||||
+ addr2 = VirtualAlloc(addr1, 0x1000, MEM_RESERVE | MEM_COMMIT | AT_ROUND_TO_PAGE, PAGE_EXECUTE_READWRITE);
|
||||
+ ok(!addr2, "VirtualAlloc unexpectedly succeeded\n");
|
||||
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "got %d, expected ERROR_INVALID_PARAMETER\n", GetLastError());
|
||||
+
|
||||
+ /* AT_ROUND_TO_PAGE flag is not suppoted for NtAllocateVirtualMemory */
|
||||
+ size = 0x1000;
|
||||
+ addr2 = (char *)addr1 + 0x1000;
|
||||
+ status = pNtAllocateVirtualMemory(GetCurrentProcess(), &addr2, 0, &size, MEM_RESERVE |
|
||||
+ MEM_COMMIT | AT_ROUND_TO_PAGE, PAGE_EXECUTE_READWRITE);
|
||||
+ todo_wine
|
||||
+ ok(status == STATUS_INVALID_PARAMETER_5, "NtAllocateVirtualMemory returned %08x\n", status);
|
||||
+
|
||||
+ ok(VirtualFree(addr1, 0, MEM_RELEASE), "VirtualFree failed\n");
|
||||
}
|
||||
|
||||
static void test_MapViewOfFile(void)
|
||||
@@ -957,11 +998,14 @@ static void test_NtMapViewOfSection(void)
|
||||
static const char data[] = "test data for NtMapViewOfSection";
|
||||
char buffer[sizeof(data)];
|
||||
HANDLE file, mapping;
|
||||
- void *ptr;
|
||||
+ void *ptr, *ptr2;
|
||||
BOOL ret;
|
||||
DWORD status, written;
|
||||
SIZE_T size, result;
|
||||
LARGE_INTEGER offset;
|
||||
+#ifdef __i386__
|
||||
+ BOOL is_wow64;
|
||||
+#endif
|
||||
|
||||
if (!pNtMapViewOfSection || !pNtUnmapViewOfSection)
|
||||
{
|
||||
@@ -988,12 +1032,157 @@ static void test_NtMapViewOfSection(void)
|
||||
offset.QuadPart = 0;
|
||||
status = pNtMapViewOfSection( mapping, hProcess, &ptr, 0, 0, &offset, &size, 1, 0, PAGE_READWRITE );
|
||||
ok( !status, "NtMapViewOfSection failed status %x\n", status );
|
||||
+ ok( !((ULONG_PTR)ptr & 0xffff), "returned memory %p is not aligned to 64k\n", ptr );
|
||||
|
||||
ret = ReadProcessMemory( hProcess, ptr, buffer, sizeof(buffer), &result );
|
||||
ok( ret, "ReadProcessMemory failed\n" );
|
||||
ok( result == sizeof(buffer), "ReadProcessMemory didn't read all data (%lx)\n", result );
|
||||
ok( !memcmp( buffer, data, sizeof(buffer) ), "Wrong data read\n" );
|
||||
|
||||
+ /* for some unknown reason NtMapViewOfSection fails with STATUS_NO_MEMORY when zero_bits != 0 ? */
|
||||
+ ptr2 = NULL;
|
||||
+ size = 0;
|
||||
+ offset.QuadPart = 0;
|
||||
+ status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 12, 0, &offset, &size, 1, 0, PAGE_READWRITE );
|
||||
+ todo_wine
|
||||
+ ok( status == STATUS_NO_MEMORY, "NtMapViewOfSection returned %x\n", status );
|
||||
+ if (status == STATUS_SUCCESS)
|
||||
+ {
|
||||
+ status = pNtUnmapViewOfSection( hProcess, ptr2 );
|
||||
+ ok( !status, "NtUnmapViewOfSection failed status %x\n", status );
|
||||
+ }
|
||||
+
|
||||
+ ptr2 = NULL;
|
||||
+ size = 0;
|
||||
+ status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 16, 0, &offset, &size, 1, 0, PAGE_READWRITE );
|
||||
+ todo_wine
|
||||
+ ok( status == STATUS_NO_MEMORY, "NtMapViewOfSection returned %x\n", status );
|
||||
+ if (status == STATUS_SUCCESS)
|
||||
+ {
|
||||
+ status = pNtUnmapViewOfSection( hProcess, ptr2 );
|
||||
+ ok( !status, "NtUnmapViewOfSection failed status %x\n", status );
|
||||
+ }
|
||||
+
|
||||
+ /* mapping at the same page conflicts */
|
||||
+ ptr2 = ptr;
|
||||
+ size = 0;
|
||||
+ offset.QuadPart = 0;
|
||||
+ status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 0, 0, &offset, &size, 1, 0, PAGE_READWRITE );
|
||||
+ ok( status == STATUS_CONFLICTING_ADDRESSES, "NtMapViewOfSection returned %x\n", status );
|
||||
+
|
||||
+ /* offset has to be aligned */
|
||||
+ ptr2 = ptr;
|
||||
+ size = 0;
|
||||
+ offset.QuadPart = 1;
|
||||
+ status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 0, 0, &offset, &size, 1, 0, PAGE_READWRITE );
|
||||
+ todo_wine
|
||||
+ ok( status == STATUS_MAPPED_ALIGNMENT, "NtMapViewOfSection returned %x\n", status );
|
||||
+
|
||||
+ /* ptr has to be aligned */
|
||||
+ ptr2 = (char *)ptr + 42;
|
||||
+ size = 0;
|
||||
+ offset.QuadPart = 0;
|
||||
+ status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 0, 0, &offset, &size, 1, 0, PAGE_READWRITE );
|
||||
+ todo_wine
|
||||
+ ok( status == STATUS_MAPPED_ALIGNMENT, "NtMapViewOfSection returned %x\n", status );
|
||||
+
|
||||
+ /* still not 64k aligned */
|
||||
+ ptr2 = (char *)ptr + 0x1000;
|
||||
+ size = 0;
|
||||
+ offset.QuadPart = 0;
|
||||
+ status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 0, 0, &offset, &size, 1, 0, PAGE_READWRITE );
|
||||
+ todo_wine
|
||||
+ ok( status == STATUS_MAPPED_ALIGNMENT, "NtMapViewOfSection returned %x\n", status );
|
||||
+
|
||||
+ /* zero_bits != 0 is not allowed when an address is set */
|
||||
+ ptr2 = (char *)ptr + 0x1000;
|
||||
+ size = 0;
|
||||
+ offset.QuadPart = 0;
|
||||
+ status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 12, 0, &offset, &size, 1, 0, PAGE_READWRITE );
|
||||
+ todo_wine
|
||||
+ ok( status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection returned %x\n", status );
|
||||
+ if (status == STATUS_SUCCESS)
|
||||
+ {
|
||||
+ status = pNtUnmapViewOfSection( hProcess, ptr2 );
|
||||
+ ok( !status, "NtUnmapViewOfSection failed status %x\n", status );
|
||||
+ }
|
||||
+
|
||||
+ ptr2 = (char *)ptr + 0x1000;
|
||||
+ size = 0;
|
||||
+ offset.QuadPart = 0;
|
||||
+ status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 16, 0, &offset, &size, 1, 0, PAGE_READWRITE );
|
||||
+ todo_wine
|
||||
+ ok( status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection returned %x\n", status );
|
||||
+ if (status == STATUS_SUCCESS)
|
||||
+ {
|
||||
+ status = pNtUnmapViewOfSection( hProcess, ptr2 );
|
||||
+ ok( !status, "NtUnmapViewOfSection failed status %x\n", status );
|
||||
+ }
|
||||
+
|
||||
+#ifdef __i386__
|
||||
+ if (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 ) || !is_wow64)
|
||||
+ {
|
||||
+ /* new memory region conflicts with previous mapping */
|
||||
+ ptr2 = ptr;
|
||||
+ size = 0;
|
||||
+ offset.QuadPart = 0;
|
||||
+ status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 0, 0, &offset,
|
||||
+ &size, 1, AT_ROUND_TO_PAGE, PAGE_READWRITE );
|
||||
+ ok( status == STATUS_CONFLICTING_ADDRESSES, "NtMapViewOfSection returned %x\n", status );
|
||||
+
|
||||
+ ptr2 = (char *)ptr + 42;
|
||||
+ size = 0;
|
||||
+ offset.QuadPart = 0;
|
||||
+ status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 0, 0, &offset,
|
||||
+ &size, 1, AT_ROUND_TO_PAGE, PAGE_READWRITE );
|
||||
+ todo_wine
|
||||
+ ok( status == STATUS_CONFLICTING_ADDRESSES, "NtMapViewOfSection returned %x\n", status );
|
||||
+
|
||||
+ /* in contrary to regular NtMapViewOfSection, only 4kb align is enforced */
|
||||
+ ptr2 = (char *)ptr + 0x1000;
|
||||
+ size = 0;
|
||||
+ offset.QuadPart = 0;
|
||||
+ status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 0, 0, &offset,
|
||||
+ &size, 1, AT_ROUND_TO_PAGE, PAGE_READWRITE );
|
||||
+ todo_wine
|
||||
+ ok( status == STATUS_SUCCESS, "NtMapViewOfSection returned %x\n", status );
|
||||
+ ok( (char *)ptr2 == (char *)ptr + 0x1000, "expected address %p, got %p\n", (char *)ptr + 0x1000, ptr2 );
|
||||
+ status = pNtUnmapViewOfSection( hProcess, ptr2 );
|
||||
+ todo_wine
|
||||
+ ok( !status, "NtUnmapViewOfSection failed status %x\n", status );
|
||||
+
|
||||
+ /* the address is rounded down if not on a page boundary */
|
||||
+ ptr2 = (char *)ptr + 0x1001;
|
||||
+ size = 0;
|
||||
+ offset.QuadPart = 0;
|
||||
+ status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 0, 0, &offset,
|
||||
+ &size, 1, AT_ROUND_TO_PAGE, PAGE_READWRITE );
|
||||
+ todo_wine
|
||||
+ ok( status == STATUS_SUCCESS, "NtMapViewOfSection returned %x\n", status );
|
||||
+ todo_wine
|
||||
+ ok( (char *)ptr2 == (char *)ptr + 0x1000, "expected address %p, got %p\n", (char *)ptr + 0x1000, ptr2 );
|
||||
+ status = pNtUnmapViewOfSection( hProcess, ptr2 );
|
||||
+ todo_wine
|
||||
+ ok( !status, "NtUnmapViewOfSection failed status %x\n", status );
|
||||
+
|
||||
+ ptr2 = (char *)ptr + 0x2000;
|
||||
+ size = 0;
|
||||
+ offset.QuadPart = 0;
|
||||
+ status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 0, 0, &offset,
|
||||
+ &size, 1, AT_ROUND_TO_PAGE, PAGE_READWRITE );
|
||||
+ todo_wine
|
||||
+ ok( status == STATUS_SUCCESS, "NtMapViewOfSection returned %x\n", status );
|
||||
+ ok( (char *)ptr2 == (char *)ptr + 0x2000, "expected address %p, got %p\n", (char *)ptr + 0x2000, ptr2 );
|
||||
+ status = pNtUnmapViewOfSection( hProcess, ptr2 );
|
||||
+ todo_wine
|
||||
+ ok( !status, "NtUnmapViewOfSection failed status %x\n", status );
|
||||
+ }
|
||||
+ else
|
||||
+#endif
|
||||
+ {
|
||||
+ skip( "AT_ROUND_TO_PAGE is not available on 64-bit systems\n" );
|
||||
+ }
|
||||
+
|
||||
status = pNtUnmapViewOfSection( hProcess, ptr );
|
||||
ok( !status, "NtUnmapViewOfSection failed status %x\n", status );
|
||||
|
||||
@@ -3495,6 +3684,7 @@ START_TEST(virtual)
|
||||
pGetWriteWatch = (void *) GetProcAddress(hkernel32, "GetWriteWatch");
|
||||
pResetWriteWatch = (void *) GetProcAddress(hkernel32, "ResetWriteWatch");
|
||||
pGetProcessDEPPolicy = (void *)GetProcAddress( hkernel32, "GetProcessDEPPolicy" );
|
||||
+ pIsWow64Process = (void *)GetProcAddress( hkernel32, "IsWow64Process" );
|
||||
pNtAreMappedFilesTheSame = (void *)GetProcAddress( hntdll, "NtAreMappedFilesTheSame" );
|
||||
pNtMapViewOfSection = (void *)GetProcAddress( hntdll, "NtMapViewOfSection" );
|
||||
pNtUnmapViewOfSection = (void *)GetProcAddress( hntdll, "NtUnmapViewOfSection" );
|
||||
@@ -3502,6 +3692,8 @@ START_TEST(virtual)
|
||||
pRtlAddVectoredExceptionHandler = (void *)GetProcAddress( hntdll, "RtlAddVectoredExceptionHandler" );
|
||||
pRtlRemoveVectoredExceptionHandler = (void *)GetProcAddress( hntdll, "RtlRemoveVectoredExceptionHandler" );
|
||||
pNtProtectVirtualMemory = (void *)GetProcAddress( hntdll, "NtProtectVirtualMemory" );
|
||||
+ pNtAllocateVirtualMemory = (void *)GetProcAddress( hntdll, "NtAllocateVirtualMemory" );
|
||||
+ pNtFreeVirtualMemory = (void *)GetProcAddress( hntdll, "NtFreeVirtualMemory" );
|
||||
|
||||
test_shared_memory(FALSE);
|
||||
test_shared_memory_ro(FALSE, FILE_MAP_READ|FILE_MAP_WRITE);
|
||||
diff --git a/include/winnt.h b/include/winnt.h
|
||||
index 7a08810..fcf65f2 100644
|
||||
--- a/include/winnt.h
|
||||
+++ b/include/winnt.h
|
||||
@@ -736,6 +736,7 @@ typedef struct _MEMORY_BASIC_INFORMATION
|
||||
|
||||
#define WRITE_WATCH_FLAG_RESET 0x00000001
|
||||
|
||||
+#define AT_ROUND_TO_PAGE 0x40000000
|
||||
|
||||
#define MINCHAR 0x80
|
||||
#define MAXCHAR 0x7f
|
||||
--
|
||||
2.4.2
|
||||
|
@ -0,0 +1,54 @@
|
||||
From 4ebf978e075ba7ff2977144606b4da6580145a1b Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Fri, 5 Jun 2015 07:35:11 +0200
|
||||
Subject: ntdll: Fix status code when NtMapViewOfSection parameter check fails.
|
||||
|
||||
---
|
||||
dlls/kernel32/tests/virtual.c | 3 ---
|
||||
dlls/ntdll/virtual.c | 2 +-
|
||||
2 files changed, 1 insertion(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
|
||||
index 15fa903..08a34bf 100644
|
||||
--- a/dlls/kernel32/tests/virtual.c
|
||||
+++ b/dlls/kernel32/tests/virtual.c
|
||||
@@ -1075,7 +1075,6 @@ static void test_NtMapViewOfSection(void)
|
||||
size = 0;
|
||||
offset.QuadPart = 1;
|
||||
status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 0, 0, &offset, &size, 1, 0, PAGE_READWRITE );
|
||||
- todo_wine
|
||||
ok( status == STATUS_MAPPED_ALIGNMENT, "NtMapViewOfSection returned %x\n", status );
|
||||
|
||||
/* ptr has to be aligned */
|
||||
@@ -1083,7 +1082,6 @@ static void test_NtMapViewOfSection(void)
|
||||
size = 0;
|
||||
offset.QuadPart = 0;
|
||||
status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 0, 0, &offset, &size, 1, 0, PAGE_READWRITE );
|
||||
- todo_wine
|
||||
ok( status == STATUS_MAPPED_ALIGNMENT, "NtMapViewOfSection returned %x\n", status );
|
||||
|
||||
/* still not 64k aligned */
|
||||
@@ -1091,7 +1089,6 @@ static void test_NtMapViewOfSection(void)
|
||||
size = 0;
|
||||
offset.QuadPart = 0;
|
||||
status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 0, 0, &offset, &size, 1, 0, PAGE_READWRITE );
|
||||
- todo_wine
|
||||
ok( status == STATUS_MAPPED_ALIGNMENT, "NtMapViewOfSection returned %x\n", status );
|
||||
|
||||
/* zero_bits != 0 is not allowed when an address is set */
|
||||
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
|
||||
index 0629816..72309f6 100644
|
||||
--- a/dlls/ntdll/virtual.c
|
||||
+++ b/dlls/ntdll/virtual.c
|
||||
@@ -2602,7 +2602,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
|
||||
/* Check parameters */
|
||||
|
||||
if ((offset.u.LowPart & mask) || (*addr_ptr && ((UINT_PTR)*addr_ptr & mask)))
|
||||
- return STATUS_INVALID_PARAMETER;
|
||||
+ return STATUS_MAPPED_ALIGNMENT;
|
||||
|
||||
switch(protect)
|
||||
{
|
||||
--
|
||||
2.4.2
|
||||
|
@ -0,0 +1,57 @@
|
||||
From 2301c43dfcc22112849acf75a90a89cda3137952 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Fri, 5 Jun 2015 07:40:44 +0200
|
||||
Subject: ntdll: Add support for AT_ROUND_TO_PAGE flag in NtMapViewOfSection.
|
||||
|
||||
---
|
||||
dlls/kernel32/tests/virtual.c | 4 ----
|
||||
dlls/ntdll/virtual.c | 5 +++++
|
||||
2 files changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
|
||||
index 08a34bf..d10d85d 100644
|
||||
--- a/dlls/kernel32/tests/virtual.c
|
||||
+++ b/dlls/kernel32/tests/virtual.c
|
||||
@@ -1141,11 +1141,9 @@ static void test_NtMapViewOfSection(void)
|
||||
offset.QuadPart = 0;
|
||||
status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 0, 0, &offset,
|
||||
&size, 1, AT_ROUND_TO_PAGE, PAGE_READWRITE );
|
||||
- todo_wine
|
||||
ok( status == STATUS_SUCCESS, "NtMapViewOfSection returned %x\n", status );
|
||||
ok( (char *)ptr2 == (char *)ptr + 0x1000, "expected address %p, got %p\n", (char *)ptr + 0x1000, ptr2 );
|
||||
status = pNtUnmapViewOfSection( hProcess, ptr2 );
|
||||
- todo_wine
|
||||
ok( !status, "NtUnmapViewOfSection failed status %x\n", status );
|
||||
|
||||
/* the address is rounded down if not on a page boundary */
|
||||
@@ -1167,11 +1165,9 @@ static void test_NtMapViewOfSection(void)
|
||||
offset.QuadPart = 0;
|
||||
status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 0, 0, &offset,
|
||||
&size, 1, AT_ROUND_TO_PAGE, PAGE_READWRITE );
|
||||
- todo_wine
|
||||
ok( status == STATUS_SUCCESS, "NtMapViewOfSection returned %x\n", status );
|
||||
ok( (char *)ptr2 == (char *)ptr + 0x2000, "expected address %p, got %p\n", (char *)ptr + 0x2000, ptr2 );
|
||||
status = pNtUnmapViewOfSection( hProcess, ptr2 );
|
||||
- todo_wine
|
||||
ok( !status, "NtUnmapViewOfSection failed status %x\n", status );
|
||||
}
|
||||
else
|
||||
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
|
||||
index 72309f6..91c420e 100644
|
||||
--- a/dlls/ntdll/virtual.c
|
||||
+++ b/dlls/ntdll/virtual.c
|
||||
@@ -2601,6 +2601,11 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
|
||||
|
||||
/* Check parameters */
|
||||
|
||||
+#ifndef _WIN64
|
||||
+ if (!is_wow64 && (alloc_type & AT_ROUND_TO_PAGE) && !zero_bits)
|
||||
+ mask = page_mask;
|
||||
+#endif
|
||||
+
|
||||
if ((offset.u.LowPart & mask) || (*addr_ptr && ((UINT_PTR)*addr_ptr & mask)))
|
||||
return STATUS_MAPPED_ALIGNMENT;
|
||||
|
||||
--
|
||||
2.4.2
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 8ae00b9ad7636141e206f76ca685286311e44aca Mon Sep 17 00:00:00 2001
|
||||
From 10503470d7495f2cd04287742e773aa9a87569f6 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)
|
||||
@ -8,15 +8,17 @@ Subject: kernel32/tests: Add tests for NtQuerySection. (try 2)
|
||||
1 file changed, 258 insertions(+)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
|
||||
index 1c70eca..fcfb254 100644
|
||||
index d10d85d..ba49193 100644
|
||||
--- a/dlls/kernel32/tests/virtual.c
|
||||
+++ b/dlls/kernel32/tests/virtual.c
|
||||
@@ -47,10 +47,28 @@ static struct _TEB * (WINAPI *pNtCurrentTeb)(void);
|
||||
static PVOID (WINAPI *pRtlAddVectoredExceptionHandler)(ULONG, PVECTORED_EXCEPTION_HANDLER);
|
||||
@@ -48,12 +48,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);
|
||||
|
||||
/* ############################### */
|
||||
|
||||
@ -40,7 +42,7 @@ index 1c70eca..fcfb254 100644
|
||||
static HANDLE create_target_process(const char *arg)
|
||||
{
|
||||
char **argv;
|
||||
@@ -3447,6 +3465,244 @@ static void test_shared_memory_ro(BOOL is_child, DWORD child_access)
|
||||
@@ -3631,6 +3649,244 @@ static void test_shared_memory_ro(BOOL is_child, DWORD child_access)
|
||||
CloseHandle(mapping);
|
||||
}
|
||||
|
||||
@ -285,15 +287,15 @@ index 1c70eca..fcfb254 100644
|
||||
START_TEST(virtual)
|
||||
{
|
||||
int argc;
|
||||
@@ -3499,6 +3755,7 @@ START_TEST(virtual)
|
||||
@@ -3684,6 +3940,7 @@ START_TEST(virtual)
|
||||
pNtCurrentTeb = (void *)GetProcAddress( hntdll, "NtCurrentTeb" );
|
||||
pRtlAddVectoredExceptionHandler = (void *)GetProcAddress( hntdll, "RtlAddVectoredExceptionHandler" );
|
||||
pRtlRemoveVectoredExceptionHandler = (void *)GetProcAddress( hntdll, "RtlRemoveVectoredExceptionHandler" );
|
||||
+ pNtQuerySection = (void *)GetProcAddress( hntdll, "NtQuerySection" );
|
||||
pNtProtectVirtualMemory = (void *)GetProcAddress( hntdll, "NtProtectVirtualMemory" );
|
||||
|
||||
test_shared_memory(FALSE);
|
||||
@@ -3506,6 +3763,7 @@ START_TEST(virtual)
|
||||
pNtAllocateVirtualMemory = (void *)GetProcAddress( hntdll, "NtAllocateVirtualMemory" );
|
||||
pNtFreeVirtualMemory = (void *)GetProcAddress( hntdll, "NtFreeVirtualMemory" );
|
||||
@@ -3693,6 +3950,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();
|
||||
@ -302,5 +304,5 @@ index 1c70eca..fcfb254 100644
|
||||
test_VirtualAlloc_protection();
|
||||
test_VirtualProtect();
|
||||
--
|
||||
2.3.5
|
||||
2.4.2
|
||||
|
||||
|
@ -1 +1,2 @@
|
||||
Fixes: [37338] Support for NtQuerySection
|
||||
Depends: ntdll-AT_ROUND_TO_PAGE
|
||||
|
@ -158,6 +158,7 @@ patch_enable_all ()
|
||||
enable_msvfw32_Image_Size="$1"
|
||||
enable_ntdll_APC_Performance="$1"
|
||||
enable_ntdll_APC_Start_Process="$1"
|
||||
enable_ntdll_AT_ROUND_TO_PAGE="$1"
|
||||
enable_ntdll_Activation_Context="$1"
|
||||
enable_ntdll_CLI_Images="$1"
|
||||
enable_ntdll_DOS_Attributes="$1"
|
||||
@ -545,6 +546,9 @@ patch_enable ()
|
||||
ntdll-APC_Start_Process)
|
||||
enable_ntdll_APC_Start_Process="$2"
|
||||
;;
|
||||
ntdll-AT_ROUND_TO_PAGE)
|
||||
enable_ntdll_AT_ROUND_TO_PAGE="$2"
|
||||
;;
|
||||
ntdll-Activation_Context)
|
||||
enable_ntdll_Activation_Context="$2"
|
||||
;;
|
||||
@ -1797,6 +1801,13 @@ if test "$enable_ntdll_RtlIpStringToAddress" -eq 1; then
|
||||
enable_ntdll_LZNT1_Compression=1
|
||||
fi
|
||||
|
||||
if test "$enable_ntdll_NtQuerySection" -eq 1; then
|
||||
if test "$enable_ntdll_AT_ROUND_TO_PAGE" -gt 1; then
|
||||
abort "Patchset ntdll-AT_ROUND_TO_PAGE disabled, but ntdll-NtQuerySection depends on that."
|
||||
fi
|
||||
enable_ntdll_AT_ROUND_TO_PAGE=1
|
||||
fi
|
||||
|
||||
if test "$enable_ntdll_Junction_Points" -eq 1; then
|
||||
if test "$enable_ntdll_Fix_Free" -gt 1; then
|
||||
abort "Patchset ntdll-Fix_Free disabled, but ntdll-Junction_Points depends on that."
|
||||
@ -3463,6 +3474,22 @@ if test "$enable_ntdll_APC_Start_Process" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset ntdll-AT_ROUND_TO_PAGE
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/kernel32/tests/virtual.c, dlls/ntdll/virtual.c, include/winnt.h
|
||||
# |
|
||||
if test "$enable_ntdll_AT_ROUND_TO_PAGE" -eq 1; then
|
||||
patch_apply ntdll-AT_ROUND_TO_PAGE/0001-kernel32-tests-Add-tests-for-virtual-memory-align-be.patch
|
||||
patch_apply ntdll-AT_ROUND_TO_PAGE/0002-ntdll-Fix-status-code-when-NtMapViewOfSection-parame.patch
|
||||
patch_apply ntdll-AT_ROUND_TO_PAGE/0003-ntdll-Add-support-for-AT_ROUND_TO_PAGE-flag-in-NtMap.patch
|
||||
(
|
||||
echo '+ { "Sebastian Lackner", "kernel32/tests: Add tests for virtual memory align behaviour.", 1 },';
|
||||
echo '+ { "Sebastian Lackner", "ntdll: Fix status code when NtMapViewOfSection parameter check fails.", 1 },';
|
||||
echo '+ { "Sebastian Lackner", "ntdll: Add support for AT_ROUND_TO_PAGE flag in NtMapViewOfSection.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset ntdll-Activation_Context
|
||||
# |
|
||||
# | Modified files:
|
||||
@ -4204,27 +4231,6 @@ if test "$enable_secur32_ANSI_NTLM_Credentials" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset server-ObjectTypeInformation
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/ntdll/om.c, dlls/ntdll/tests/om.c, server/change.c, server/completion.c, server/directory.c, server/file.c,
|
||||
# | server/handle.c, server/object.h, server/protocol.def
|
||||
# |
|
||||
if test "$enable_server_ObjectTypeInformation" -eq 1; then
|
||||
patch_apply server-ObjectTypeInformation/0001-ntdll-Implemenent-ObjectTypeInformation-class-suppor.patch
|
||||
patch_apply server-ObjectTypeInformation/0002-ntdll-tests-Add-a-few-more-ObjectTypeInformation-tes.patch
|
||||
patch_apply server-ObjectTypeInformation/0003-server-Fix-type-name-of-IoCompletion.patch
|
||||
patch_apply server-ObjectTypeInformation/0004-server-Fix-type-name-of-File.patch
|
||||
patch_apply server-ObjectTypeInformation/0005-server-Fix-type-name-of-directory-file.patch
|
||||
(
|
||||
echo '+ { "Qian Hong", "ntdll: Implemenent ObjectTypeInformation class support in NtQueryObject.", 2 },';
|
||||
echo '+ { "Qian Hong", "ntdll/tests: Add a few more ObjectTypeInformation tests.", 1 },';
|
||||
echo '+ { "Qian Hong", "server: Fix type name of IoCompletion.", 1 },';
|
||||
echo '+ { "Qian Hong", "server: Fix type name of File.", 1 },';
|
||||
echo '+ { "Qian Hong", "server: Fix type name of directory file.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset server-RootDirectory_File
|
||||
# |
|
||||
# | Modified files:
|
||||
@ -4265,6 +4271,27 @@ if test "$enable_server_Stored_ACLs" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset server-ObjectTypeInformation
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/ntdll/om.c, dlls/ntdll/tests/om.c, server/change.c, server/completion.c, server/directory.c, server/file.c,
|
||||
# | server/handle.c, server/object.h, server/protocol.def
|
||||
# |
|
||||
if test "$enable_server_ObjectTypeInformation" -eq 1; then
|
||||
patch_apply server-ObjectTypeInformation/0001-ntdll-Implemenent-ObjectTypeInformation-class-suppor.patch
|
||||
patch_apply server-ObjectTypeInformation/0002-ntdll-tests-Add-a-few-more-ObjectTypeInformation-tes.patch
|
||||
patch_apply server-ObjectTypeInformation/0003-server-Fix-type-name-of-IoCompletion.patch
|
||||
patch_apply server-ObjectTypeInformation/0004-server-Fix-type-name-of-File.patch
|
||||
patch_apply server-ObjectTypeInformation/0005-server-Fix-type-name-of-directory-file.patch
|
||||
(
|
||||
echo '+ { "Qian Hong", "ntdll: Implemenent ObjectTypeInformation class support in NtQueryObject.", 2 },';
|
||||
echo '+ { "Qian Hong", "ntdll/tests: Add a few more ObjectTypeInformation tests.", 1 },';
|
||||
echo '+ { "Qian Hong", "server: Fix type name of IoCompletion.", 1 },';
|
||||
echo '+ { "Qian Hong", "server: Fix type name of File.", 1 },';
|
||||
echo '+ { "Qian Hong", "server: Fix type name of directory file.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset server-Inherited_ACLs
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
@ -5085,57 +5112,6 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wined3d-UnhandledBlendFactor
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/wined3d/state.c
|
||||
# |
|
||||
if test "$enable_wined3d_UnhandledBlendFactor" -eq 1; then
|
||||
patch_apply wined3d-UnhandledBlendFactor/0001-wined3d-Silence-repeated-Unhandled-blend-factor-0-me.patch
|
||||
(
|
||||
echo '+ { "Sebastian Lackner", "wined3d: Silence repeated '\''Unhandled blend factor 0'\'' messages.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wined3d-wined3d_swapchain_present
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/wined3d/swapchain.c
|
||||
# |
|
||||
if test "$enable_wined3d_wined3d_swapchain_present" -eq 1; then
|
||||
patch_apply wined3d-wined3d_swapchain_present/0001-wined3d-Silence-repeated-wined3d_swapchain_present-F.patch
|
||||
(
|
||||
echo '+ { "Sebastian Lackner", "wined3d: Silence repeated wined3d_swapchain_present FIXME.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wined3d-resource_check_usage
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/wined3d/resource.c
|
||||
# |
|
||||
if test "$enable_wined3d_resource_check_usage" -eq 1; then
|
||||
patch_apply wined3d-resource_check_usage/0001-wined3d-Silence-repeated-resource_check_usage-FIXME.patch
|
||||
(
|
||||
echo '+ { "Erich E. Hoover", "wined3d: Silence repeated resource_check_usage FIXME.", 2 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wined3d-Multisampling
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#12652] Allow to override number of quality levels for D3DMULTISAMPLE_NONMASKABLE.
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/wined3d/directx.c, dlls/wined3d/wined3d_main.c, dlls/wined3d/wined3d_private.h
|
||||
# |
|
||||
if test "$enable_wined3d_Multisampling" -eq 1; then
|
||||
patch_apply wined3d-Multisampling/0001-wined3d-Allow-to-specify-multisampling-AA-quality-le.patch
|
||||
(
|
||||
echo '+ { "Austin English", "wined3d: Allow to specify multisampling AA quality levels via registry.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wined3d-Revert_PixelFormat
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
@ -5170,6 +5146,57 @@ if test "$enable_wined3d_Revert_PixelFormat" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wined3d-resource_check_usage
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/wined3d/resource.c
|
||||
# |
|
||||
if test "$enable_wined3d_resource_check_usage" -eq 1; then
|
||||
patch_apply wined3d-resource_check_usage/0001-wined3d-Silence-repeated-resource_check_usage-FIXME.patch
|
||||
(
|
||||
echo '+ { "Erich E. Hoover", "wined3d: Silence repeated resource_check_usage FIXME.", 2 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wined3d-UnhandledBlendFactor
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/wined3d/state.c
|
||||
# |
|
||||
if test "$enable_wined3d_UnhandledBlendFactor" -eq 1; then
|
||||
patch_apply wined3d-UnhandledBlendFactor/0001-wined3d-Silence-repeated-Unhandled-blend-factor-0-me.patch
|
||||
(
|
||||
echo '+ { "Sebastian Lackner", "wined3d: Silence repeated '\''Unhandled blend factor 0'\'' messages.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wined3d-wined3d_swapchain_present
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/wined3d/swapchain.c
|
||||
# |
|
||||
if test "$enable_wined3d_wined3d_swapchain_present" -eq 1; then
|
||||
patch_apply wined3d-wined3d_swapchain_present/0001-wined3d-Silence-repeated-wined3d_swapchain_present-F.patch
|
||||
(
|
||||
echo '+ { "Sebastian Lackner", "wined3d: Silence repeated wined3d_swapchain_present FIXME.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wined3d-Multisampling
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#12652] Allow to override number of quality levels for D3DMULTISAMPLE_NONMASKABLE.
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/wined3d/directx.c, dlls/wined3d/wined3d_main.c, dlls/wined3d/wined3d_private.h
|
||||
# |
|
||||
if test "$enable_wined3d_Multisampling" -eq 1; then
|
||||
patch_apply wined3d-Multisampling/0001-wined3d-Allow-to-specify-multisampling-AA-quality-le.patch
|
||||
(
|
||||
echo '+ { "Austin English", "wined3d: Allow to specify multisampling AA quality levels via registry.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wined3d-CSMT_Main
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
|
Loading…
Reference in New Issue
Block a user