RE: what we need to do When CancelIo request is made in Application

Yes all IRPs for that thread are cancelled, well, it is better said that
their cancel routines will be called. If you have not set a cancel routine
for an IRP then that IRP will not be cancelled. This will cause nasty-grams
from driver verifier and an unloadable driver.

Gary

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Srinivasa Rao Deevi
Sent: Sunday, September 09, 2001 11:50 AM
To: NT Developers Interest List
Subject: [ntdev] RE: what we need to do When CancelIo request is made
in Application

Hi Mark

Thanks for the reply.

Is that means when “CancelIo” call is made from the application , all pended
IRP’s Cancel routines are called for that particular thread ? If there is no
cacncel routine for that particulat IRP what happens ? I could not find any
information related to this . Any help in this regard is appreciated . I
wanted to know what happens in case of "Synchronization with out cancel
routines " . I guess in this case when ever these IRP’s are cancelled by the
Io Manager the completion routine of that IRPs pended should be called
because InvokeOnCancel bit is set . But When I tested this, the cancelIo
call did not call any cancellation of IRP and my completion routine was
never called until I close the handle for the device . Am I missing
something here ?

Thanks in advance
srinivas

-----Original Message-----
From: Mark Roddy [mailto:xxxxx@hollistech.com]
Sent: Saturday, September 08, 2001 6:53 PM
To: NT Developers Interest List
Subject: [ntdev] RE: what we need to do When CancelIo request is made in
Application

If you queue IRPs, marking the IRPs as pending and returning
STATUS_PENDING from the dispatch routine for those IRPs, then the
IoManager may attempt to perform cancel processing on those IRPs, as a
consequence of thread termination or explicit thread action (CancelIo.)
See the DDK for documentation about IoSetCancelRoutine and related
documentation regarding cancel processing in drivers. The idea is that
your driver is responsible for satisfying the notification that the
originating application no longer is interested in performing the
request(s), typically by dequeueing and completing the indicated IRP(s).
It has to be your driver in the case where you ‘pended’ the IRP, as only
your driver really knows where the IRP is queued, and how to unqueue it
and complete it.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
Srinivasa Rao Deevi
Sent: Saturday, September 08, 2001 9:37 PM
To: NT Developers Interest List
Subject: [ntdev] what we need to do When CancelIo request is
made in Application

Hi all

I have a doubt about “CancelIo” request . What we need to do
in the driver level when we receive the request "CancelIo(
Handle to the device ) ? can anybody tell me How this logic works ?

Thanks in advance
srinivas


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


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


You are currently subscribed to ntdev as: xxxxx@inland.net
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

Srinivas,

If you do not set a cancel routine for an IRP and you do return
STATUS_PENDING (and call IoMarkIrpPending) from the dispatch routine for
that IRP then the IoManager will wait 5 minutes for that IRP to complete
on its own. If the five minutes elapses, a popup dialog box will inform
the desktop observers that YOUR driver is not behaving correctly, a
similar message will go into the system event log. The resources
associated with that IRP may be lost until the system is restarted (or
the containing process terminates.)

This is generally behavior you want to avoid. If you pend the IRP, set a
cancel routine for that IRP. The DDK is full of bad examples of how to
manage cancel processing :slight_smile:

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
Srinivasa Rao Deevi
Sent: Sunday, September 09, 2001 2:50 PM
To: NT Developers Interest List
Subject: [ntdev] RE: what we need to do When CancelIo request
is made in Application

Hi Mark

Thanks for the reply.

Is that means when “CancelIo” call is made from the
application , all pended IRP’s Cancel routines are called for
that particular thread ? If there is no cacncel routine for
that particulat IRP what happens ? I could not find any
information related to this . Any help in this regard is
appreciated . I wanted to know what happens in case of
"Synchronization with out cancel routines " . I guess in this
case when ever these IRP’s are cancelled by the Io Manager
the completion routine of that IRPs pended should be called
because InvokeOnCancel bit is set . But When I tested this,
the cancelIo call did not call any cancellation of IRP and my
completion routine was never called until I close the handle
for the device . Am I missing something here ?

Thanks in advance
srinivas

-----Original Message-----
From: Mark Roddy [mailto:xxxxx@hollistech.com]
Sent: Saturday, September 08, 2001 6:53 PM
To: NT Developers Interest List
Subject: [ntdev] RE: what we need to do When CancelIo request
is made in Application

If you queue IRPs, marking the IRPs as pending and returning
STATUS_PENDING from the dispatch routine for those IRPs, then
the IoManager may attempt to perform cancel processing on
those IRPs, as a consequence of thread termination or
explicit thread action (CancelIo.) See the DDK for
documentation about IoSetCancelRoutine and related
documentation regarding cancel processing in drivers. The
idea is that your driver is responsible for satisfying the
notification that the originating application no longer is
interested in performing the request(s), typically by
dequeueing and completing the indicated IRP(s). It has to be
your driver in the case where you ‘pended’ the IRP, as only
your driver really knows where the IRP is queued, and how to
unqueue it and complete it.

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
> Srinivasa Rao Deevi
> Sent: Saturday, September 08, 2001 9:37 PM
> To: NT Developers Interest List
> Subject: [ntdev] what we need to do When CancelIo request is
> made in Application
>
>
> Hi all
>
> I have a doubt about “CancelIo” request . What we need to do
> in the driver level when we receive the request "CancelIo(
> Handle to the device ) ? can anybody tell me How this logic works ?
>
> Thanks in advance
> srinivas
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@hollistech.com To unsubscribe send a blank email to
> leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>


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


You are currently subscribed to ntdev as:
xxxxx@hollistech.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

----- Original Message -----
From: “Gary G. Little”
To: “NT Developers Interest List”
Sent: Sunday, September 09, 2001 4:05 PM
Subject: [ntdev] RE: what we need to do When CancelIo request is made in Application

> Yes all IRPs for that thread are cancelled, well, it is better said that
> their cancel routines will be called. If you have not set a cancel routine
> for an IRP then that IRP will not be cancelled. This will cause nasty-grams
> from driver verifier and an unloadable driver.
>
Regardless of whether there is a cancel routine Irp->Cancel will be set, and can be tested for.
If you do have a cancel routine, its perfectly valid to cancel any IRP with Irp->Cancel set.

It would be correct (even if braindead) to never set a cancel routine, and to poll your IRP queue looking irp->Cancel once a
second.

Its also possible for the IRP to be cancelled before you set your cancel routine, or after you’ve cleared it. The former is why
Irp->Cancel is a critical part of canceling.

Understanding this was critical in NT4, but the newer documentation, and new support functions have make IRP cancelation merely
a question of whether you followed the rules.

If your driver finishes IRPs in a finite amount of time (e.g., a disk driver), you need not
support cancel at all.

> Gary
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Srinivasa Rao Deevi
> Sent: Sunday, September 09, 2001 11:50 AM
> To: NT Developers Interest List
> Subject: [ntdev] RE: what we need to do When CancelIo request is made
> in Application
>
> Hi Mark
>
> Thanks for the reply.
>
> Is that means when “CancelIo” call is made from the application , all pended
> IRP’s Cancel routines are called for that particular thread ? If there is no
> cacncel routine for that particulat IRP what happens ? I could not find any
> information related to this . Any help in this regard is appreciated . I
> wanted to know what happens in case of "Synchronization with out cancel
> routines " . I guess in this case when ever these IRP’s are cancelled by the
> Io Manager the completion routine of that IRPs pended should be called
> because InvokeOnCancel bit is set . But When I tested this, the cancelIo
> call did not call any cancellation of IRP and my completion routine was
> never called until I close the handle for the device . Am I missing
> something here ?
>
> Thanks in advance
> srinivas
>
>
> -----Original Message-----
> From: Mark Roddy [mailto:xxxxx@hollistech.com]
> Sent: Saturday, September 08, 2001 6:53 PM
> To: NT Developers Interest List
> Subject: [ntdev] RE: what we need to do When CancelIo request is made in
> Application
>
>
> If you queue IRPs, marking the IRPs as pending and returning
> STATUS_PENDING from the dispatch routine for those IRPs, then the
> IoManager may attempt to perform cancel processing on those IRPs, as a
> consequence of thread termination or explicit thread action (CancelIo.)
> See the DDK for documentation about IoSetCancelRoutine and related
> documentation regarding cancel processing in drivers. The idea is that
> your driver is responsible for satisfying the notification that the
> originating application no longer is interested in performing the
> request(s), typically by dequeueing and completing the indicated IRP(s).
> It has to be your driver in the case where you ‘pended’ the IRP, as only
> your driver really knows where the IRP is queued, and how to unqueue it
> and complete it.
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of
> > Srinivasa Rao Deevi
> > Sent: Saturday, September 08, 2001 9:37 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] what we need to do When CancelIo request is
> > made in Application
> >
> >
> > Hi all
> >
> > I have a doubt about “CancelIo” request . What we need to do
> > in the driver level when we receive the request "CancelIo(
> > Handle to the device ) ? can anybody tell me How this logic works ?
> >
> > Thanks in advance
> > srinivas
> >
> > —
> > You are currently subscribed to ntdev as:
> > xxxxx@hollistech.com To unsubscribe send a blank email to
> > leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@transilica.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
> —
> You are currently subscribed to ntdev as: xxxxx@inland.net
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>
> —
> 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