Hi
Thanks for the reply Jay and Mark .
Could you please suggest me how to handle this in the driver rather waiting
for the application to close the handles ?
Thanks in advance
srinivas
-----Original Message-----
From: Mark Roddy [mailto:xxxxx@hollistech.com]
Sent: Thursday, August 02, 2001 4:55 AM
To: NT Developers Interest List
Subject: [ntdev] Re:No IRP_MN_REMOVE_DEVICE
If it is not an application that he has the source code for and can modify,
there is nothing much he can do, other than reject new irps (and not ALL new
irps, like for example IRP_MJ_CLOSE or IRP_MN_REMOVE ought not to be
rejected.) The behavior he is seeing is by design.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jayadev
Sent: Thursday, August 02, 2001 5:46 PM
To: NT Developers Interest List
Subject: [ntdev] Re:No IRP_MN_REMOVE_DEVICE
Srinivas,
The problem that the PnP manager not dispatching the IRP_MN_REMOVEDEVICE is
because some of the application(s) is holding the handle to the driver.
Sending the
IRP_MN_REMOVEDEVICE Irp is one of the last steps prior to unloading the
driver, it
is a bad on the part of Pnp manager to unload a driver when there are some
active
handles to the driver.
To solve your problem, you need to some how ( I will tell a way down the
mail) tell
or notify the application that the device is removed and then the
application should call
CloseHandle() for all the active handles. If this is done, then i am sure
that the
IRP_MN_REMOVEDEVICE is called immediately after the last handle to the
driver is closed.
Approach :
Application should wait for the WM_DEVICECHANGE broadcast message send to
all the windows,
and should close the handle to the driver on the DBT_DEVICEREVOMECOMPLETE
event. Application
can have a cross check for the interface.
You can use IoRegisterDeviceInterface in your driver for some GUID
interface, and later on the
IRP_MN_SURPRISE_REMOVAL you can disable the interface using the
IoSetDeviceInterfaceState(…,FALSE);
Also you can enable the interface in the IRP_MN_START_DEVICE, and
application can wait for
the WM_DEVICECHANGE for the DBT_DEVICEARRIVAL event. This will tell the
application that
the device is plugged in and now the application can again open the handles
to the device.
Good luck,
Hi all
I have a problem with PNP messages from PNP manager . In the normal
case if
I unplug the device then I receive SURPRISE_REMOVAL ioctl . which is
normal
and later I used to receive IRP_MN_REMOVE_DEVICE which makes my driver
happy
and removes all resources .
when the application is closed before unplugging the device , then the
SURPRISE_REMOVAL and IRP_MN_REMOVE_DEVICE are received properly .
But When an application is attached with the driver , and in that
condition
if I unplug the device , then the PNP manager sends me the
SURPRISE_REMOVAL
and later on it does not send me any IRP_MN_REMOVE_DEVICE at all . Am I
doing any mistake in handling these PNP events ? I am checking whether
any
request can go through or not before actually doing any processing any
IRP .
But some how when the application is attached it does not send me
IRP_MN_REMOVE_DEVICE event . what should I do to get this event in the
particular case I mentioned ?
Anybody has any idea ?
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: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com