Is it a right thing to wait for an event with KeWaitForSingleObject in the
Completion/Cancellation Routine?
In DDK reference, it has been told that, caller for KeWaitForSingleObject
can run at IRQL <= DISPATCH_LEVEL. Even Cancell routines will run at IRQL <=
DISPATCH_LEVEL.
--
~~~~~
Prakash A Manannavar,
Bangalore/Bengaluru.
No, that is not a good idea. As you noted this may break the IRQL rules as
completion/cancel routines can be called at IRQL DISPATCH_LEVEL.
--
Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com
"Prakash Manannavar" <PrakashM...@discussions.microsoft.com> wrote in
message news:8488E223-4807-4EA5...@microsoft.com...
I have some issues,
1. If waiting with KeWaitForSingleObejct at IRQL <= DISPATCH_LEVEL, Is there
any specific reason which has been supported by OS?
2. I read KeRaiseIrql and KeLowerIrql functions, As I read we can raise IRQL
first and then we can lower it to the previous level. Is there any functions
to lower the IRQL and then raise it to the previous level?
"Prakash Manannavar" <PrakashM...@discussions.microsoft.com> wrote in
message news:BAD738A5-ECE4-4D4B...@microsoft.com...
Think about what you're asking. The reason you run at an increased IRQL is
to make sure your code can't be interrupted by lower level code. AS SOON
AS you lower your IRQL, your code will be interrupted by lower level code.
The RIGHT way do to this is to queue up a work item with IoQueueWorkItem.
The callback will be called at PASSIVE_LEVEL.
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.
> The RIGHT way do to this is to queue up a work item with IoQueueWorkItem.
> The callback will be called at PASSIVE_LEVEL.
I would like to add that OP could move his KeWaitForSingleObject into
work item or created system thread and synchronize the work item with
a drivers Completion/Cancellation Routine. It is little bit
complicated but it is safe for sure.
Igor Sharovar
d
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"David Craig" <dri...@noemail.noemail> wrote in message
news:OkgjzUaa...@TK2MSFTNGP06.phx.gbl...
Now I have created WorkItem and queuing it.
In DDK it has been told that "caller of KeWaitForSingleObject can be run at
IRQL <= DISPATCH LEVEL"
I wanted to know that, is there any specific scenarios we can wait there??
I would also use the WDK and not a DDK. Version 7.0.0 A.K.A. 7600.16385.0
is the most recent and supports back to XP.
The documentation describes how you can use KeWFSO. You can 'wait' at
DISPATCH_LEVEL or lower, however the 'wait' at DISPATCH_LEVEL must be zero,
which makes it a test and not a real wait. In the wrong context waiting at
APC_LEVEL can cause a deadlock, though that is usually only in the file
systems area.
"Prakash Manannavar" <PrakashM...@discussions.microsoft.com> wrote in
message news:D7855A81-20EA-4711...@microsoft.com...