From: Roddy, Mark [Mark_Roddy@stratus.com] Sent: Tuesday, January 09, 2001 9:15 AM To: NT Developers Interest List Subject: [ntdev] RE: IRQL question In the case of a standalone or topmost driver, and assuming that we are not discussing filesystem drivers here, your dispatch routines will always be called at PASSIVE_LEVEL. However, not all drivers are at the top of the stack, and even if they are, somebody else could install a filter driver above your 'topmost' driver. Once there is another driver above you then it is not true that you must always be called at PASSIVE_LEVEL, it is instead the much weaker: you will generally be called at less than DISPATCH_LEVEL. There are a few examples of driver stacks where some IRP dispatching occurs at DISPATCH_LEVEL, although in my opinion, despite the terminology relationship, this is rather rude. If you have your own standalone monolithic topmost driver, then you can simply enforce your own rule that IO requests must arrive at PASSIVE_LEVEL. This may screw up a filter driver that acquires one of the synchronization primitives that raise to APC_LEVEL, but that is a problem for the filter driver. How to enforce this? Just complete the incoming irp with an error if the IRQL is too high. Another, 'nicer' approach is to test the IRQL level and if it is inappropriate for your requirements, queue the IRP for background processing by a worker thread (running at PASSIVE_LEVEL,) mark the IRP pending, setup a cancel routine (etc. etc. and not in the order stated here,) and return STATUS_PENDING to the caller. Mark Roddy markr@hollistech.com www.hollistech.com WindowsNT Windows 2000 Consulting Services > -----Original Message----- > From: Barak Mandelovich [mailto:barak@mercury.co.il] > Sent: Tuesday, January 09, 2001 9:05 AM > To: NT Developers Interest List > Subject: [ntdev] IRQL question > > > Hi, Guys! > > I did some "research" about IRQ levels etc., and I think I > understand it > better now. > Just one thing that I still do not understand: > > Let's say that I read from my driver using ReadFile(). > This function is called in IRQ_PASSIVE_LEVEL. > > Now, why should I check the IRQL in the function that takes > care of ReadFile > inside > the driver? I mean - is there a chance that this function > would be called in > IRQL > IRQ_PASSIVE_LEVEL ? > How? > > If it cannot happen - can you please give an example of when > it CAN happen > (A general case, with any kind of IoCtl )? > > Now, let's say that I check IRQL, and it's not the correct > level - what > should I do next? > After all - I should return an answer to the user, and I > don't think that a > "failure" message is the correct one to return. > > thanks in advance, > > - Barak > > -------------------------------------------------------------- > ---------- > Barak Mandelovich barak@mercury.co.il > Mercury Interactive ltd. > -------------------------------------------------------------- > ---------- > > > --- > You are currently subscribed to ntdev as: mark_roddy@stratus.com > To unsubscribe send a blank email to leave-ntdev-247T@lists.osr.com > --- You are currently subscribed to ntdev as: GlennEverhart@FirstUSA.com To unsubscribe send a blank email to leave-ntdev-247T@lists.osr.com