Re: Changing Irp->IoStatus.Status in a completion routine

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



As long as the dispatch routine returns the same status OR STATUS_PENDING.

So if you think you may change the IRP status in your completion routine you should return STATUS_PENDING in your dispatch routine (and mark the IRP pending, etc...)

The verifier will get pissy if the dispatch routine and the IO status block contain different values on completion (except for the pending case)

-p

--
This posting is provided "AS IS" with no warranties, and confers no rights.


"Doron Holan [MSFT]" <doronh@xxxxxxxxxxxxxxxxxxxx> wrote in message news:e7Qnio1bIHA.1376@xxxxxxxxxxxxxxxxxxxxxxx
yes, it is valid to change the status.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Jeff" <jeff@xxxxxxxxxxxxxxxxx> wrote in message news:OW5TphvbIHA.5984@xxxxxxxxxxxxxxxxxxxxxxx
Hi again,

I have one more question. Is it ok to change Irp->IoStatus.Status from STATUS_SUCCESS to an error code in a completion routine? I've found lots of information about completion routines, marking Irps pending and returning STATUS_CONTINUE_COMPLETION or STATUS_MORE_PROCESSING_REQUIRED but so far nothing that tells me if I can legally change the Irp->IoStatus.Status value.

If we can do this, do we need to do anything else like complete the request again, or changing the status value ok.

TIA,

Jeff.

.



Relevant Pages

  • Re: IoMarkIrpPending(Irp) / IoUnmarkPendingIrp(Irp)
    ... if you mark an irp pending in a dispatch routine, ... > I/O stack location. ...
    (microsoft.public.development.device.drivers)
  • Re: Dispatch and Completion routine synchronisation
    ... becuase irp is now an invalid pointer as you have completed it. ... You should enable driver verifier on your driver as well, it can find many of these common mistakes. ... In a dispatch routine, I set a completion routine and then forward the ... at the moment my completion routine is tiny and looks a little like ...
    (microsoft.public.development.device.drivers)
  • Re: IRP(s)
    ... if you have a completion routine set, ... The IRP may not be completed ... if from a system thread I call IoCompleteRequest it will complete ... >>> from place other than the dispatch routine. ...
    (microsoft.public.development.device.drivers)
  • Re: Irp->AssociatedIrp.SystemBuffer after IRP_MJ_INTERNAL_DEVICE_CONTROL causes BugCheck
    ... Originally I was allocating with ExAllocatePoolWithTag, ... where to put this pointer -- I tried a few different fields of the IRP ... the return value from the dispatch routine affected what the I/O Manager did ... > your completion routine. ...
    (microsoft.public.development.device.drivers)
  • Re: Dispatch and Completion routine synchronisation
    ... In a dispatch routine, I set a completion routine and then forward the Irp ... to the lower driver. ...
    (microsoft.public.development.device.drivers)