Hi

I am doing a SYS driver (on NT/Win2k) that must Load/Unload itself dynamicaly and filter some input from the keyboard (ie not allow some keys to be typed in). So its a layered intermediate kernel mode driver :)

Inside the Dispatch_Read routine i use IoSetCompletionRoutine to set a callback to my code when the lower driver has done its job and has a key scancode for me.

All works ok, until i try to unload my driver. After unload any key will generate a nasty NT crash (not even a blue screen).

Now, if i comment out the IoSetCompletionRoutine, everything loads/unloads fine....but of course i can not filter keys anymore...


So i am asking if some NT driver guru knows how do i unset the job done by IoSetCompletionRoutine in a gracefully way ...

Any help will be appreciated
Thx
Posted on 2001-11-13 14:05:18 by BogdanOntanu
I'll take a quick shot :

http://www.osr.com/ddk/k104_5w6q.htm

Read through the comments near the bottom of the page.

Quote :

"Non-PnP drivers that might be unloaded before their IoCompletion routines execute should use IoSetCompletionRoutineEx instead."

OSR are THE PROS when it comes to kernel driver stuff. I encourage you to browse their website. Especially their archives of 'NT Insider' are a valuable source of information.

More on IoCompletition as I find it, coz I'll be facing the exact same thing very soon.
Posted on 2001-11-13 19:03:35 by jmp $FCE2
Thx Man,

I am reading it but it looks like this "Ex" function is available only on XP... my driver must work on NT4 and Win2k (hehe on Win9x also but there i use a Vxd in ASM :) )

So it has to be another solution ....

i hope :)
Posted on 2001-11-13 19:40:47 by BogdanOntanu
Posted on 2001-11-14 10:47:25 by jmp $FCE2
Thx again man

now i have to study,work,study,work ...
:alright:
Posted on 2001-11-14 12:18:36 by BogdanOntanu