Dev,
Thanks for an answer.
I would like to clarify my question and the potential problem I am thinking about.
There are two drivers: functional device driver and the second driver which receives the device pointer in notification callback and sends it IOs.
Let’s say that the second driver is going to call the IoCallDriver() with the device object parameter. Now the context switch happens and a
GUID_TARGET_DEVICE_REMOVE_COMPLETE event notification callback is called. The cleanup task is performed, the callback function
returns STATUS_SUCCESS and the device object is deleted in the first driver. Now IoCallDriver() is crashing the system.
How can I prevent it?
I cannot use a remove lock in the second driver since it must not block in the notification callback.
On the other hand I have to close all the handles.
Regards,
Dany
-----Original Message-----
From: Dsingh@in.safenet-inc.com [mailto:Dsingh@in.safenet-inc.com]
Sent: Wednesday, October 06, 2004 07:27
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Handling a GUID_TARGET_DEVICE_REMOVE_COMPLETE event.
Hi Dany,
Seems your existing driver is an NT style driver. You should have complete all your pending IOs in IRP_MN_SURPRISE_REMOVAL. Here you shouldn’t wait but perform the cleanup task.
Hope this helps.
Dev
-----Original Message-----
From: Dany Polovets [mailto:xxxxx@storeage.com]
Sent: Tuesday, October 05, 2004 9:32 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Handling a GUID_TARGET_DEVICE_REMOVE_COMPLETE event.
Hi!
I wrote a driver for my devices.
In the other driver I have a PnP notification routine for my devices arrival. Then I open the device using the workitem queue and start working with it, sending it IOs.
I have to write the PnP notification routine in order to support the surprise remove of the device.
It is written in DDK, that a notification routine must not block and it should close any handles on the device and remove any outstanding references to the file object.
Do I have to wait for all the sent IOs completion when receiving GUID_TARGET_DEVICE_REMOVE_COMPLETE event?
Regards,
Dany
This mail was sent via storeage.com
************************************************************************************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.
************************************************************************************