When MiniportHalt is called, it should carry out all operations necessary to unload the driver before returning. Part of unloading is releasing resources that have been claimed by the driver. The diagram above illustrates a possible set of calls that could be made by a MiniportHalt function. The illustrated set is a subset of the possible calls that could be made in such a function. The actual list depends on previous actions of the miniport. These same calls can be made in MiniportInitialize, if it cannot successfully initialize the network adapter, either because of hardware problems or because it cannot acquire a resource the miniport needs. In such a case, MiniportInitialize should unload the driver by backing out its previous actions. Otherwise, MiniportHalt backs out the actions of MiniportInitialize.
MiniportHalt or MiniportInitialize should call NdisTerminateWrapper to return the handle it acquired by calling NdisMInitializeWrapper.
If the miniport NIC driver registered an interrupt, it should call NdisMDeregisterInterrupt. If the miniport NIC driver registered a shutdown handler, it should call NdisMDeregisterAdapterShutdownHandler. If the miniport set up a timer or timers, it should call NdisMCancelTimer for each timer it created.
The miniport also calls NdisFreeMemory to free any memory it allocated by calling NdisAllocateMemory, NdisMAllocateSharedMemory, or NdisMAllocateSharedMemoryAsync. It calls NdisFreePacketPool if it called NdisAllocatePacketPool and so on. If it allocated or reserved any hardware resources, these should be returned, for example, by calling NdisMDeregisterIoPortRange, or NdisMFreeMapRegisters if the NIC is a busmaster DMA NIC.