From: Pierre Schweitzer Date: Tue, 29 Sep 2015 18:43:35 +0000 (+0000) Subject: [KMTESTS:IO] X-Git-Tag: ReactOS-0.4.0~630 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=5dc58d234a082c5dc1e8abb01b2895675d68e4ce;hp=0fbe4b9b8e73e2a6a2a3534f4278da6336c7e172;ds=sidebyside [KMTESTS:IO] [KMTESTS:OB] Simplify kernel mode thread creation svn path=/trunk/; revision=69417 --- diff --git a/rostests/kmtests/ntos_io/IoCreateFile.c b/rostests/kmtests/ntos_io/IoCreateFile.c index 9c35a08d905..ae4294b011d 100644 --- a/rostests/kmtests/ntos_io/IoCreateFile.c +++ b/rostests/kmtests/ntos_io/IoCreateFile.c @@ -871,10 +871,7 @@ UserModeTest(VOID) START_TEST(IoCreateFile) { - NTSTATUS Status; - OBJECT_ATTRIBUTES ObjectAttributes; - HANDLE ThreadHandle; - PVOID ThreadObject = NULL; + PKTHREAD ThreadHandle; TestSymlinks(); @@ -882,36 +879,6 @@ START_TEST(IoCreateFile) UserModeTest(); /* 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); } diff --git a/rostests/kmtests/ntos_ob/ObWait.c b/rostests/kmtests/ntos_ob/ObWait.c index 82e4b1af225..7d2b71220a7 100644 --- a/rostests/kmtests/ntos_ob/ObWait.c +++ b/rostests/kmtests/ntos_ob/ObWait.c @@ -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); }