Commit 1afb3693 authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

ntdll: Zero bits parameter must be less than 21.

parent 5bd58bb2
......@@ -400,7 +400,6 @@ static void test_VirtualAlloc(void)
addr2 = NULL;
status = pNtAllocateVirtualMemory(GetCurrentProcess(), &addr2, 22, &size,
MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
todo_wine
ok(status == STATUS_INVALID_PARAMETER_3, "NtAllocateVirtualMemory returned %08x\n", status);
if (status == STATUS_SUCCESS) ok(VirtualFree(addr2, 0, MEM_RELEASE), "VirtualFree failed\n");
......@@ -1168,7 +1167,6 @@ static void test_NtMapViewOfSection(void)
ptr2 = NULL;
size = 0;
status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 22, 0, &offset, &size, 1, 0, PAGE_READWRITE );
todo_wine
ok( status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection returned %x\n", status );
if (status == STATUS_SUCCESS)
{
......
......@@ -279,6 +279,7 @@ static inline UINT_PTR get_mask( ULONG zero_bits )
{
if (!zero_bits) return 0xffff; /* allocations are aligned to 64K by default */
if (zero_bits < page_shift) zero_bits = page_shift;
if (zero_bits > 21) return 0;
return (1 << zero_bits) - 1;
}
......@@ -1885,6 +1886,7 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG zero_
TRACE("%p %p %08lx %x %08x\n", process, *ret, size, type, protect );
if (!size) return STATUS_INVALID_PARAMETER;
if (!mask) return STATUS_INVALID_PARAMETER_3;
if (process != NtCurrentProcess())
{
......@@ -2550,7 +2552,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
/* Check parameters */
if (*addr_ptr && zero_bits)
if ((*addr_ptr && zero_bits) || !mask)
return STATUS_INVALID_PARAMETER_4;
#ifndef _WIN64
......
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