Author: jgardou Date: Mon Sep 1 22:41:36 2014 New Revision: 64028
URL: http://svn.reactos.org/svn/reactos?rev=64028&view=rev Log: [KMTESTS] - Test what happens to the 'base' of memory allocated with ZwAllocateVirtualMemory - Fix some tests according to w2k3sp2 behaviour. Thanks Amine for testing ;-)
Modified: trunk/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c
Modified: trunk/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/ZwAllocate... ============================================================================== --- trunk/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c [iso-8859-1] Mon Sep 1 22:41:36 2014 @@ -31,8 +31,13 @@
#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 @@
//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 @@
Status = STATUS_SUCCESS; Status = StressTesting(MEM_COMMIT); - ok_eq_hex(Status, STATUS_COMMITMENT_LIMIT); + ok_eq_hex(Status, STATUS_NO_MEMORY);
SystemProcessTest(); }