A.3.1  Initializing Wrapper and Registering Drivers

To initialize the NDIS interface library, Windows NT must ensure the Configuration Registry has a database for each NDIS 3.0 driver, as Figure A.3.1 shows. Using the binding information in the registry database, the operating system creates a driver object and calls the NIC driver at its DriverEntry function. In turn, the full NIC driver calls NdisInitializeWrapper, to which it passes the address of the driver object and the associated Configuration Registry path. The NDIS interface library function can then perform wrapper initialization chores.

After NdisInitializeWrapper returns, the full NIC driver calls NdisRegisterMac to register itself as a driver on the network. This function stores the addresses of driver-supplied dispatch functions in the driver object. Function parameters are the entry points of all the upper-edge functions for the full NIC driver.

When all NIC drivers for the network have registered themselves, the operating system loader calls the DriverEntry function of a transport driver. The transport driver then makes a call to NdisRegisterProtocol in the NDIS interface library to register itself with the NDIS interface library. Each transport driver must be bound to a network interface card so that it can send and receive packets on the network. For details of network binding for Windows NT, refer to the Part 7, Network Component Binding.

At this point, the library allocates a block of non-paged pool memory for driver information, including addresses of event handlers and capability data, and writes the transport driver a handle to this information. The NDIS interface library includes a reference count in the transport driver block. It initializes the count to one and increments it any time the transport driver opens a network interface card. The library decrements the count when the transport driver closes a network interface card or when the driver calls NdisDeregisterProtocol. When the count reaches zero, the library frees the transport driver block.

Figure A.3.1 Initializing Wrapper and Registering Drivers

The operating system repeats this procedure for all transport drivers in the Configuration Registry. When all transport drivers are registered, they are ready to receive packets on the network. First, however, the NDIS interface library must register all network interface cards. For more information about registering network interface cards, see Section A.3.2.