Protocol Driver's DriverEntry and Initialization (NDIS 5.1)
Note NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.A protocol driver's initial required entry point must be explicitly named DriverEntryso that the loader can identify it. All other exported functions, described here as ProtocolXxx, can have any developer-specified name since they are passed as addresses to NDIS. The definition of DriverEntryis the same as for any kernel-mode driver. For additional information about ProtocolXxx functions and DriverEntry, see DriverEntry of NDIS protocol drivers.
If the protocol driver exports a set of standard kernel-mode driver routines, such as any (Tdi)DispatchXxx and Unloadroutines, in addition to the NDIS-defined ProtocolXxx functions, the protocol driver must set the entry points of its standard routines in the DriverObjectpassed to DriverEntry, like any other kernel-mode intermediate driver.
DriverEntrycan initialize spin locks to protect any globally-shared resources that the protocol driver allocates, such as state variables, structures, and memory areas. The driver uses these resources to track connections and sends in progress or driver-allocated queues.
If DriverEntryfails to allocate any resources that the protocol driver requires to operate, the driver should release any previously-allocated resources. The protocol driver calls NdisDeregisterProtocol, if necessary, and returns an appropriate error status.
The following topics provide additional information about NDIS protocol driver initialization: