EvtDeviceReleaseHardware vs IRP_MN_REMOVE_DEVICE

Hello, I was wondering if people could comment on
EvtDeviceReleaseHardware vs IRP_MN_REMOVE_DEVICE. This concerns a
driver which we have ported from WDM to KMDF. We have three handles
open to the same device in different threads in the same application
(why we have three handles open is another matter, but that cannot
change now, as some of the handles are in a third party API DLL).

Now, it was my understanding that all handles must be closed in usermode
before IRP_MN_REMOVE_DEVICE is dispatched, is that not so (at least for
pure WDM)? As an aside, I also understood that IoGetDeviceObjectPointer
would have the same effect until the FILE_OBJECT returned by that DDI is
dereferenced.

We are seeing EvtDeviceReleaseHardware being called before any handles
in usermode are being closed (in Vista 32 bit and 64 bits). Is this
expected behaviour?

thanks,

Philip Lukidis

EvtDeviceReleaseHardware will also be called when the device is surprise removed (which could be not only due to physicaly removal but due to a pnp state invalidation). Also, remember that in this callback teh device is in D3 and you should not touch the hw anymore. What are you doing in this callback that is causing problems? by knowing what you are doing, i can perhaps suggest a better callback to put it in.

d


From: xxxxx@lists.osr.com on behalf of Philip Lukidis
Sent: Tue 7/24/2007 2:42 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] EvtDeviceReleaseHardware vs IRP_MN_REMOVE_DEVICE

Hello, I was wondering if people could comment on EvtDeviceReleaseHardware vs IRP_MN_REMOVE_DEVICE. This concerns a driver which we have ported from WDM to KMDF. We have three handles open to the same device in different threads in the same application (why we have three handles open is another matter, but that cannot change now, as some of the handles are in a third party API DLL).

Now, it was my understanding that all handles must be closed in usermode before IRP_MN_REMOVE_DEVICE is dispatched, is that not so (at least for pure WDM)? As an aside, I also understood that IoGetDeviceObjectPointer would have the same effect until the FILE_OBJECT returned by that DDI is dereferenced.

We are seeing EvtDeviceReleaseHardware being called before any handles in usermode are being closed (in Vista 32 bit and 64 bits). Is this expected behaviour?

thanks,

Philip Lukidis


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

Hello there,
I have been able to work it out upto 32 MB for free space ram disk size. Could any one, please help me how do i increaset to 8 GB of ram disk free space size.
Please please help me for my project.
Thank you.
Ganesh

Doron Holan wrote:
EvtDeviceReleaseHardware will also be called when the device is surprise removed (which could be not only due to physicaly removal but due to a pnp state invalidation). Also, remember that in this callback teh device is in D3 and you should not touch the hw anymore. What are you doing in this callback that is causing problems? by knowing what you are doing, i can perhaps suggest a better callback to put it in.

d

---------------------------------
From: xxxxx@lists.osr.com on behalf of Philip Lukidis
Sent: Tue 7/24/2007 2:42 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] EvtDeviceReleaseHardware vs IRP_MN_REMOVE_DEVICE

Hello, I was wondering if people could comment on EvtDeviceReleaseHardware vs IRP_MN_REMOVE_DEVICE. This concerns a driver which we have ported from WDM to KMDF. We have three handles open to the same device in different threads in the same application (why we have three handles open is another matter, but that cannot change now, as some of the handles are in a third party API DLL).

Now, it was my understanding that all handles must be closed in usermode before IRP_MN_REMOVE_DEVICE is dispatched, is that not so (at least for pure WDM)? As an aside, I also understood that IoGetDeviceObjectPointer would have the same effect until the FILE_OBJECT returned by that DDI is dereferenced.

We are seeing EvtDeviceReleaseHardware being called before any handles in usermode are being closed (in Vista 32 bit and 64 bits). Is this expected behaviour?

thanks,

Philip Lukidis


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


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

---------------------------------
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search.

Thank you for your reply. There was an assumption that the file object cleanup callback would fire before EvtDeviceReleaseHardware, partly due to the fact that we had to be in process context for unmapping buffers in the cleanup callback before removing the device from a collection in EvtDeviceReleaseHardware. This was fine for WDM, but not KMDF. Now we have changed it so that the file object cleanup callback has to be called before the device context cleanup callback, which seems to work fine. Is that assumption correct, even if multiple handles are open?

thank you,

Philip Lukidis

-----Original Message-----
From: xxxxx@lists.osr.com on behalf of Doron Holan
Sent: Tue 7/24/2007 5:34 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] EvtDeviceReleaseHardware vs IRP_MN_REMOVE_DEVICE

EvtDeviceReleaseHardware will also be called when the device is surprise removed (which could be not only due to physicaly removal but due to a pnp state invalidation). Also, remember that in this callback teh device is in D3 and you should not touch the hw anymore. What are you doing in this callback that is causing problems? by knowing what you are doing, i can perhaps suggest a better callback to put it in.

d


From: xxxxx@lists.osr.com on behalf of Philip Lukidis
Sent: Tue 7/24/2007 2:42 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] EvtDeviceReleaseHardware vs IRP_MN_REMOVE_DEVICE

Hello, I was wondering if people could comment on EvtDeviceReleaseHardware vs IRP_MN_REMOVE_DEVICE. This concerns a driver which we have ported from WDM to KMDF. We have three handles open to the same device in different threads in the same application (why we have three handles open is another matter, but that cannot change now, as some of the handles are in a third party API DLL).

Now, it was my understanding that all handles must be closed in usermode before IRP_MN_REMOVE_DEVICE is dispatched, is that not so (at least for pure WDM)? As an aside, I also understood that IoGetDeviceObjectPointer would have the same effect until the FILE_OBJECT returned by that DDI is dereferenced.

We are seeing EvtDeviceReleaseHardware being called before any handles in usermode are being closed (in Vista 32 bit and 64 bits). Is this expected behaviour?

thanks,

Philip Lukidis


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


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

That works just fine.

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Philip Lukidis
Sent: Wednesday, July 25, 2007 3:12 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] EvtDeviceReleaseHardware vs IRP_MN_REMOVE_DEVICE

Thank you for your reply. There was an assumption that the file object
cleanup callback would fire before EvtDeviceReleaseHardware, partly due
to the fact that we had to be in process context for unmapping buffers
in the cleanup callback before removing the device from a collection in
EvtDeviceReleaseHardware. This was fine for WDM, but not KMDF. Now we
have changed it so that the file object cleanup callback has to be
called before the device context cleanup callback, which seems to work
fine. Is that assumption correct, even if multiple handles are open?

thank you,

Philip Lukidis

-----Original Message-----
From: xxxxx@lists.osr.com on behalf of Doron Holan
Sent: Tue 7/24/2007 5:34 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] EvtDeviceReleaseHardware vs IRP_MN_REMOVE_DEVICE

EvtDeviceReleaseHardware will also be called when the device is surprise
removed (which could be not only due to physicaly removal but due to a
pnp state invalidation). Also, remember that in this callback teh
device is in D3 and you should not touch the hw anymore. What are you
doing in this callback that is causing problems? by knowing what you
are doing, i can perhaps suggest a better callback to put it in.

d


From: xxxxx@lists.osr.com on behalf of Philip Lukidis
Sent: Tue 7/24/2007 2:42 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] EvtDeviceReleaseHardware vs IRP_MN_REMOVE_DEVICE

Hello, I was wondering if people could comment on
EvtDeviceReleaseHardware vs IRP_MN_REMOVE_DEVICE. This concerns a
driver which we have ported from WDM to KMDF. We have three handles
open to the same device in different threads in the same application
(why we have three handles open is another matter, but that cannot
change now, as some of the handles are in a third party API DLL).

Now, it was my understanding that all handles must be closed in usermode
before IRP_MN_REMOVE_DEVICE is dispatched, is that not so (at least for
pure WDM)? As an aside, I also understood that IoGetDeviceObjectPointer
would have the same effect until the FILE_OBJECT returned by that DDI is
dereferenced.

We are seeing EvtDeviceReleaseHardware being called before any handles
in usermode are being closed (in Vista 32 bit and 64 bits). Is this
expected behaviour?

thanks,

Philip Lukidis


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


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


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