Partager via


Halt Handler (NDIS 5.1)

Note   NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.

A miniport driver must supply a MiniportHaltfunction to NdisMRegisterMiniport. The definition of MiniportHaltis:

VOID
 MiniportHalt(
 IN NDIS_HANDLE MiniportAdapterContext
 );

MiniportHaltcan be called:

  • After the failure of a request to set up multicast addresses or to set MAC_OPTIONS

  • After the unbinding of all the protocol drivers bound to the miniport driver

  • During an unload operation; for instance, when a NetStop command has caused an unload operation to be carried out

  • During system shutdown

MiniportHaltshould undo everything that MiniportInitializedid, including the following:

  • Free ports

  • Release all the hardware resources it claimed

  • Free interrupt resources by calling NdisMDeregisterInterrupt

  • Free any memory it has allocated

  • Stop the NIC, unless the MiniportShutdown function has already restored the NIC to its initial state. The following diagram illustrates unloading a miniport driver.

MiniportHaltshould carry out the operations necessary to unload the driver before returning. If the miniport driver has any outstanding receive packets (packets that it has indicated up to NDIS but which NDIS has not yet returned), MiniportHaltmust not return until such packets are returned to the miniport driver's MiniportReturnPacketfunction.

The preceding figure shows a set of calls that could be made by a MiniportHaltfunction. 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 MiniportInitializeif 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, MiniportInitializeshould unload the driver by undoing its previous actions. Otherwise, MiniportHaltwill undo the actions of MiniportInitialize.

The following lists the calls required to reverse certain actions that have been taken by the miniport driver:

 

 

Send comments about this topic to Microsoft