From: Prakash Manannavar on
Hi all,


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.
From: Scott Noone on
> Is it a right thing to wait for an event with KeWaitForSingleObject in the
> Completion/Cancellation Routine?

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" <PrakashManannavar(a)discussions.microsoft.com> wrote in
message news:8488E223-4807-4EA5-A58F-299EA6E0DC9A(a)microsoft.com...
> Hi all,
>
>
> 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.


From: Prakash Manannavar on
Thanks Scott,

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 A Manannavar,
Bangalore/Bengaluru.

From: David Craig on
NO!!! That will/can cause priority inversion.

"Prakash Manannavar" <PrakashManannavar(a)discussions.microsoft.com> wrote in
message news:BAD738A5-ECE4-4D4B-8CA5-588A2232CD9D(a)microsoft.com...
> Thanks Scott,
>
> 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 A Manannavar,
> Bangalore/Bengaluru.
>


From: Tim Roberts on
Prakash Manannavar <PrakashManannavar(a)discussions.microsoft.com> wrote:
>
>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?

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, timr(a)probo.com
Providenza & Boekelheide, Inc.
 |  Next  |  Last
Pages: 1 2
Prev: Vista Unsigned Driver Issue
Next: ndis 5.1 in windows 7