Porting Protocol Driver Unload Operations to NDIS 6.0
In NDIS 6.0, a protocol driver must call the NdisDeregisterProtocolDriver function, in its Unload routine, to deregister the protocol driver. The driver passes NdisDeregisterProtocolDriver the handle that it obtained at NdisProtocolHandle when it called the NdisRegisterProtocolDriver function.
For NDIS 6.0, the ProtocolUnload function--which NDIS calls when a protocol driver is uninstalled--is replaced by the ProtocolUninstall function. Protocol drivers specify a ProtocolUninstall function entry point in the NDIS_PROTOCOL_DRIVER_CHARACTERISTICS structure.
ProtocolUninstall is an optional function. NDIS calls ProtocolUninstall in response to a user request to uninstall an intermediate driver. NDIS calls ProtocolUnbindAdapterEx once for each bound adapter, then NDIS calls ProtocolUninstall. NDIS calls ProtocolUninstall before the system actually unloads the driver. This timing provides a chance to release any device objects or other resources that might otherwise prevent the system from calling the intermediate driver's MiniportDriverUnload function and unloading the driver.
For more information about unloading an NDIS 6.0 protocol driver, see Initializing a Protocol Driver.