mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:03:00 +00:00
[KMTESTS:IO]
[KMTESTS:OB] Simplify kernel mode thread creation svn path=/trunk/; revision=69417
This commit is contained in:
parent
0fbe4b9b8e
commit
5dc58d234a
2 changed files with 6 additions and 72 deletions
|
@ -871,10 +871,7 @@ UserModeTest(VOID)
|
||||||
|
|
||||||
START_TEST(IoCreateFile)
|
START_TEST(IoCreateFile)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
PKTHREAD ThreadHandle;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
||||||
HANDLE ThreadHandle;
|
|
||||||
PVOID ThreadObject = NULL;
|
|
||||||
|
|
||||||
TestSymlinks();
|
TestSymlinks();
|
||||||
|
|
||||||
|
@ -882,36 +879,6 @@ START_TEST(IoCreateFile)
|
||||||
UserModeTest();
|
UserModeTest();
|
||||||
|
|
||||||
/* We've to be in kernel mode, so spawn a thread */
|
/* We've to be in kernel mode, so spawn a thread */
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
ThreadHandle = KmtStartThread(KernelModeTest, NULL);
|
||||||
NULL,
|
KmtFinishThread(ThreadHandle, 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,42 +23,9 @@ KernelModeTest(IN PVOID Context)
|
||||||
|
|
||||||
START_TEST(ZwWaitForMultipleObjects)
|
START_TEST(ZwWaitForMultipleObjects)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
PKTHREAD ThreadHandle;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
||||||
HANDLE ThreadHandle;
|
|
||||||
PVOID ThreadObject = NULL;
|
|
||||||
|
|
||||||
/* We've to be in kernel mode, so spawn a thread */
|
/* We've to be in kernel mode, so spawn a thread */
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
ThreadHandle = KmtStartThread(KernelModeTest, NULL);
|
||||||
NULL,
|
KmtFinishThread(ThreadHandle, 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue