Module: wine Branch: master Commit: f41ac64a73d84c5b49ef733cd39aaf2be9d69ca5 URL: https://gitlab.winehq.org/wine/wine/-/commit/f41ac64a73d84c5b49ef733cd39aaf2...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Sep 12 15:53:41 2023 +0200
wow64: Don't add MEM_RESERVE for invalid flags combinations.
---
dlls/ntdll/tests/wow64.c | 14 ++++++++++++++ dlls/wow64/virtual.c | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/tests/wow64.c b/dlls/ntdll/tests/wow64.c index 12ad7329816..07375f16082 100644 --- a/dlls/ntdll/tests/wow64.c +++ b/dlls/ntdll/tests/wow64.c @@ -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 ); diff --git a/dlls/wow64/virtual.c b/dlls/wow64/virtual.c index e497f60210e..412c79abb14 100644 --- a/dlls/wow64/virtual.c +++ b/dlls/wow64/virtual.c @@ -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,