NDIS Miniport Driver Initialization (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.

When a miniport driver's DriverEntryfunction returns, NDIS calls the miniport driver's MiniportInitializefunction once for each NIC managed by the miniport driver.

If a new NIC is plugged into the system, that miniport driver's MiniportInitializefunction will be called to initialize the newly installed device. Consequently, a MiniportInitializefunction and any functions it calls, all of which run at IRQL PASSIVE_LEVEL, can be specified as pageable. Code is specified as pageable by using the NDIS_PAGEABLE_FUNCTIONmacro. Initialization code cannot be specified with the NDIS_INIT_FUNCTION macro, because code marked this way is no longer mapped once the initial system boot is complete. Only the DriverEntryfunction and any functions called only from DriverEntrycan be passed to the NDIS_INIT_FUNCTION macro.

The initialization function is declared as follows:

NDIS_STATUS
 MiniportInitialize (
  OUT PNDIS_STATUS OpenErrorStatus,
 OUT PUINT  SelectedMediumIndex,
 IN PNDIS_MEDIUM  MediumArray,
 IN UINT  MediumArraySize,
 IN NDIS_HANDLE  MiniportAdapterHandle,
 IN NDIS_HANDLE  ConfigurationHandle
    );

The following arguments are passed to MiniportInitialize.

  • An array of NdisMediumXxx at MediumArray. The miniport driver must choose the medium it supports or prefers and must return the index of that medium in SelectedMediumIndex. If the miniport driver does not find a medium it can support in MediumArray, it must return a failure status of NDIS_STATUS_UNSUPPORTED_MEDIA.

  • A handle, MiniportAdapterHandle, that NDIS uses to refer to the miniport driver. The miniport driver must retain this handle so that it can pass it in subsequent calls to NDIS--for instance, in such calls as NdisMRegisterAdapterShutdownHandler and NdisMInitializeTimer.

  • A configuration handle that identifies the registry key containing NIC-specific information (the advanced parameters) associated with this miniport driver. The miniport driver must retain and pass this handle to NdisOpenConfiguration. For information about parameter values written to the registry by network INF files, see Add-registry-sections.

 

 

Send comments about this topic to Microsoft