NdisMRegisterUnloadHandler function (ndis.h)

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.

The NdisMRegisterUnloadHandler function registers an unload handler for a driver.

Syntax

void NdisMRegisterUnloadHandler(
  [in] NDIS_HANDLE    NdisWrapperHandle,
  [in] PDRIVER_UNLOAD UnloadHandler
);

Parameters

[in] NdisWrapperHandle

Specifies the handle returned by NdisMInitializeWrapper.

[in] UnloadHandler

Specifies the entry point for the driver's unload routine. An unload routine is declared as follows:

VOID
(*PDRIVER_UNLOAD) (
    IN struct _DRIVER_OBJECT *DriverObject
    );

Return value

None

Remarks

A driver calls NdisMRegisterUnloadHandler from its DriverEntry function after DriverEntry has called NdisMRegisterMiniport or NdisIMRegisterLayeredMiniport. NdisMRegisterUnloadHandler registers an unload handler for the driver.

The functionality of the unload handler is driver-specific. For example, an intermediate driver should register an unload handler that calls NdisDeregisterProtocol to deregister the protocol portion of the intermediate driver. The unload handler should also perform any necessary cleanup operations, such as deallocating resources used by the protocol portion of the driver.

A miniport driver, such as a load-balancing miniport driver, that monitors more than one miniport driver instance should register an unload handler that cleans up state information and deallocates resources after the miniport driver instances that it monitors are halted. Note that an unload handler differs from a MiniportHalt function: the unload handler has a more global scope, whereas the scope of the MiniportHalt function is restricted to a particular miniport driver instance.

  • Target platform: Universal
  • Version: Not supported for NDIS 6.0 drivers in Windows Vista. Use NdisMRegisterMiniportDriverinstead. Supported for NDIS 5.1 drivers in Windows Vista and Windows XP.

Requirements

Requirement Value
Header ndis.h (include Ndis.h)
Library Ndis.lib
IRQL PASSIVE_LEVEL

See also