Initializing an Intermediate Driver
An NDIS intermediate driver registers its MiniportXxx functions and its ProtocolXxx functions in the context of its DriverEntry routine. To register its MiniportXxx functions, an intermediate driver must call the NdisMRegisterMiniportDriver function with the NDIS_INTERMEDIATE_DRIVER flag set. This flag is in the NDIS_MINIPORT_DRIVER_CHARACTERISTICS structure that the driver passes at MiniportDriverCharacteristics . To register its ProtocolXxx functions, an intermediate driver must call the NdisRegisterProtocolDriver function.
If an error occurs in DriverEntry after NdisMRegisterMiniportDriver returns successfully, the driver must call the NdisMDeregisterMiniportDriver function before DriverEntry returns. If DriverEntry succeeds, the driver must call NdisMDeregisterMiniportDriver from its MiniportDriverUnload function.
After a driver calls NdisMRegisterMiniportDriver, the driver should be prepared to be called back at its MiniportInitializeEx function.