Same IRP appearing more than once?

From: Old Codger (OldCodger101_at_hotmail.com)
Date: 09/27/04


Date: 27 Sep 2004 03:40:11 -0700

Hi,

This is my first driver project so please excuse me if I have made a
basic mistake somewhere.

I am writing an upper filter driver for a serial port.

In my DispatchControl function I pass everything down to the lower
driver as follows (abbreviated):

    status = IoAcquireRemoveLock(&pdx->RemoveLock,Irp);
    if (!NT_SUCCESS(status))
    {
        return CompleteRequest(Irp, status, 0);
    }

    IoSkipCurrentIrpStackLocation(Irp);
    status = IoCallDriver(pdx->LowerDeviceObject,Irp);
    IoReleaseRemoveLock(&pdx->RemoveLock,Irp);
    return status;

After this has been running for a few seconds I get an ASSERT in my
DispatchControl function because of an incorrect IRQ level. I see that
IoCallDriver() has not immediately returned and that DispatchControl
has been called three times for the same Irp.

The sequence of events I see in the debugger is as follows (I have
numbered the Irp's as 1,2,3 etc in order of appearance).

DispatchControl entered for IRP 1
IoCallDriver called for IRP 1
IoCallDriver returns STATUS_SUCCESS for IRP 1 (This one was OK)

DispatchControl entered for IRP 2
IoCallDriver called for IRP 2 (Does not immediately return)

DispatchControl entered for IRP 2 *FOR 2ND TIME*
IoCallDriver called for IRP 2 (Does not immediately return)

DispatchControl entered for IRP 3
IoCallDriver called for IRP 3
IoCallDriver returns STATUS_PENDING for IRP 3

IoCallDriver returns STATUS_SUCCESS for IRP 2

IoCallDriver returns STATUS_SUCCESS for IRP 2 *FOR 2ND TIME*

DispatchControl entered for IRP 4
IoCallDriver called for IRP 4 (Does not immediately return)

DispatchControl entered for IRP 2 *FOR 3RD TIME*
ASSERT fires Pageable code called at IRQL2.

Note that this failure only appears to occur when IoCallDriver has
returned STATUS_PENDING, all other times it returns STATUS_SUCCESS.

If I continue in the debugger with "g" the driver continues to run
(but with the same ASSERT occurring).

The only other thing to note is that I also have DispatchRead (with a
completion function) and DispatchWrite functions which appear to be
called correctly.

Thanks for any help received

O.C.



Relevant Pages

  • Re: Bugcheck code D5 in USB driver - very peculiar!
    ... Your suggestion about not touching the IRP led me back to the bulk USB ... which I was told my driver is based on. ... IoCallDriver, unless you made some special precautions to stop IO completion ... completion routine, and then call IoCallDriver. ...
    (microsoft.public.development.device.drivers)
  • Re: Multiple PCI card problem in my Start Device routine??
    ... Sounds like you are corrupting the IRP somehow. ... The call to IoCallDriver was located in a separate subroutine, ... directly into my StartDevice routine and that error went away, ... For some reason it appears that when the second driver gets installed, ...
    (microsoft.public.development.device.drivers)
  • Re: IOSetCompletion Routine?
    ... The status pending will occur when the next lower driver returns from its ... IoCopyCurrentIrpStackLocationToNext(Irp); ... As per my inderstanding IOCallDriver will pass the IRP to next lower ... Then this next lower driver will process the IRP and after fininshing it's ...
    (microsoft.public.development.device.drivers)
  • Question for layered driver in win 98
    ... I develop a layered driver in windows 2000. ... use IoCallDriver() to send the IRP to the lower device. ... STATUS_INVALID_PARAMETER and the lower driver don't recieve the IRP build by ...
    (microsoft.public.development.device.drivers)
  • Re: drive present detection?
    ... the free space of all online drives. ... If the underlying device driver determines that the media has not ... changed, the driver should complete the IRP, returning the IoStatus ...
    (microsoft.public.win32.programmer.kernel)