[KMTESTS:OB]

Add a test dedicated to Stefan.

svn path=/trunk/; revision=69398
This commit is contained in:
Pierre Schweitzer 2015-09-28 12:25:38 +00:00
parent af2f5e5742
commit 3ee5af9d50
3 changed files with 67 additions and 0 deletions

View file

@ -74,6 +74,7 @@ list(APPEND KMTEST_DRV_SOURCE
ntos_ob/ObReference.c
ntos_ob/ObType.c
ntos_ob/ObTypes.c
ntos_ob/ObWait.c
ntos_ps/PsNotify.c
ntos_se/SeHelpers.c
ntos_se/SeInheritance.c

View file

@ -66,6 +66,7 @@ KMT_TESTFUNC Test_RtlUnicodeString;
KMT_TESTFUNC Test_ZwAllocateVirtualMemory;
KMT_TESTFUNC Test_ZwCreateSection;
KMT_TESTFUNC Test_ZwMapViewOfSection;
KMT_TESTFUNC Test_ZwWaitForMultipleObjects;
const KMT_TEST TestList[] =
{
@ -128,5 +129,6 @@ const KMT_TEST TestList[] =
{ "ZwAllocateVirtualMemory", Test_ZwAllocateVirtualMemory },
{ "ZwCreateSection", Test_ZwCreateSection },
{ "ZwMapViewOfSection", Test_ZwMapViewOfSection },
{ "ZwWaitForMultipleObjects", Test_ZwWaitForMultipleObjects},
{ NULL, NULL }
};

View file

@ -0,0 +1,64 @@
/*
* PROJECT: ReactOS kernel-mode tests
* LICENSE: GPLv2+ - See COPYING in the top level directory
* PURPOSE: Kernel-Mode Test Suite *WaitForMultipleObjects
* PROGRAMMER: Pierre Schweitzer <thomas.faber@reactos.org>
*/
#include <kmt_test.h>
#define NDEBUG
#include <debug.h>
static
VOID
NTAPI
KernelModeTest(IN PVOID Context)
{
NTSTATUS Status;
Status = ZwWaitForMultipleObjects(2, (void **)0x42424242, WaitAll, FALSE, NULL);
ok_eq_hex(Status, STATUS_ACCESS_VIOLATION);
}
START_TEST(ZwWaitForMultipleObjects)
{
NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE ThreadHandle;
PVOID ThreadObject = NULL;
/* We've to be in kernel mode, so spawn a thread */
InitializeObjectAttributes(&ObjectAttributes,
NULL,
OBJ_KERNEL_HANDLE,
NULL,
NULL);
Status = PsCreateSystemThread(&ThreadHandle,
SYNCHRONIZE,
&ObjectAttributes,
NULL,
NULL,
KernelModeTest,
NULL);
ok_eq_hex(Status, STATUS_SUCCESS);
if (Status == STATUS_SUCCESS)
{
/* Then, just wait on our thread to finish */
Status = ObReferenceObjectByHandle(ThreadHandle,
SYNCHRONIZE,
*PsThreadType,
KernelMode,
&ThreadObject,
NULL);
ObCloseHandle(ThreadHandle, KernelMode);
Status = KeWaitForSingleObject(ThreadObject,
Executive,
KernelMode,
FALSE,
NULL);
ok_eq_hex(Status, STATUS_SUCCESS);
ObDereferenceObject(ThreadObject);
}
}