diff --git a/rostests/kmtests/CMakeLists.txt b/rostests/kmtests/CMakeLists.txt index b9741b441d8..b17c970ec3b 100644 --- a/rostests/kmtests/CMakeLists.txt +++ b/rostests/kmtests/CMakeLists.txt @@ -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 diff --git a/rostests/kmtests/kmtest_drv/testlist.c b/rostests/kmtests/kmtest_drv/testlist.c index b97b6591f52..9a471b697b9 100644 --- a/rostests/kmtests/kmtest_drv/testlist.c +++ b/rostests/kmtests/kmtest_drv/testlist.c @@ -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 } }; diff --git a/rostests/kmtests/ntos_ob/ObWait.c b/rostests/kmtests/ntos_ob/ObWait.c new file mode 100644 index 00000000000..82e4b1af225 --- /dev/null +++ b/rostests/kmtests/ntos_ob/ObWait.c @@ -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 + */ + +#include + +#define NDEBUG +#include + +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); + } +}