problem with cancel routine for Irp

Hi

I am having a problem with completing an Irp passed down to my driver from a
user application. Basicily my application uses a DeviceIOControl call. In my
driver I set a cancel routine with the IoSetCancelRoutine command, and then
I call IoMarkIrpPending and set the status to STATUS_PENDING. I try to
complete this Irp when an interupt is sent from my usb device. To complete
the Irp I call “IoCompleteRequest(pIrp, IO_NO_INCREMENT)” with the
IoStatus.Status set to STATUS_SUCCESS.

The problem I’m having is when the IoCompleteRequest call is made I get the
following error.

Error=C9 (DRIVER_VERIFIER_IOMANAGER_VIOLATION)
p1=7 p2=f7a7d4a7 p3=81c68488 p4=0

The documentation says “IoCompleteRequest called with cancel routine still
set”
I try setting calling “IoSetCancelRoutine(Irp, NULL);” and setting the
“Irp->cancel = False;” before I do the IoCompleteRequest but I still get
this error.

If I don’t set the completion routine initially the Irp is completed with
out any errors. But if my device never generates an interrupt and therefore
the Irp is never completed, my application will not close properly.

any help or insight to this problem will be great,

Thanks

Matthew Tse


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

problem with cancel routine for Irp"Matthew Tse"
wrote in message news:xxxxx@ntdev…
>The problem I’m having is when the IoCompleteRequest call is made I get the
following error.
>Error=C9 (DRIVER_VERIFIER_IOMANAGER_VIOLATION)
>p1=7 p2=f7a7d4a7 p3=81c68488 p4=0

Sorry, dude. The only thing that gets you
DRIVER_VERIFIER_IOMANAGER_VIOLATION and P1=7 is if Irp->CancelRoutine is
non-zero. (we’re talkin Win2K here?)

You’re certainly “doing the right thing” by calling IoSetCancelRoutine(Irp,
NULL). What does IoSetCancelRoutine RETURN? Is it possible that you’re
racing against your IRP’s cancellation??

The address of the cancel routine is in P2 (oxf7a7d4a7 in your example)…
Does it point to your cancel routine??

Just one more example of why I/O Cancellation is a pain in the ass. That’s
why I usually tell people to either not implement it, or use the cancel
safe queuing functions (which are supported on both Win2K and WinXP).

Peter
OSR


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hi Peter,

thanks for your help. I went over my code and seem to have found the
problem. In my function there were two Irps and I ended up setting the
wrong Irp’s cancel routine to NULL. But I did set the correct Irp’s cancel
flag to false. What I don’t understand is if my cancel flag is set why did
the IOCompleteRequest fail?

(thanks for your patience as this is the first driver I am writing)

Matthew Tse


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Its always been my understanding that Irp->Cancel is read-only to drivers. Only the I/O manager is allowed to change it (except
of course when its been returned to the driver that originally issued it).
----- Original Message -----
From:
To: “NT Developers Interest List”
Sent: Friday, August 31, 2001 11:20 AM
Subject: [ntdev] Re: problem with cancel routine for Irp

> Hi Peter,
>
> thanks for your help. I went over my code and seem to have found the
> problem. In my function there were two Irps and I ended up setting the
> wrong Irp’s cancel routine to NULL. But I did set the correct Irp’s cancel
> flag to false. What I don’t understand is if my cancel flag is set why did
> the IOCompleteRequest fail?
>
> (thanks for your patience as this is the first driver I am writing)
>
> Matthew Tse
>
> —
> You are currently subscribed to ntdev as: xxxxx@syssoftsol.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Dave is right. Your driver should only read the cancel flag, not set it.

Gary G. Little
Staff Engineer
Broadband Storage, Inc.
xxxxx@broadstor.com

-----Original Message-----
From: Dave Harvey [mailto:xxxxx@syssoftsol.com]
Sent: Thursday, September 13, 2001 7:49 PM
To: NT Developers Interest List
Subject: [ntdev] Re: problem with cancel routine for Irp

Its always been my understanding that Irp->Cancel is read-only to drivers.
Only the I/O manager is allowed to change it (except
of course when its been returned to the driver that originally issued it).
----- Original Message -----
From:
To: “NT Developers Interest List”
Sent: Friday, August 31, 2001 11:20 AM
Subject: [ntdev] Re: problem with cancel routine for Irp

> Hi Peter,
>
> thanks for your help. I went over my code and seem to have found the
> problem. In my function there were two Irps and I ended up setting the
> wrong Irp’s cancel routine to NULL. But I did set the correct Irp’s cancel
> flag to false. What I don’t understand is if my cancel flag is set why did
> the IOCompleteRequest fail?
>
> (thanks for your patience as this is the first driver I am writing)
>
> Matthew Tse
>
> —
> You are currently subscribed to ntdev as: xxxxx@syssoftsol.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@broadstor.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com