From - Wed Sep 24 08:05:39 1997 Path: news.mitre.org!blanket.mitre.org!agate!newsgate.duke.edu!nntprelay.mathworks.com!newsfeed.direct.ca!news.he.net!newshub.cts.com!newsfeed.cts.com!cmkrnl!jeh From: jeh@cmkrnl.com (Jamie Hanrahan) Newsgroups: comp.os.ms-windows.programmer.nt.kernel-mode Subject: Re: CurrentIrp == NULL in my ISR Message-ID: <1997Sep23.183233.8218@cmkrnl> Date: 23 Sep 97 18:32:33 PST References: <34283cbd.349053059@news.connectnet.com> Organization: Kernel Mode Systems, San Diego, CA Lines: 58 In article <34283cbd.349053059@news.connectnet.com>, jvasquez@getntds.com writes: > Why is my deviceObject->currentIrp == NULL in my ISR? > Should I be setting that field to my IRP just before I kick off the > interrupt? (I could swear I answered this recently, but here goes again:) The only things in the system that change this field are IoStartPacket and IoStartNextPacket. Put it this way - these routines do approximately this (ignoring details of cancels, spinlocks, the Key argument, and so on): IoStartPacket(dvcObj, Irp) { if (dvcObj->DeviceQueue.Busy) { insert IRP on device queue } else { dvcObj->DeviceQueue.Busy = TRUE; dvcObj->CurrentIrp = Irp; call StartIo routine (dvcObj, newIrp); } } IoStartNextPacket(dvcObj) { dvcObj->CurrentIrp = NULL; remove IRP from head of queue, store addr in newIrp if (queue was empty) { dvcObj->DeviceQueue.Busy = TRUE; } else { dvcObj->CurrentIrp = newIrp; call StartIo routine (dvcObj, newIrp); } } If you don't use IoStart[Next]Packet this field will always be NULL unless you change it yourself -- and there is probably no real reason to do so; since if you aren't using IoStart[Next]Packet it's probably because you support more than one "current" IRP, so having a single pointer to "the current IRP" would make no sense anyway. If you ARE using IoStart[Next]Packet and you find that this field is NULL in your ISR, it means that you've already called IoStartNextPacket before the ISR was invoked, and IoStartNextPacket found no more IRPs on the the DeviceQueue. Along with clearing the DeviceQueue->Busy bit, IoStartNextPacket NULLs the CurrentIrp pointer when the device queue is empty. And these are the ONLY two things in the system that manipulate the dvcObj->DeviceQueue.Busy or dvcObj->CurrentIrp . --- Jamie Hanrahan, Kernel Mode Systems, San Diego CA Internet: jeh@cmkrnl.com (JH645) CompuServe: 74140,2055 drivers, internals, networks, applications, and training for VMS and Windows NT NT driver FAQ, links, and other information: http://www.cmkrnl.com/ If you post a reply in news, please don't e-mail it too.