Commit d082ea3e authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

ntdll: Implement support for AT_ROUND_TO_PAGE flag in NtMapViewOfSection.

parent 7a8470ea
......@@ -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
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment