Commit 7a8470ea authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

ntdll: NtMapViewOfSection should fail if both addr_ptr and zero_bits is set.

parent 0a12011a
...@@ -1093,25 +1093,25 @@ static void test_NtMapViewOfSection(void) ...@@ -1093,25 +1093,25 @@ static void test_NtMapViewOfSection(void)
size = 0; size = 0;
offset.QuadPart = 0; offset.QuadPart = 0;
status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 12, 0, &offset, &size, 1, 0, PAGE_READWRITE ); 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 ); 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; ptr2 = (char *)ptr + 0x1000;
size = 0; size = 0;
offset.QuadPart = 0; offset.QuadPart = 0;
status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 16, 0, &offset, &size, 1, 0, PAGE_READWRITE ); 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 ); ok( status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection returned %x\n", status );
if (status == STATUS_SUCCESS)
{ ptr2 = (char *)ptr + 0x1001;
status = pNtUnmapViewOfSection( hProcess, ptr2 ); size = 0;
ok( !status, "NtUnmapViewOfSection failed status %x\n", status ); 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 || if (sizeof(void *) == sizeof(int) && (!pIsWow64Process ||
!pIsWow64Process( GetCurrentProcess(), &is_wow64 ) || !is_wow64)) !pIsWow64Process( GetCurrentProcess(), &is_wow64 ) || !is_wow64))
......
...@@ -2601,6 +2601,9 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p ...@@ -2601,6 +2601,9 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
/* Check parameters */ /* Check parameters */
if (*addr_ptr && zero_bits)
return STATUS_INVALID_PARAMETER_4;
if ((offset.u.LowPart & mask) || (*addr_ptr && ((UINT_PTR)*addr_ptr & mask))) if ((offset.u.LowPart & mask) || (*addr_ptr && ((UINT_PTR)*addr_ptr & mask)))
return STATUS_MAPPED_ALIGNMENT; 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