kernelbase: Fix VirtualAlloc2() when called with NULL process handle.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
30f1777e87
commit
6fe7535c97
|
@ -352,6 +352,7 @@ LPVOID WINAPI DECLSPEC_HOTPATCH VirtualAlloc2( HANDLE process, void *addr, SIZE_
|
||||||
{
|
{
|
||||||
LPVOID ret = addr;
|
LPVOID ret = addr;
|
||||||
|
|
||||||
|
if (!process) process = GetCurrentProcess();
|
||||||
if (!set_ntstatus( NtAllocateVirtualMemoryEx( process, &ret, &size, type, protect, parameters, count )))
|
if (!set_ntstatus( NtAllocateVirtualMemoryEx( process, &ret, &size, type, protect, parameters, count )))
|
||||||
return NULL;
|
return NULL;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -142,10 +142,8 @@ static void test_VirtualAlloc2(void)
|
||||||
|
|
||||||
size = 0x80000;
|
size = 0x80000;
|
||||||
addr = pVirtualAlloc2(NULL, NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE, NULL, 0);
|
addr = pVirtualAlloc2(NULL, NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE, NULL, 0);
|
||||||
todo_wine
|
|
||||||
ok(!!addr, "Failed to allocate, error %lu.\n", GetLastError());
|
ok(!!addr, "Failed to allocate, error %lu.\n", GetLastError());
|
||||||
ret = VirtualFree(addr, 0, MEM_RELEASE);
|
ret = VirtualFree(addr, 0, MEM_RELEASE);
|
||||||
todo_wine
|
|
||||||
ok(ret, "Unexpected return value %d, error %lu.\n", ret, GetLastError());
|
ok(ret, "Unexpected return value %d, error %lu.\n", ret, GetLastError());
|
||||||
|
|
||||||
/* Placeholder splitting functionality */
|
/* Placeholder splitting functionality */
|
||||||
|
|
Loading…
Reference in New Issue