Module: wine Branch: master Commit: d082ea3eabcbf84144b0ffffc8341153ab8d89ef URL: http://source.winehq.org/git/wine.git/?a=commit;h=d082ea3eabcbf84144b0ffffc8...
Author: Sebastian Lackner sebastian@fds-team.de Date: Fri Jun 26 07:46:43 2015 +0200
ntdll: Implement support for AT_ROUND_TO_PAGE flag in NtMapViewOfSection.
---
dlls/kernel32/tests/virtual.c | 8 -------- dlls/ntdll/virtual.c | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c index 008376c..244fa9d 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -1129,7 +1129,6 @@ 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_CONFLICTING_ADDRESSES, "NtMapViewOfSection returned %x\n", status );
/* in contrary to regular NtMapViewOfSection, only 4kb align is enforced */ @@ -1138,12 +1137,10 @@ 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 */ @@ -1152,13 +1149,10 @@ 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 ); - 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; @@ -1166,12 +1160,10 @@ 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 a010e3b4..bc3f7cd 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -2604,6 +2604,14 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p if (*addr_ptr && zero_bits) return STATUS_INVALID_PARAMETER_4;
+#ifndef _WIN64 + if (!is_wow64 && (alloc_type & AT_ROUND_TO_PAGE)) + { + *addr_ptr = ROUND_ADDR( *addr_ptr, page_mask ); + mask = page_mask; + } +#endif + if ((offset.u.LowPart & mask) || (*addr_ptr && ((UINT_PTR)*addr_ptr & mask))) return STATUS_MAPPED_ALIGNMENT;