Hi folks,
Having fun with WDF Dynamic enumeration. I have a bus driver which
dynamically enumerates children. It all works fine, apart from one
little niggle - WdfChildListUpdateChildDescriptionAsMissing generates
surprise removals, which results in an “error” in the Event Log. Is
there any way to perform a more orderly “QueryRemove, then Remove”
process - I could probably expand / improve state machines in the bus
driver to handle a failed query, if only I could get the information back.
The nitty gritty:
If a child device is removed as a result of disabling the child in
device manager, we get a query removal, followed by a removal (In the
log “Child” = Bus driver PDO):
[sfcbus] BusDriverPrintPnPIrpDetails: PNP_IRP_START: Dev: 0x78d4f608 (Child) Cmd: IRP_MN_QUERY_DEVICE_RELATIONS
[sfcbus] BusDriverPrintPnPIrpDetails: PNP_IRP_START: Dev: 0x78d4f608 (Child) Cmd: IRP_MN_QUERY_REMOVE_DEVICE
[sfcbus] BusDriverPrintPnPIrpDetails: PNP_IRP_START: Dev: 0x78d4f608 (Child) Cmd: IRP_MN_REMOVE_DEVICE
If the child device is removed as a result of the whole stack being torn
down because of disabling the parent FDO in device manager, we get the
following log, and an “error” in the system event log:
[sfcbus] BusDriverPrintPnPIrpDetails: PNP_IRP_START: Dev: 0x78d88c68 (Child) Cmd: IRP_MN_QUERY_DEVICE_RELATIONS
[sfcbus] BusDriverPrintPnPIrpDetails: PNP_IRP_START: Dev: 0x77a56ff8 (Physical) Cmd: IRP_MN_QUERY_DEVICE_RELATIONS
[sfcbus] BusDriverPrintPnPIrpDetails: PNP_IRP_COMPLETE: ERROR Dev: 0x77a56ff8 Cmd: IRP_MN_QUERY_DEVICE_RELATIONS Status: 0xc00000bb
[sfcbus] BusDriverPrintPnPIrpDetails: PNP_IRP_START: Dev: 0x78d88c68 (Child) Cmd: IRP_MN_QUERY_REMOVE_DEVICE
[sfcbus] BusDriverPrintPnPIrpDetails: PNP_IRP_START: Dev: 0x77a56ff8 (Physical) Cmd: IRP_MN_QUERY_REMOVE_DEVICE
[sfcbus] BusDriverPrintPnPIrpDetails: PNP_IRP_COMPLETE: SUCCESS Dev: 0x77a56ff8 Cmd: IRP_MN_QUERY_REMOVE_DEVICE Status: 0x2
[sfcbus] BusDriverPrintPnPIrpDetails: PNP_IRP_START: Dev: 0x78d88c68 (Child) Cmd: IRP_MN_REMOVE_DEVICE
[sfcbus] BusDriverPrintPnPIrpDetails: PNP_IRP_START: Dev: 0x77a56ff8 (Physical) Cmd: IRP_MN_REMOVE_DEVICE
…
[sfcbus] BusDriverPrintPnPIrpDetails: PNP_IRP_COMPLETE: SUCCESS Dev: 0x77a56ff8 Cmd: IRP_MN_REMOVE_DEVICE Status: 0x2
However, if we call WdfChildListUpdateChildDescriptionAsMissing, then we
get:
[sfcbus] BusDriverPrintPnPIrpDetails: PNP_IRP_START: Dev: 0x77aebd30 (Singleton) Cmd: IRP_MN_QUERY_DEVICE_RELATIONS
[sfcbus] BusDriverPrintPnPIrpDetails: PNP_IRP_COMPLETE: SUCCESS Dev: 0x77aebd30 Cmd: IRP_MN_QUERY_DEVICE_RELATIONS Status: 0x2
[sfcbus] BusDriverPrintPnPIrpDetails: PNP_IRP_START: Dev: 0x78d4f608 (Child) Cmd: IRP_MN_QUERY_DEVICE_RELATIONS
[sfcbus] BusDriverPrintPnPIrpDetails: PNP_IRP_START: Dev: 0x78d4f608 (Child) Cmd: IRP_MN_QUERY_DEVICE_RELATIONS
[sfcbus] BusDriverPrintPnPIrpDetails: PNP_IRP_START: Dev: 0x78d4f608 (Child) Cmd: IRP_MN_SURPRISE_REMOVAL
[sfcbus] BusDriverPrintPnPIrpDetails: PNP_IRP_START: Dev: 0x78d4f608 (Child) Cmd: IRP_MN_REMOVE_DEVICE
The event log then contains:
The device ‘Solarflare Virtual Adapter’ ({C641C770-FAAC-44ED-9C73-48D1B5E59200}\NDIS_VIRTUAL\PG_ID_V_1_NA_ID_1) disappeared from the system without first being prepared for removal.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Any way of doing a cleaner removal, or getting rid of the error would be nice.
MH.