Intermediate Driver Unbinding Operations
An intermediate driver unbinds from an underlying miniport driver by calling NdisCloseAdapterEx from its ProtocolUnbindAdapterEx function. NDIS calls ProtocolUnbindAdapterEx if the underlying miniport adapter is no longer available.
An intermediate driver's ProtocolUnbindAdapterEx function might be called when the driver has an outstanding call to NdisIMInitializeDeviceInstanceEx. This situation occurs when NDIS has not yet called MiniportInitializeEx to initialize the corresponding virtual miniports. In this case, the intermediate driver must call NdisIMCancelInitializeDeviceInstance to attempt to cancel the initialization of these virtual miniports.
If the binding that is being closed is mapped to a device exported by the intermediate driver, and if that device was initialized by calling NdisIMInitializeDeviceInstanceEx, the intermediate driver can call NdisIMDeInitializeDeviceInstance to close the device. The result is that the intermediate driver's virtual miniport becomes no longer available for sends or requests made by higher-level drivers.
If an NDIS intermediate driver calls the NdisIMDeInitializeDeviceInstance function, NDIS calls the MiniportHaltEx function for the affected virtual miniport. For information about handling the halt operation for virtual miniports, see Halting a Virtual Miniport.
After an intermediate driver calls NdisCloseAdapterEx, it should fail any send requests for that binding with an appropriate error status.
For additional information about intermediate driver unbinding operations, see Unbinding from an Adapter.