4.1.2 Unloading and Deregistering a TDI Transport Driver
When a NIC is removed from the machine, Windows NT can unload all TDI transport drivers that are either bound directly to the underlying NIC driver or layered over an NDIS protocol driver that is bound to that NIC driver. To accomplish this, the system calls each TDI transport's Unload routine.
The transport's Unload routine will be called by the I/O Manager when the Service Controller unloads the driver from memory. A transport driver's Unload routine frees all driver-allocated resources and, if the driver interfaces to NDIS at its lower edge, unbinds itself from the underlying NDIS driver(s).
If the TDI driver exports a set of NDIS-defined ProtocolXxx functions, it must call NdisDeregisterProtocol from its Unload routine.
For more information about standard intermediate driver Unload routines, see the Kernel-Mode Driver Design Guide.