Completion routine of irp generated with IoAllocateIrp

Hello,

according to W.Oney’s WDM-book the completion routine of every irp that
was allocated by IoAllocateIrp has to return
“STATUS_MORE_PROCESSING_REQUIRED”. Is this true in the case that the irp’s
IoStatus.Status is “STATUS_CANCELLED”, but definitely not by my driver?

Thank you!

Kind regards
Olav

Yes - it’s true in all cases.

If you created the IRP then you have also installed the last completion
routine. The I/O system assumes that if the last completion routine
doesn’t tell it to stop (ie, return STATUS_MORE_PROCESSING_REQUIRED)
that it can go ahead with copying the result back to the user-mode
initiator and notifying it.

If your driver created the IRP then there’s no user-mode initiator -
allowing the I/O system to perform this last stage of completion will
cause a system crash.

why not just have the I/O system check where the request came from?
It’s a good question and I’m not sure why the original design decision
was made but here are a couple of guesses:

  1. The I/O completion path has been incredibly optimized over the years.
    It’s a very heavily run path and I suspect we could see the cost of a
    few extra instructions.

  2. If the driver doesn’t repurpose or free the IRP in its I/O completion
    routine then it’s reasonable to assume the driver is about to leak the
    IRP. If the driver does repurpose or free the IRP then it needs to tell
    the I/O system about it so the I/O system doesn’t do something silly
    like free it.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Olav
Sent: Thursday, March 11, 2004 7:42 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Completion routine of irp generated with IoAllocateIrp

Hello,

according to W.Oney’s WDM-book the completion routine of every irp that
was allocated by IoAllocateIrp has to return
“STATUS_MORE_PROCESSING_REQUIRED”. Is this true in the case that the
irp’s
IoStatus.Status is “STATUS_CANCELLED”, but definitely not by my driver?

Thank you!

Kind regards
Olav


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com