[KMTESTS:IO]
[reactos.git] / rostests / kmtests / ntos_ob / ObWait.c
index 82e4b1a..7d2b712 100644 (file)
@@ -23,42 +23,9 @@ KernelModeTest(IN PVOID Context)
 
 START_TEST(ZwWaitForMultipleObjects)
 {
-    NTSTATUS Status;
-    OBJECT_ATTRIBUTES ObjectAttributes;
-    HANDLE ThreadHandle;
-    PVOID ThreadObject = NULL;
+    PKTHREAD ThreadHandle;
 
     /* 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);
-    }
+    ThreadHandle = KmtStartThread(KernelModeTest, NULL);
+    KmtFinishThread(ThreadHandle, NULL);
 }