wow64: Don't add MEM_RESERVE for invalid flags combinations.

This commit is contained in:
Alexandre Julliard 2023-09-12 15:53:41 +02:00
parent d76f5b4ab9
commit f41ac64a73
2 changed files with 15 additions and 1 deletions

View file

@ -407,6 +407,20 @@ static void test_cross_process_notifications( HANDLE process, void *ptr )
}
ok( !entry, "not at end of list\n" );
addr = NULL;
size = 0x321;
status = NtAllocateVirtualMemory( process, &addr, 0, &size, 0, PAGE_EXECUTE_READ );
ok( status == STATUS_INVALID_PARAMETER, "NtAllocateVirtualMemory failed %lx\n", status );
entry = pop_from_work_list( &list->work_list );
if (current_machine != IMAGE_FILE_MACHINE_ARM64)
{
entry = expect_cross_work_entry( list, entry, CrossProcessPreVirtualAlloc, addr, 0x321,
0, PAGE_EXECUTE_READ, 0, 0xcccccccc );
entry = expect_cross_work_entry( list, entry, CrossProcessPostVirtualAlloc, addr, 0x321,
0, PAGE_EXECUTE_READ, status, 0xcccccccc );
}
ok( !entry, "not at end of list\n" );
addr = NULL;
size = 0x4321;
status = NtAllocateVirtualMemory( process, &addr, 0, &size, MEM_RESERVE, PAGE_EXECUTE_READWRITE );

View file

@ -153,7 +153,7 @@ NTSTATUS WINAPI wow64_NtAllocateVirtualMemory( UINT *args )
BOOL is_current = RtlIsCurrentProcess( process );
NTSTATUS status;
if (!addr) type |= MEM_RESERVE;
if (!addr && (type & MEM_COMMIT)) type |= MEM_RESERVE;
if (!is_current)
send_cross_process_notification( process, CrossProcessPreVirtualAlloc,