Processing IRP_MN_REMOVE_DEVICE in bus drivers

When should a bus driver delete the device objects for its child PDOs? When
it receives IRP_MN_REMOVE_DEVICE on a child PDO, or only on the bus FDO?
Clearly, the bus driver has to delete the child PDOs when the bus FDO is
removed. But should a child PDO be deleted when IRP_MN_REMOVE_DEVICE is
received on that child PDO?

– arlie

Hi,

Check out the Toaster bus sample in the DDK, notably the “Present” and
“ReportedMissing” flags in the PDO device extension. Bascially, the bus
driver only wants to delete the child PDO when the remove is due to the
device actually being gone from the system, not due to “soft remove” (i.e.
Right Click->Disable in device manager).

A common bug in bus and bus filter drivers is deleting the PDO in the remove
path on soft remove.

HTH,

-scott


Scott Noone
Software Engineer
OSR Open Systems Resources, Inc.
http://www.osronline.com

“Arlie Davis” wrote in message
news:xxxxx@ntdev…
> When should a bus driver delete the device objects for its child PDOs?
> When
> it receives IRP_MN_REMOVE_DEVICE on a child PDO, or only on the bus FDO?
> Clearly, the bus driver has to delete the child PDOs when the bus FDO is
> removed. But should a child PDO be deleted when IRP_MN_REMOVE_DEVICE is
> received on that child PDO?
>
> – arlie
>
>
>

To put it very short, bus driver deletes child PDOs if
one of following is true:

a) get REMOVE_DEV on child PDO *and* PDO has NOT been
reported to PNP manager in the most recent QDR.
b) Get get REMOVE_DEV on FDO.


Calvin Guan (Windows DDK MVP)
NetXtreme Longhorn Miniport Prime
Broadcom Corp. www.broadcom.com

— Arlie Davis wrote:

> When should a bus driver delete the device objects
> for its child PDOs? When
> it receives IRP_MN_REMOVE_DEVICE on a child PDO, or
> only on the bus FDO?
> Clearly, the bus driver has to delete the child PDOs
> when the bus FDO is
> removed. But should a child PDO be deleted when
> IRP_MN_REMOVE_DEVICE is
> received on that child PDO?
>
> – arlie
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@yahoo.ca
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>

__________________________________________________________
Find your next car at http://autos.yahoo.ca

Definitely test your driver with driver verifier enabled, it will catch
the bus driver misbehaving in terms of when to delete the PDO.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Calvin Guan
Sent: Friday, September 30, 2005 9:54 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Processing IRP_MN_REMOVE_DEVICE in bus drivers

To put it very short, bus driver deletes child PDOs if
one of following is true:

a) get REMOVE_DEV on child PDO *and* PDO has NOT been
reported to PNP manager in the most recent QDR.
b) Get get REMOVE_DEV on FDO.


Calvin Guan (Windows DDK MVP)
NetXtreme Longhorn Miniport Prime
Broadcom Corp. www.broadcom.com

— Arlie Davis wrote:

> When should a bus driver delete the device objects
> for its child PDOs? When
> it receives IRP_MN_REMOVE_DEVICE on a child PDO, or
> only on the bus FDO?
> Clearly, the bus driver has to delete the child PDOs
> when the bus FDO is
> removed. But should a child PDO be deleted when
> IRP_MN_REMOVE_DEVICE is
> received on that child PDO?
>
> – arlie
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@yahoo.ca
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>

__________________________________________________________
Find your next car at http://autos.yahoo.ca


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com