How to make passive level thread using psCreate...?

status = PsCreateSystemThread( &threadHandle, THREAD_ALL_ACCESS, NULL, NULL, NULL,DebugPrintSystemThread, NULL);

When I create thread withing the WDM using above code, it seems to be in the dispatch level.
I want thread’s running level to be passive.
How can I make such a thread?

Threads always start running in PASSIVE_LEVEL. The thread must be doing something to raise its own IRQL. You need to get the thread to not raise the IRQL or to finish whatever it needed raised IRQL for so it returns to PASSIVE_LEVEL.

Is the thread holding a spinlock? This is one common way the IRQL level is raised.

Jan

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@daum.net
Sent: Monday, December 03, 2012 5:43 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to make passive level thread using psCreate…?

status = PsCreateSystemThread( &threadHandle, THREAD_ALL_ACCESS, NULL, NULL, NULL,DebugPrintSystemThread, NULL);

When I create thread withing the WDM using above code, it seems to be in the dispatch level.
I want thread’s running level to be passive.
How can I make such a thread?

A thread runs at PASSIVE_LEVEL unless you have done something to raise its
IRQL level.

(a) why do you think it is at DISPATCH_LEVEL?
(b) Are you using spin locks in the thread?

That’s just a start.

status = PsCreateSystemThread( &threadHandle, THREAD_ALL_ACCESS, NULL,
NULL, NULL,DebugPrintSystemThread, NULL);

When I create thread withing the WDM using above code, it seems to be in
the dispatch level.
I want thread’s running level to be passive.
How can I make such a thread?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer