Commit d453db5b authored by Myah Caron's avatar Myah Caron Committed by Alexandre Julliard

ntdll: Stub NtAllocateVirtualMemoryEx.

parent 3c883271
......@@ -141,6 +141,7 @@
# @ stub NtAllocateUserPhysicalPages
@ stdcall -syscall NtAllocateUuids(ptr ptr ptr ptr)
@ stdcall -syscall NtAllocateVirtualMemory(long ptr long ptr long long)
@ stdcall -syscall NtAllocateVirtualMemoryEx(long ptr ptr long long ptr long)
@ stdcall -syscall NtAreMappedFilesTheSame(ptr ptr)
@ stdcall -syscall NtAssignProcessToJobObject(long long)
@ stub NtCallbackReturn
......@@ -1146,6 +1147,7 @@
# @ stub ZwAllocateUserPhysicalPages
@ stdcall -private -syscall ZwAllocateUuids(ptr ptr ptr ptr) NtAllocateUuids
@ stdcall -private -syscall ZwAllocateVirtualMemory(long ptr long ptr long long) NtAllocateVirtualMemory
@ stdcall -private -syscall ZwAllocateVirtualMemoryEx(long ptr ptr long long ptr long) NtAllocateVirtualMemoryEx
@ stdcall -private -syscall ZwAreMappedFilesTheSame(ptr ptr) NtAreMappedFilesTheSame
@ stdcall -private -syscall ZwAssignProcessToJobObject(long long) NtAssignProcessToJobObject
@ stub ZwCallbackReturn
......
......@@ -34,6 +34,8 @@ static NTSTATUS (WINAPI *pRtlCreateUserStack)(SIZE_T, SIZE_T, ULONG, SIZE_T, SIZ
static ULONG64 (WINAPI *pRtlGetEnabledExtendedFeatures)(ULONG64);
static NTSTATUS (WINAPI *pRtlFreeUserStack)(void *);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
static NTSTATUS (WINAPI *pNtAllocateVirtualMemoryEx)(HANDLE, PVOID *, SIZE_T *, ULONG, ULONG,
MEM_EXTENDED_PARAMETER *, ULONG);
static const BOOL is_win64 = sizeof(void*) != sizeof(int);
static SYSTEM_BASIC_INFORMATION sbi;
......@@ -215,6 +217,24 @@ static void test_NtAllocateVirtualMemory(void)
size = 0;
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr1, &size, MEM_RELEASE);
ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory failed\n");
if (!pNtAllocateVirtualMemoryEx)
{
win_skip("NtAllocateVirtualMemoryEx() is missing\n");
return;
}
/* simple allocation should succeed */
size = 0x1000;
addr1 = NULL;
status = pNtAllocateVirtualMemoryEx(NtCurrentProcess(), &addr1, &size, MEM_RESERVE | MEM_COMMIT,
PAGE_EXECUTE_READWRITE, NULL, 0);
ok(status == STATUS_SUCCESS, "NtAllocateVirtualMemoryEx returned %08x\n", status);
/* specifying a count of >0 with NULL parameters should fail */
status = pNtAllocateVirtualMemoryEx(NtCurrentProcess(), &addr1, &size, MEM_RESERVE | MEM_COMMIT,
PAGE_EXECUTE_READWRITE, NULL, 1);
ok(status == STATUS_INVALID_PARAMETER, "NtAllocateVirtualMemoryEx returned %08x\n", status);
}
static void test_RtlCreateUserStack(void)
......@@ -648,6 +668,7 @@ START_TEST(virtual)
pRtlCreateUserStack = (void *)GetProcAddress(mod, "RtlCreateUserStack");
pRtlFreeUserStack = (void *)GetProcAddress(mod, "RtlFreeUserStack");
pRtlGetEnabledExtendedFeatures = (void *)GetProcAddress(mod, "RtlGetEnabledExtendedFeatures");
pNtAllocateVirtualMemoryEx = (void *)GetProcAddress(mod, "NtAllocateVirtualMemoryEx");
NtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), NULL);
trace("system page size %#x\n", sbi.PageSize);
......
......@@ -3452,6 +3452,21 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG_PTR z
return status;
}
/***********************************************************************
* NtAllocateVirtualMemoryEx (NTDLL.@)
* ZwAllocateVirtualMemoryEx (NTDLL.@)
*/
NTSTATUS WINAPI NtAllocateVirtualMemoryEx( HANDLE process, PVOID *ret, SIZE_T *size_ptr, ULONG type,
ULONG protect, MEM_EXTENDED_PARAMETER *parameters,
ULONG count )
{
if (count && !parameters) return STATUS_INVALID_PARAMETER;
if (count) FIXME( "Ignoring %d extended parameters %p\n", count, parameters );
return NtAllocateVirtualMemory( process, ret, 0, size_ptr, type, protect );
}
/***********************************************************************
* NtFreeVirtualMemory (NTDLL.@)
......
......@@ -3020,6 +3020,7 @@ NTSYSAPI NTSTATUS WINAPI NtAlertThread(HANDLE ThreadHandle);
NTSYSAPI NTSTATUS WINAPI NtAllocateLocallyUniqueId(PLUID lpLuid);
NTSYSAPI NTSTATUS WINAPI NtAllocateUuids(PULARGE_INTEGER,PULONG,PULONG,PUCHAR);
NTSYSAPI NTSTATUS WINAPI NtAllocateVirtualMemory(HANDLE,PVOID*,ULONG_PTR,SIZE_T*,ULONG,ULONG);
NTSYSAPI NTSTATUS WINAPI NtAllocateVirtualMemoryEx(HANDLE,PVOID*,SIZE_T*,ULONG,ULONG,MEM_EXTENDED_PARAMETER*,ULONG);
NTSYSAPI NTSTATUS WINAPI NtAreMappedFilesTheSame(PVOID,PVOID);
NTSYSAPI NTSTATUS WINAPI NtAssignProcessToJobObject(HANDLE,HANDLE);
NTSYSAPI NTSTATUS WINAPI NtCallbackReturn(PVOID,ULONG,NTSTATUS);
......
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