Miniport Driver Halt Handler
MiniportHaltEx should undo everything that MiniportInitializeEx did. For example, the NDIS miniport driver might:
Free ports. (For more information, see Freeing an NDIS Port.)
Release all of the hardware resources that MiniportInitializeEx claimed.
Free interrupt resources by calling NdisMDeregisterInterruptEx.
Free any memory that MiniportInitializeEx allocated.
Stop the NIC, unless the MiniportShutdownEx function has already restored the NIC to its initial state.
The following diagram illustrates unloading a miniport driver.
MiniportHaltEx should complete the operations that are necessary to unload the driver before returning. If the miniport driver has any outstanding receive indications (that is, received network data that it has indicated up to NDIS but which NDIS has not yet returned), MiniportHaltEx must not return until such data is returned to the miniport driver's MiniportReturnNetBufferLists function.
The preceding figure shows a set of calls that could be made by a MiniportHaltEx function. These calls are only a subset of the calls that could be made. The actual set of calls depends on previous actions of the miniport driver. The miniport driver can make these same calls in MiniportInitializeEx if it cannot successfully initialize the network adapter because of hardware problems or because it cannot acquire a resource that it needs. In such a case, MiniportInitializeEx should unload the driver by undoing its previous actions. Otherwise, MiniportHaltEx will undo the actions of MiniportInitializeEx.
The following list describes the calls that are required to reverse certain actions that the miniport driver might take:
If the miniport driver registered an interrupt, it should call NdisMDeregisterInterruptEx.
If the miniport driver set up a timer or timers, it should call NdisCancelTimerObject for each timer that it created. If a call to NdisCancelTimerObject fails, the timer might have already fired. In this case, the miniport driver should wait for the timer handler to complete before returning from MiniportHaltEx.
If the miniport driver allocated or reserved any hardware resources, these should be returned. For example, if the miniport driver mapped an I/O port range on a NIC, it should release the ports by calling NdisMDeregisterIoPortRange.