From 9aff965362a0b12e5a25b118c9746c390fc9dff8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Mon, 1 Sep 2014 22:41:36 +0000 Subject: [PATCH] [KMTESTS] - Test what happens to the 'base' of memory allocated with ZwAllocateVirtualMemory - Fix some tests according to w2k3sp2 behaviour. Thanks Amine for testing ;-) svn path=/trunk/; revision=64028 --- rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c b/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c index 785cb51030e..52e973d7547 100644 --- a/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c +++ b/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c @@ -31,8 +31,13 @@ typedef struct _TEST_CONTEXT #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); \ @@ -104,7 +109,7 @@ SimpleErrorChecks(VOID) //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); @@ -501,7 +506,7 @@ START_TEST(ZwAllocateVirtualMemory) Status = STATUS_SUCCESS; Status = StressTesting(MEM_COMMIT); - ok_eq_hex(Status, STATUS_COMMITMENT_LIMIT); + ok_eq_hex(Status, STATUS_NO_MEMORY); SystemProcessTest(); } -- 2.17.1