mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 23:27:17 +00:00
ntdll: Implement support for AT_ROUND_TO_PAGE flag in NtMapViewOfSection.
This commit is contained in:
parent
7a8470ea94
commit
d082ea3eab
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue