NdisMRegisterMiniportDriver function

A miniport driver calls the NdisMRegisterMiniportDriver function to register MiniportXxx entry points with NDIS as the first step in initialization.

Syntax


NDIS_STATUS NdisMRegisterMiniportDriver(
  _In_      PDRIVER_OBJECT DriverObject,
  _In_      PUNICODE_STRING RegistryPath,
  _In_opt_  NDIS_HANDLE MiniportDriverContext,
  _In_      PNDIS_MINIPORT_DRIVER_CHARACTERISTICS MiniportDriverCharacteristics,
  _Out_     PNDIS_HANDLE NdisMiniportDriverHandle
);

Parameters

DriverObject [in]

A pointer to an opaque driver object that the miniport driver received in its DriverEntry routine at the Argument1 parameter (see DriverEntry of NDIS Miniport Drivers).

RegistryPath [in]

A pointer to an opaque registry path that the miniport driver received in its DriverEntry routine at the Argument2 parameter.

MiniportDriverContext [in, optional]

A handle to a driver-allocated context area where the driver maintains state and configuration information.

MiniportDriverCharacteristics [in]

A pointer to an NDIS_MINIPORT_DRIVER_CHARACTERISTICS structure that the caller initialized.

NdisMiniportDriverHandle [out]

A pointer to a caller-supplied handle variable. NDIS writes a handle to this variable that uniquely identifies this driver. The driver must save this handle for use in subsequent NdisXxx function calls.

Return value

NdisMRegisterMiniportDriver returns one of the following status values:

Return codeDescription
NDIS_STATUS_SUCCESS

NdisMRegisterMiniportDriver registered the miniport driver successfully.

NDIS_STATUS_BAD_CHARACTERISTICS

The CharacteristicsLength parameter is incorrect for the NDIS version that is specified at the MajorNdisVersion member in the structure at MiniportDriverCharacteristics .

NDIS_STATUS_BAD_VERSION

The MajorNdisVersion or MinorNdisVersion specified in the characteristics structure is invalid.

NDIS_STATUS_RESOURCES

A shortage of resources, possibly memory, prevented NDIS from registering the caller.

NDIS_STATUS_FAILURE

This is a default error status, returned when none of the preceding errors caused the registration to fail.

 

Remarks

An NDIS driver calls NdisMRegisterMiniportDriver from its DriverEntry routine. For more information, see DriverEntry of NDIS Miniport Drivers.

Every miniport driver exports a set of standard MiniportXxx functions by setting up the characteristics structure and calling NdisMRegisterMiniportDriver. NDIS copies the characteristics structure to NDIS internal storage. Therefore, after it has registered, a driver cannot change its MiniportXxx entry points.

To register its virtual miniport interface, an NDIS intermediate drivers must call NdisMRegisterMiniportDriver with the NDIS_INTERMEDIATE_DRIVER flag set in the structure at MiniportDriverCharacteristics . NDIS drivers that have a WDM lower edge must call NdisMRegisterMiniportDriver with the NDIS_WDM_DRIVER flag set in the structure at MiniportDriverCharacteristics .

Drivers can register as a combined miniport driver and intermediate driver. To register its physical miniport driver, a miniport-intermediate driver calls NdisMRegisterMiniportDriver with appropriate parameters just as for any miniport driver. To register its virtual miniport interface, the driver calls NdisMRegisterMiniportDriver again, but with the NDIS_INTERMEDIATE_DRIVER flag set in the MiniportDriverCharacteristics parameter.

To enable miniport drivers to register optional services, NDIS calls the MiniportSetOptions function within the context of NdisMRegisterMiniportDriver.

After a driver calls NdisMRegisterMiniportDriver, the driver should be prepared to be called back at the MiniportInitializeEx function that is specified in the MiniportDriverCharacteristics parameter.

If an error occurs in DriverEntry after NdisMRegisterMiniportDriver returns successfully, the driver must call the NdisMDeregisterMiniportDriver function before DriverEntry returns. If DriverEntry succeeds, the driver must call NdisMDeregisterMiniportDriver from its MiniportDriverUnload function.

Requirements

Version

Supported in NDIS 6.0 and later.

Header

Ndis.h (include Ndis.h)

IRQL

PASSIVE_LEVEL

DDI compliance rules

Irql_Miniport_Driver_Function

See also

DriverEntry
MiniportDriverUnload
MiniportInitializeEx
MiniportSetOptions
NDIS_MINIPORT_DRIVER_CHARACTERISTICS
NdisMDeregisterMiniportDriver

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft