ObReferenceObject query

Hi,
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.

The driver creates 2 device objects during AddDevice - one for the primary
port which is enumerated by the Operating System and the other for my own
interface. The primary port device object is used by standard COM port
applications like Hyperterm etc and the second device object is used by my
own application. I obtain a reference to the primary device object using
ObReferenceObject call with the intention of preventing the driver from
getting unloaded during SURPRISE_REMOVAL. Is this assumption correct? The
ObReferenceObject call mentions that the device object is not deleted until
the reference count reaches zero. But I get a REMOVE_DEVICE IRP and the
driver gets unloaded when the device is removed from the system.

Another doubt is that when a device object gets deleted will the IO Manager
check for outstanding references on the same before deleting the device
objects? From my REMOVE_DEVICE IRP handler I delete the secondary device
object but still get IRPs from the application associated with this device
object. Won’t the I/O Manager fail such requests from the application since
the device object has already been deleted?

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

I wrote a similar driver, except instead of creating 2 device objects I used only one, but created two interfaces to the object. Then when my driver was called I 1st determined which interface wass called on. This way I only had to manage 1 device object.

Larry

-----Original Message-----
From: Balaji Swaminathan - CTD, Chennai. [mailto:xxxxx@ctd.hcltech.com]
Sent: Friday, October 19, 2001 10:10 AM
To: NT Developers Interest List
Subject: [ntdev] ObReferenceObject query

Hi,
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.

The driver creates 2 device objects during AddDevice - one for the primary
port which is enumerated by the Operating System and the other for my own
interface. The primary port device object is used by standard COM port
applications like Hyperterm etc and the second device object is used by my
own application. I obtain a reference to the primary device object using
ObReferenceObject call with the intention of preventing the driver from
getting unloaded during SURPRISE_REMOVAL. Is this assumption correct? The
ObReferenceObject call mentions that the device object is not deleted until
the reference count reaches zero. But I get a REMOVE_DEVICE IRP and the
driver gets unloaded when the device is removed from the system.

Another doubt is that when a device object gets deleted will the IO Manager
check for outstanding references on the same before deleting the device
objects? From my REMOVE_DEVICE IRP handler I delete the secondary device
object but still get IRPs from the application associated with this device
object. Won’t the I/O Manager fail such requests from the application since
the device object has already been deleted?

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: xxxxx@diebold.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

Larry,

I tried the multiple interface thing for my four-channel card. I created
four channels, all right, but since all four interfaces sat on top of the
same PDO, and each channel used identical IRPs, I could not tell which
channel was being targeted by a given write operation. In other words, if
the two interfaces process completely different IRPs, or the same IRP is
handled the same for all interfaces, it is pretty easy. IF you have to
handle a give IRP differently on a per-interface basis it gets sticky, and
you need a different device stack for each instance.

-Evan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Harmon, Larry CT
Sent: Friday, October 19, 2001 1:57 PM
To: NT Developers Interest List
Subject: [ntdev] RE: ObReferenceObject query

I wrote a similar driver, except instead of creating 2 device
objects I used only one, but created two interfaces to the
object. Then when my driver was called I 1st determined which
interface wass called on. This way I only had to manage 1 device object.


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