[PATCH 4/4] kernelbase: Use VirtualAlloc2 in VirtualAllocEx.

Myah Caron qsniyg at protonmail.com
Fri Oct 16 20:45:41 CDT 2020


Signed-off-by: Myah Caron <qsniyg at protonmail.com>
---
I have no proof that this is what happens under Windows, this is only a guess based on the way most calls appear to be implemented (for example, USVFS needing to hook NtQueryDirectoryFileEx for newer Windows 10 versions, as NtQueryDirectoryFile was no longer being called once the new call was introduced). Feel free to disregard this patch.

I'm also guessing VirtualAllocExNuma would likely call VirtualAlloc2 with MemExtendedParameterNumaNode, but since it's not yet implemented there's probably no need to do this for the moment.

 dlls/kernelbase/memory.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/dlls/kernelbase/memory.c b/dlls/kernelbase/memory.c
index c3adf2217af..e4adce19b55 100644
--- a/dlls/kernelbase/memory.c
+++ b/dlls/kernelbase/memory.c
@@ -292,10 +292,7 @@ LPVOID WINAPI DECLSPEC_HOTPATCH VirtualAlloc( void *addr, SIZE_T size, DWORD typ
 LPVOID WINAPI DECLSPEC_HOTPATCH VirtualAllocEx( HANDLE process, void *addr, SIZE_T size,
                                                 DWORD type, DWORD protect )
 {
-    LPVOID ret = addr;
-
-    if (!set_ntstatus( NtAllocateVirtualMemory( process, &ret, 0, &size, type, protect ))) return NULL;
-    return ret;
+    return VirtualAlloc2( process, addr, size, type, protect, NULL, 0 );
 }


--
2.28.0





More information about the wine-devel mailing list