IRP received after device removed

Hello,
I have a WDM driver that supports two devices on WINDOWS 2000. One
is a serial port (a PC Card modem) and another is an alternate device, that
is an alternate interface to the serial port.

Both the devices access the hardware directly. When there is a
handle to the serial port exposed by the modem, removing the modem results
in IRP_MN_SURPRISE_REMOVAL , which the driver handles. After the handle is
closed, an IRP_MN_REMOVE_DEVICE is received. After that there is no problem.
But when there is a valid handle to the alternate device, if the modem is
removed, the driver receives IRP_MN_SURPRISE_REMOVAL followed by
IRP_MN_REMOVE_DEVICE before the handle is closed.

If the handle is closed now, or if the application issues any I/O
calls, the IRP is delivered to the driver, but all the device objects are
deleted in the IRP_MN_REMOVE_DEVICE handler. So the machine crashes with a
page fault. Is this behavior valid? How does the I/O manager send IRPs after
IRP_MN_REMOVE_DEVICE? Is it because the driver does not recognize the driver
as the driver for the alternate device?

***********************************************************************
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