[1/2] ntdll: NtMapViewOfSection should fail if both addr_ptr and zero_bits is set.
Sebastian Lackner
sebastian at fds-team.de
Fri Jun 26 00:46:23 CDT 2015
---
dlls/kernel32/tests/virtual.c | 24 ++++++++++++------------
dlls/ntdll/virtual.c | 3 +++
2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index 6082740..008376c 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -1093,25 +1093,25 @@ static void test_NtMapViewOfSection(void)
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 );
- }
+
+ ptr2 = (char *)ptr + 0x1001;
+ size = 0;
+ offset.QuadPart = 0;
+ status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 16, 0, &offset, &size, 1, 0, PAGE_READWRITE );
+ ok( status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection returned %x\n", status );
+
+ ptr2 = (char *)ptr + 0x1000;
+ size = 0;
+ offset.QuadPart = 1;
+ status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 16, 0, &offset, &size, 1, 0, PAGE_READWRITE );
+ ok( status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection returned %x\n", status );
if (sizeof(void *) == sizeof(int) && (!pIsWow64Process ||
!pIsWow64Process( GetCurrentProcess(), &is_wow64 ) || !is_wow64))
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 72309f6..a010e3b4 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -2601,6 +2601,9 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
/* Check parameters */
+ if (*addr_ptr && zero_bits)
+ return STATUS_INVALID_PARAMETER_4;
+
if ((offset.u.LowPart & mask) || (*addr_ptr && ((UINT_PTR)*addr_ptr & mask)))
return STATUS_MAPPED_ALIGNMENT;
--
2.4.3
More information about the wine-patches
mailing list