#define ALLOC_MEMORY_WITH_FREE(ProcessHandle, BaseAddress, ZeroBits, RegionSize, AllocationType, Protect, RetStatus, FreeStatus) \
do { \
+ PVOID __BaseSave = BaseAddress; \
Status = ZwAllocateVirtualMemory(ProcessHandle, &BaseAddress, ZeroBits, &RegionSize, AllocationType, Protect); \
ok_eq_hex(Status, RetStatus); \
+ if (__BaseSave != NULL) \
+ ok_eq_pointer(BaseAddress, __BaseSave); \
+ else if (!NT_SUCCESS(Status)) \
+ ok_eq_pointer(BaseAddress, NULL); \
RegionSize = 0; \
Status = ZwFreeVirtualMemory(ProcessHandle, &BaseAddress, &RegionSize, MEM_RELEASE); \
if (FreeStatus != IGNORE) ok_eq_hex(Status, FreeStatus); \
SIZE_T
CheckBufferRead(CONST VOID *Source, CONST VOID *Destination, SIZE_T Length, NTSTATUS ExpectedStatus)
{
- NTSTATUS ExceptionStatus;
SIZE_T Match = 0;
KmtStartSeh()
CheckBufferReadWrite(PVOID Destination, CONST VOID *Source, SIZE_T Length, NTSTATUS ExpectedStatus)
{
//do a little bit of writing/reading to memory
- NTSTATUS ExceptionStatus;
SIZE_T Match = 0;
KmtStartSeh()
//BASE ADDRESS TESTS
Base = (PVOID)0x00567A20;
- ALLOC_MEMORY_WITH_FREE(NtCurrentProcess(), Base, 0, RegionSize, (MEM_COMMIT | MEM_RESERVE), PAGE_READWRITE, STATUS_CONFLICTING_ADDRESSES, STATUS_FREE_VM_NOT_AT_BASE);
+ ALLOC_MEMORY_WITH_FREE(NtCurrentProcess(), Base, 0, RegionSize, (MEM_COMMIT | MEM_RESERVE), PAGE_READWRITE, STATUS_CONFLICTING_ADDRESSES, STATUS_UNABLE_TO_DELETE_SECTION);
Base = (PVOID) 0x60000000;
ALLOC_MEMORY_WITH_FREE(NtCurrentProcess(), Base, 0, RegionSize, (MEM_COMMIT | MEM_RESERVE), PAGE_READWRITE, STATUS_SUCCESS, STATUS_SUCCESS);
SimpleAllocation(VOID)
{
NTSTATUS Status;
- NTSTATUS ExceptionStatus;
PVOID Base = NULL;
SIZE_T RegionSize = DEFAULT_ALLOC_SIZE;
//////////////////////////////////////////////////////////////////////////
// GUARD PAGES
//////////////////////////////////////////////////////////////////////////
-/* FIXME: We don't support guard pages. See CORE-6639, ROSTESTS-107 */
-#ifdef ROSTESTS_107_FIXED
+
RegionSize = 1000;
Base = NULL;
ZwAllocateVirtualMemory(NtCurrentProcess(), &Base, 0, &RegionSize, (MEM_COMMIT | MEM_RESERVE), (PAGE_GUARD | PAGE_READWRITE));
RegionSize = 0;
ZwFreeVirtualMemory(NtCurrentProcess(), &Base, &RegionSize, MEM_RELEASE);
-#endif /* ROSTESTS_107_FIXED */
return Status;
}
goto cleanup;
}
- Status = ObReferenceObjectByHandle(Thread1, THREAD_ALL_ACCESS, PsThreadType, KernelMode, &ThreadObjects[0], NULL);
+ Status = ObReferenceObjectByHandle(Thread1, THREAD_ALL_ACCESS, *PsThreadType, KernelMode, &ThreadObjects[0], NULL);
if (!NT_SUCCESS(Status))
{
trace("error referencing thread1\n");
goto cleanup;
}
- Status = ObReferenceObjectByHandle(Thread2, THREAD_ALL_ACCESS, PsThreadType, KernelMode, &ThreadObjects[1], NULL);
+ Status = ObReferenceObjectByHandle(Thread2, THREAD_ALL_ACCESS, *PsThreadType, KernelMode, &ThreadObjects[1], NULL);
if (!NT_SUCCESS(Status))
{
trace("error referencing thread2\n");
Status = STATUS_SUCCESS;
Status = StressTesting(MEM_COMMIT);
- ok_eq_hex(Status, STATUS_COMMITMENT_LIMIT);
+ ok_eq_hex(Status, STATUS_NO_MEMORY);
SystemProcessTest();
}