diff --git a/rostests/drivers/kmtest/deviface.c b/rostests/drivers/kmtest/deviface.c index ebb5010961c..a3011f3d141 100644 --- a/rostests/drivers/kmtest/deviface.c +++ b/rostests/drivers/kmtest/deviface.c @@ -70,7 +70,7 @@ * function worked correctly. */ -NTSTATUS STDCALL +NTSTATUS NTAPI ReactOS_IoGetDeviceInterfaces( IN CONST GUID *InterfaceClassGuid, IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, diff --git a/rostests/drivers/kmtest/deviface_test.c b/rostests/drivers/kmtest/deviface_test.c index 7e34258af4c..3dcb580528a 100644 --- a/rostests/drivers/kmtest/deviface_test.c +++ b/rostests/drivers/kmtest/deviface_test.c @@ -31,21 +31,21 @@ /* PRIVATE FUNCTIONS **********************************************************/ -NTSTATUS STDCALL +NTSTATUS NTAPI (*IoGetDeviceInterfaces_Func)( IN CONST GUID *InterfaceClassGuid, IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, IN ULONG Flags, OUT PWSTR *SymbolicLinkList); -NTSTATUS STDCALL +NTSTATUS NTAPI ReactOS_IoGetDeviceInterfaces( IN CONST GUID *InterfaceClassGuid, IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, IN ULONG Flags, OUT PWSTR *SymbolicLinkList); -VOID FASTCALL DeviceInterfaceTest_Func() +VOID DeviceInterfaceTest_Func() { NTSTATUS Status; PWSTR SymbolicLinkList; @@ -134,7 +134,7 @@ VOID RegisterDI_Test() "IoRegisterDeviceInterface returned 0x%08lX\n", Status); } -VOID FASTCALL NtoskrnlIoDeviceInterface() +VOID NtoskrnlIoDeviceInterface() { StartTest(); diff --git a/rostests/drivers/kmtest/kmtest.c b/rostests/drivers/kmtest/kmtest.c index 558a95f20fc..77fc9c093db 100644 --- a/rostests/drivers/kmtest/kmtest.c +++ b/rostests/drivers/kmtest/kmtest.c @@ -103,10 +103,11 @@ int kmtest_ok(int condition, const char *msg, ... ) /* * Test Declarations */ -VOID FASTCALL NtoskrnlIoMdlTest(); -VOID FASTCALL NtoskrnlIoDeviceInterface(); -VOID FASTCALL NtoskrnlObTest(); -VOID FASTCALL NtoskrnlExecutiveTests(); +VOID NtoskrnlIoMdlTest(); +VOID NtoskrnlIoDeviceInterface(); +VOID NtoskrnlObTest(); +VOID NtoskrnlExecutiveTests(); +VOID NtoskrnlPoolsTest(); /* * DriverEntry @@ -117,10 +118,12 @@ DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) { DbgPrint("\n===============================================\nKernel Mode Regression Test driver starting...\n"); - NtoskrnlExecutiveTests(); - NtoskrnlIoDeviceInterface(); - NtoskrnlIoMdlTest(); - NtoskrnlObTest(); + //NtoskrnlExecutiveTests(); + //NtoskrnlIoDeviceInterface(); + //NtoskrnlIoMdlTest(); + //NtoskrnlObTest(); + //NtoskrnlObTest(); + NtoskrnlPoolsTest(); - return STATUS_UNSUCCESSFUL; + return STATUS_SUCCESS; } diff --git a/rostests/drivers/kmtest/kmtest.rbuild b/rostests/drivers/kmtest/kmtest.rbuild index 20c8a1d7f0c..23a65549f62 100644 --- a/rostests/drivers/kmtest/kmtest.rbuild +++ b/rostests/drivers/kmtest/kmtest.rbuild @@ -10,5 +10,6 @@ ntos_ex.c ntos_io.c ntos_ob.c + ntos_pools.c kmtest.rc diff --git a/rostests/drivers/kmtest/ntos_ex.c b/rostests/drivers/kmtest/ntos_ex.c index af956d284f0..73f47c65f66 100644 --- a/rostests/drivers/kmtest/ntos_ex.c +++ b/rostests/drivers/kmtest/ntos_ex.c @@ -173,7 +173,6 @@ ExTimerTest() /* PUBLIC FUNCTIONS ***********************************************************/ VOID -FASTCALL NtoskrnlExecutiveTests() { ExTimerTest(); diff --git a/rostests/drivers/kmtest/ntos_io.c b/rostests/drivers/kmtest/ntos_io.c index c17af873f05..9a662d22992 100644 --- a/rostests/drivers/kmtest/ntos_io.c +++ b/rostests/drivers/kmtest/ntos_io.c @@ -30,7 +30,7 @@ /* PUBLIC FUNCTIONS ***********************************************************/ -VOID FASTCALL NtoskrnlIoMdlTest() +VOID NtoskrnlIoMdlTest() { PMDL Mdl; PIRP Irp; diff --git a/rostests/drivers/kmtest/ntos_ob.c b/rostests/drivers/kmtest/ntos_ob.c index e053b2dc107..a7c62fa5641 100644 --- a/rostests/drivers/kmtest/ntos_ob.c +++ b/rostests/drivers/kmtest/ntos_ob.c @@ -487,7 +487,6 @@ ObtReferenceTests() /* PUBLIC FUNCTIONS ***********************************************************/ VOID -FASTCALL NtoskrnlObTest() { StartTest(); diff --git a/rostests/drivers/kmtest/ntos_pools.c b/rostests/drivers/kmtest/ntos_pools.c new file mode 100644 index 00000000000..e12fdbadd2c --- /dev/null +++ b/rostests/drivers/kmtest/ntos_pools.c @@ -0,0 +1,134 @@ +/* + * NTOSKRNL Pools test routines KM-Test + * ReactOS Kernel Mode Regression Testing framework + * + * Copyright 2008 Aleksey Bragin + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; see the file COPYING.LIB. + * If not, write to the Free Software Foundation, + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* INCLUDES *******************************************************************/ + +#include +#include +#include +#include "kmtest.h" + +//#define NDEBUG +#include "debug.h" + +#define TAG_POOLTEST TAG('P','t','s','t') + +/* PRIVATE FUNCTIONS ***********************************************************/ + +VOID +PoolsTest() +{ + PVOID Ptr; + ULONG AllocSize, i, AllocNumber; + PVOID *Allocs; + + StartTest(); + + // Stress-test nonpaged pool + for (i=1; i<10000; i++) + { + // make up some increasing, a bit irregular size + AllocSize = i*10; + + if (i % 10) + AllocSize++; + + if (i % 25) + AllocSize += 13; + + // start with non-paged pool + Ptr = ExAllocatePoolWithTag(NonPagedPool, AllocSize, TAG_POOLTEST); + + // it may fail due to no-memory condition + if (!Ptr) break; + + // try to fully fill it + RtlFillMemory(Ptr, AllocSize, 0xAB); + + // free it + ExFreePoolWithTag(Ptr, TAG_POOLTEST); + } + + // now paged one + for (i=1; i<10000; i++) + { + // make up some increasing, a bit irregular size + AllocSize = i*50; + + if (i % 10) + AllocSize++; + + if (i % 25) + AllocSize += 13; + + // start with non-paged pool + Ptr = ExAllocatePoolWithTag(PagedPool, AllocSize, TAG_POOLTEST); + + // it may fail due to no-memory condition + if (!Ptr) break; + + // try to fully fill it + RtlFillMemory(Ptr, AllocSize, 0xAB); + + // free it + ExFreePoolWithTag(Ptr, TAG_POOLTEST); + } + + // test super-big allocations + /*AllocSize = 2UL * 1024 * 1024 * 1024; + Ptr = ExAllocatePoolWithTag(NonPagedPool, AllocSize, TAG_POOLTEST); + ok(Ptr == NULL, "Allocating 2Gb of nonpaged pool should fail\n"); + + Ptr = ExAllocatePoolWithTag(PagedPool, AllocSize, TAG_POOLTEST); + ok(Ptr == NULL, "Allocating 2Gb of paged pool should fail\n");*/ + + // now test allocating lots of small/medium blocks + AllocNumber = 100000; + Allocs = ExAllocatePoolWithTag(PagedPool, sizeof(Allocs) * AllocNumber, TAG_POOLTEST); + + // alloc blocks + for (i=0; i