Hi,
I have a WDM driver on Windows 2000 that exposes 2 device objects. One
is part of the device stack and the other (secondary device object) is for
my application to communicate with my driver directly through symbolic link.
The driver is for a PCMCIA modem.
When I remove the modem from the system, my driver gets a SURPRISE_REMOVAL
IRP. If the primary device object that is part of the device stack has a
pending reference count in the form of an open application handle,
REMOVE_DEVICE IRP is held back till the application closes the handle.
I have two cases.
-
If I have an open application handle for the secondary device object when
the device is removed, and I delete both the primary and secondary device
objects as part of the REMOVE_DEVCICE IRP, the DriverUnLoad routine gets
called even though the secondary device object has a pending reference count
in the form of an application handle. Any further requests from the
application to the secondary driver object crashes my driver (I am not able
to understand how the I/O Manager is able to pass the requests to the
secondary device object even after it has called my DriverUnLoad routine). -
If I defer the deletion of my secondary device object to the IRP_MJ_CLOSE
handler so that the open handle is removed, the DriverUnLoad routine doesn’t
get called at all. If I insert the modem once again, I get an AddDevice call
directly without the DriverEntry call thereby proving that the DriverUnLoad
routine didn’t get called in the previous instance. I actually even set a
break point in the DriverUnLoad routine using softice and verified this
case.
What could be the reason behind this behaviour?
I guess I have tried to combine the PnP based WDM driver and a Legacy
driver. The Primary device object is following the WDM approach and the
Secondary device object is following a Legacy driver approach.
Doesn’t the I/O Manager check for the reference count of the Device Object
and the Driver Object in the 2nd case? If it had checked the reference count
for the Driver Object in the 2nd case I have described, it should have
called the DriverUnLoad routine when the secondary device object associated
with this driver object is deleted. This is not happening as per this
assumption.
Can anyone clarify why this is happening? Is this approach of having one
device object that doesn’t attach to my device stack correct? Should I
implement this as a filter driver - function driver pair in order to avoid
such problems?
Sorry for the long mail as I had to explain all the cases.
Thanks & Regards,
S.Balaji
***********************************************************************
Disclaimer:
This document is intended for transmission to the named recipient only. If
you are not that person, you should note that legal rights reside in this
document and you are not authorized to access, read, disclose, copy, use or
otherwise deal with it and any such actions are prohibited and may be
unlawful. The views expressed in this document are not necessarily those of
HCL Technologies Ltd. Notice is hereby given that no representation,
contract or other binding obligation shall be created by this e-mail, which
must be interpreted accordingly. Any representations, contractual rights or
obligations shall be separately communicated in writing and signed in the
original by a duly authorized officer of the relevant company.
***********************************************************************
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