In a code snippet of a dispatch from my driver that works with irql = dispatch_level, I have a zw ... function that works on passive_level. How to solve this problem? Kelowerirql? Pscreatethread?
PsCreateSystemThread can be called only on PASSIVE_LEVEL.
KeLowerIrql SHOULD NOT be used this way.
One of the right ways of doing this is to execute the Zw routine in a workitem (ExInitializeWorkItem/IoAllocateWorkItem, ExQueueWorkItem). The execution is asynchronous.