Share via


DriverEntry of NDIS Protocol Drivers (Compact 2013)

3/26/2014

This function is required and is the first function that the system calls in any NDIS protocol driver.

Syntax

NTSTATUS
  DriverEntry(
    IN PDRIVER_OBJECT  DriverObject,
    IN PUNICODE_STRING  RegistryPath
    );

Parameters

  • DriverObject
    A pointer to the driver object that represents this driver
  • RegistryPath
    A pointer to a driver-specific registry path specification set up by the driver's installation file (.inf).

Return Value

DriverEntry returns STATUS_SUCCESS, or its equivalent NDIS_STATUS_SUCCESS, if the driver registered as an NDIS protocol driver successfully. If DriverEntry fails initialization by propagating an error status that was returned by an NdisXxx function or by a kernel-mode support routine, the driver will not remain loaded. DriverEntry must execute synchronously; that is, it cannot return STATUS_PENDING or its equivalent NDIS_STATUS_PENDING.

Remarks

The DriverEntry function of an NDIS protocol driver must call the NdisRegisterProtocolDriver function. To register the driver's ProtocolXxx entry points with the NDIS library, a protocol driver initializes an NDIS_PROTOCOL_DRIVER_CHARACTERISTICS structure and passes it to NdisRegisterProtocolDriver.

All types of NDIS protocol drivers should register fully functional ProtocolBindAdapterEx and ProtocolUnbindAdapterEx functions to support Plug and Play (PnP). Generally, a DriverEntry function should call NdisRegisterProtocolDriver immediately before it returns control with a status value of STATUS_SUCCESS or NDIS_STATUS_SUCCESS.

Any protocol driver that exports a set of standard kernel-mode driver routines in addition to its NDIS-defined ProtocolXxx functions must set the entry points for those driver routines in the given driver object that is passed in to its DriverEntry function.

If an attempt to allocate resources that the driver has to perform network I/O operations fails, DriverEntry should release all resources that it already allocated before it returns control with a status other than STATUS_SUCCESS or NDIS_STATUS_SUCCESS.

If an error occurs after a successful call to NdisRegisterProtocolDriver, the driver must call the NdisDeregisterProtocolDriver function before DriverEntry returns.

To enable protocol drivers to register optional services, NDIS calls the ProtocolSetOptions function, if this function exists, within the context of NdisRegisterProtocolDriver.

Intermediate drivers share most of the DriverEntry requirements of protocol drivers. For more information about the DriverEntry function for intermediate drivers, see DriverEntry of NDIS Intermediate Drivers.

See Also

Reference

NDIS Protocol Driver Functions
MiniportSetOptions
NDIS_PROTOCOL_DRIVER_CHARACTERISTICS
NdisDeregisterProtocolDriver
NdisRegisterProtocolDriver
NdisSetOptionalHandlers
ProtocolBindAdapterEx
ProtocolSetOptions
ProtocolUnbindAdapterEx