Commit 6fe7535c authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

kernelbase: Fix VirtualAlloc2() when called with NULL process handle.

parent 30f1777e
......@@ -352,6 +352,7 @@ LPVOID WINAPI DECLSPEC_HOTPATCH VirtualAlloc2( HANDLE process, void *addr, SIZE_
{
LPVOID ret = addr;
if (!process) process = GetCurrentProcess();
if (!set_ntstatus( NtAllocateVirtualMemoryEx( process, &ret, &size, type, protect, parameters, count )))
return NULL;
return ret;
......
......@@ -142,10 +142,8 @@ static void test_VirtualAlloc2(void)
size = 0x80000;
addr = pVirtualAlloc2(NULL, NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE, NULL, 0);
todo_wine
ok(!!addr, "Failed to allocate, error %lu.\n", GetLastError());
ret = VirtualFree(addr, 0, MEM_RELEASE);
todo_wine
ok(ret, "Unexpected return value %d, error %lu.\n", ret, GetLastError());
/* Placeholder splitting functionality */
......
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