Hi,
When I disable my driver, my event callback routines registered with KMDF
get invoked.
The driver receives IRP_MN_QUERY_REMOVE and once the callback routine
processes this IRP
and returns (is completed), the cancel routine that my driver registered
for IRPs that were received by
driver earlier get called for a no. of times.
Question:
- Who calls this cancel routine? Is it some application shipped along with
my driver package or the PnP/IO manager
takes care of calling cancellation routines for all my IRPs that my
driver had not completed earlier?
Does PnP/IO manager know that my driver is getting disabled(removed) and
hence invokes cancel routines for all
the IRPs that was not completed earlier by the driver?
Does OS keep track of all these IRPs not completed? Or is the framework?
- Once these cancel routines are executed, I dont see
EvtDeviceReleaseHardware() getting executed.
Is my driver EvtDeviceReleaseHardware() not getting executed because the
driver did not complete all the IRPs when the
cancel routine got called?
Is this the reason why disable of driver did not go through throwing out a
message:
“Hardware settings have changed. System needs to be restarted”.
Regards,
-Praveen
-
cancelation is either explicit (the app calls CancelIo(Ex) or a
driver calls IoCancelIrp) or implicit (a handle is closed and the i/o
manager runs down the list of irps on the handle). Pnp manager is only
involved in the sense that it tells the creator of the handle that the
underlying stack is going away, it has nothing to do with the requests
themselves
-
are you equating EvtIoStop with a cancel routine? You will not get
a EvtDeviceReleaseHardware in the query remove->remove path until the
remove has been sent and all WDFQUEUEs (power and non power managed) are
purged. Who is sending your driver i/o, an app or a driver (perhaps
through a stack loaded on one of your PDOs)? If you are getting a
restart message someone (app or driver) who had a handle open to your
driver did not close it. The setup logs should tell you more.
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Praveen Kumar
Amritaluru
Sent: Wednesday, November 15, 2006 6:25 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] When does cancel routine set for an IRP by driver get
executed?
Hi,
When I disable my driver, my event callback routines registered with
KMDF
get invoked.
The driver receives IRP_MN_QUERY_REMOVE and once the callback routine
processes this IRP
and returns (is completed), the cancel routine that my driver
registered
for IRPs that were received by
driver earlier get called for a no. of times.
Question:
- Who calls this cancel routine? Is it some application shipped along
with
my driver package or the PnP/IO manager
takes care of calling cancellation routines for all my IRPs that my
driver had not completed earlier?
Does PnP/IO manager know that my driver is getting disabled(removed)
and
hence invokes cancel routines for all
the IRPs that was not completed earlier by the driver?
Does OS keep track of all these IRPs not completed? Or is the
framework?
- Once these cancel routines are executed, I dont see
EvtDeviceReleaseHardware() getting executed.
Is my driver EvtDeviceReleaseHardware() not getting executed because
the
driver did not complete all the IRPs when the
cancel routine got called?
Is this the reason why disable of driver did not go through throwing
out a
message:
“Hardware settings have changed. System needs to be restarted”.
Regards,
-Praveen
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
Hi,
I registered EvtIoStop and EvtIoResume during initialization of kmdf
driver, that takes
care of informing framework/pnp that my driver would like to retain IRPs
and process it later.
With these changes suggested by Doron, major problem got rectified. This
solved crash I used to saw everytime
driver got disabled.
No, I am not equating EvtIoStop with cancel routine. My driver has cancel
routines registered properly for all the IRPs.
So, if the IRP is cancelled for whatever the reason, the cancel routines
are getting called properly.
There was no issue with the cancel routine getting invoked.
The problem was that this power-managed queue concept wherein the driver
has to either complete or inform PnP/framework
that it would like to keep the IRP for later processing. Now thats fixed
using EvtIoStop and EvtIoResume functions.
I also referred to serial driver sample on how things are done.
But there still seems to be a corner case where some handle is not released
properly creating problems for me.
Need to nail it down as well.
Regards,
-Praveen
“Doron Holan” wrote in message
news:xxxxx@ntdev…
1) cancelation is either explicit (the app calls CancelIo(Ex) or a
driver calls IoCancelIrp) or implicit (a handle is closed and the i/o
manager runs down the list of irps on the handle). Pnp manager is only
involved in the sense that it tells the creator of the handle that the
underlying stack is going away, it has nothing to do with the requests
themselves
2) are you equating EvtIoStop with a cancel routine? You will not get
a EvtDeviceReleaseHardware in the query remove->remove path until the
remove has been sent and all WDFQUEUEs (power and non power managed) are
purged. Who is sending your driver i/o, an app or a driver (perhaps
through a stack loaded on one of your PDOs)? If you are getting a
restart message someone (app or driver) who had a handle open to your
driver did not close it. The setup logs should tell you more.
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Praveen Kumar
Amritaluru
Sent: Wednesday, November 15, 2006 6:25 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] When does cancel routine set for an IRP by driver get
executed?
Hi,
When I disable my driver, my event callback routines registered with
KMDF
get invoked.
The driver receives IRP_MN_QUERY_REMOVE and once the callback routine
processes this IRP
and returns (is completed), the cancel routine that my driver
registered
for IRPs that were received by
driver earlier get called for a no. of times.
Question:
1. Who calls this cancel routine? Is it some application shipped along
with
my driver package or the PnP/IO manager
takes care of calling cancellation routines for all my IRPs that my
driver had not completed earlier?
Does PnP/IO manager know that my driver is getting disabled(removed)
and
hence invokes cancel routines for all
the IRPs that was not completed earlier by the driver?
Does OS keep track of all these IRPs not completed? Or is the
framework?
2. Once these cancel routines are executed, I dont see
EvtDeviceReleaseHardware() getting executed.
Is my driver EvtDeviceReleaseHardware() not getting executed because
the
driver did not complete all the IRPs when the
cancel routine got called?
Is this the reason why disable of driver did not go through throwing
out a
message:
“Hardware settings have changed. System needs to be restarted”.
Regards,
-Praveen
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer