NdisRegisterProtocolDriver function

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

Syntax

NDIS_STATUS NdisRegisterProtocolDriver(
  NDIS_HANDLE                           ProtocolDriverContext,
  PNDIS_PROTOCOL_DRIVER_CHARACTERISTICS ProtocolCharacteristics,
  PNDIS_HANDLE                          NdisProtocolHandle
);

Parameters

ProtocolDriverContext

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

ProtocolCharacteristics

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

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
NDIS_STATUS_SUCCESS
NdisRegisterProtocolDriver returns NDIS_STATUS_SUCCESS if it registered the protocol driver.
NDIS_STATUS_BAD_VERSION
The version specified in the MajorNdisVersion member of the structure at ProtocolCharacteristics is invalid.
NDIS_STATUS_BAD_CHARACTERISTICS
Some members of the structure at the ProtocolCharacteristics parameter are invalid.
NDIS_STATUS_RESOURCES
NdisRegisterProtocolDriver failed due to insufficient resources.
NDIS_STATUS_FAILURE
NdisRegisterProtocolDriver returns NDIS_STATUS_FAILURE if none of the preceding values applies.

Remarks

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.

Requirements

   
Windows version Supported in NDIS 6.0 and later.
Target Platform Desktop
Header ndis.h (include Ndis.h)
Library Ndis.lib
IRQL PASSIVE_LEVEL
DDI compliance rules Irql_Protocol_Driver_Function

See Also

DriverEntry of NDIS Protocol Drivers

NDIS_PROTOCOL_DRIVER_CHARACTERISTICS

NdisDeregisterProtocolDriver

NdisSetOptionalHandlers