NdisMRegisterMiniportDriver function (ndis.h)

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


NDIS_STATUS NdisMRegisterMiniportDriver(
  [in]           PDRIVER_OBJECT                        DriverObject,
  [in]           PUNICODE_STRING                       RegistryPath,
  [in, optional] NDIS_HANDLE                           MiniportDriverContext,
  [in]           PNDIS_MINIPORT_DRIVER_CHARACTERISTICS MiniportDriverCharacteristics,
  [out]          PNDIS_HANDLE                          NdisMiniportDriverHandle


[in] DriverObject

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).

[in] RegistryPath

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

[in, optional] MiniportDriverContext

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

[in] MiniportDriverCharacteristics

A pointer to an NDIS_MINIPORT_DRIVER_CHARACTERISTICS structure that the caller initialized.

[out] NdisMiniportDriverHandle

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 code Description

NdisMRegisterMiniportDriver registered the miniport driver successfully.

The CharacteristicsLength parameter is incorrect for the NDIS version that is specified at the MajorNdisVersion member in the structure at MiniportDriverCharacteristics .
The MajorNdisVersion or MinorNdisVersion specified in the characteristics structure is invalid.
A shortage of resources, possibly memory, prevented NDIS from registering the caller.
This is a default error status, returned when none of the preceding errors caused the registration to fail.


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 any time after DriverEntry returns.

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.


Requirement Value
Minimum supported client Supported in NDIS 6.0 and later.
Target Platform Universal
Header ndis.h (include Ndis.h)
Library Ndis.lib
DDI compliance rules Irql_Miniport_Driver_Function(ndis)

See also

Initializing a Miniport Driver