IRP_MN_SURPRISE_REMOVAL after IRP_MN_REMOVE_DEVICE ?

Hi All,

I don’t understand this line in the DDK (inside the “Removing a Device in a
Function Driver” topic) completely:

… If the bus driver handled a previous IRP_MN_REMOVE_DEVICE request for
the device, and there has been no subsequent
IRP_MN_SURPRISE_REMOVAL request, then the bus driver deletes the child PDO.

What I especially don’t understand is: “… and there has been no subsequent
IRP_MN_SURPRISE_REMOVAL request”.
According to DDK-docs IRP_MN_REMOVE_DEVICE is sent after
IRP_MN_SURPRISE_REMOVAL , so why should a
“subsequent IRP_MN_SURPRISE_REMOVAL request” be there?
Can someone explain to me, what does this line exactly mean ?

Thanks

That’s seriously confusing…

I think what it’s trying to say is:

>
If the bus driver handled a previous IRP_MN_REMOVE_DEVICE request for the
device, and there has been no *previous* IRP_MN_SURPRISE_REMOVAL request,
then the bus driver deletes the child PDO.
<<

A bus driver does not typically delete the child PDO in the child’s
QueryRemove->Remove path (the device isn’t really gone from the system, so
the PDO stays). So, what this is trying to say is that when the bus FDO is
processing its remove request it needs to be sure to delete any “soft
removed” child PDOs it has lying around.

The toaster bus actually has a good code sample that explains the point.
Check out src\general\toaster\bus\pnp.c:579-616

-scott


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

“Alexander Schwarz” wrote in message
news:xxxxx@ntdev…
> Hi All,
>
> I don’t understand this line in the DDK (inside the “Removing a Device in
> a Function Driver” topic) completely:
>
> … If the bus driver handled a previous IRP_MN_REMOVE_DEVICE request for
> the device, and there has been no subsequent
> IRP_MN_SURPRISE_REMOVAL request, then the bus driver deletes the child
> PDO.
>
> What I especially don’t understand is: “… and there has been no
> subsequent IRP_MN_SURPRISE_REMOVAL request”.
> According to DDK-docs IRP_MN_REMOVE_DEVICE is sent after
> IRP_MN_SURPRISE_REMOVAL , so why should a
> “subsequent IRP_MN_SURPRISE_REMOVAL request” be there?
> Can someone explain to me, what does this line exactly mean ?
>
> Thanks
>
>