NdisRegisterProtocolDriver function (ndis.h)

A protocol driver calls the NdisRegisterProtocolDriver function to register its ProtocolXxx functions with NDIS.


NDIS_STATUS NdisRegisterProtocolDriver(
  [in, optional] NDIS_HANDLE                           ProtocolDriverContext,
  [in]           PNDIS_PROTOCOL_DRIVER_CHARACTERISTICS ProtocolCharacteristics,
  [out]          PNDIS_HANDLE                          NdisProtocolHandle


[in, optional] ProtocolDriverContext

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

[in] ProtocolCharacteristics

A pointer to an NDIS_PROTOCOL_DRIVER_CHARACTERISTICS structure that the protocol driver created and initialized with its ProtocolXxx function entry points.

[out] NdisProtocolHandle

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

Return value

NdisRegisterProtocolDriver returns one of the following status values:

Return code Description

NdisRegisterProtocolDriver returns NDIS_STATUS_SUCCESS if it registered the protocol driver.

The version specified in the MajorNdisVersion member of the structure at ProtocolCharacteristics is invalid.
Some members of the structure at the ProtocolCharacteristics parameter are invalid.

NdisRegisterProtocolDriver failed due to insufficient resources.


NdisRegisterProtocolDriver returns NDIS_STATUS_FAILURE if none of the preceding values applies.


A protocol driver calls the NdisRegisterProtocolDriver function from its DriverEntry routine. For more information about DriverEntry, see DriverEntry of NDIS Protocol Drivers.

Drivers that call NdisRegisterProtocolDriver must be prepared for an immediate call to any of their ProtocolXxx functions.

Every protocol driver exports a set of ProtocolXxx functions by setting up the NDIS_PROTOCOL_DRIVER_CHARACTERISTICS structure and calling NdisRegisterProtocolDriver. NDIS copies this structure to the NDIS library's internal storage.

To allow protocol drivers to register optional services, NDIS calls the ProtocolSetOptions function within the context of NdisRegisterProtocolDriver.

Protocol drivers call the NdisDeregisterProtocolDriver function to release resources that were previously allocated with NdisRegisterProtocolDriver.


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

See also

DriverEntry of NDIS Protocol Drivers