Поделиться через


TDI Driver Initialization

Every TDI transport driver must provide an initialization routine explicitly named DriverEntry. In addition, a transport driver should have as many TdiDispatchXxx routines and internal driver functions as it needs to satisfy the I/O requests of its kernel-mode clients. A TDI transport driver or one of the underlying protocol drivers in its transport stack also must provide the NDIS driver lower-edge functions described in NDIS Protocol Driversand in NDIS Driver Lower-Edge Functions.

Every transport driver must have a DriverEntryroutine to be called by the I/O manager when the transport is loaded. DriverEntrymust be declared in the driver code to make the transport automatically loadable.

When it loads the driver, the I/O manager creates a driver object to represent the transport and passes a pointer to the driver object when it calls the TDI transport's DriverEntryroutine. Then, its DriverEntryroutine does the following:

  • Possibly, reads the registry (using kernel-mode support routines) to retrieve configuration information written into the registry by the transport's INF file. Using the registry information, configure itself as needed.

  • Sets all the driver's TdiDispatchXxx entry points in the driver object. The driver's TdiDispatchXxx routines will be called later by the I/O manager to handle requests from TDI clients.

  • Calls TdiRegisterProvider to notify TDI of the transport's Plug and Play and power management support.

  • Creates at least one named device object for itself with IoCreateDevice. The names of each driver's device objects are the device names stored under the transport driver's registry section Linkage key in the Export entry. Each transport driver's Export entry determines what device objects will be created by any particular transport driver during system setup.

    Some transport drivers, such as NWLink, create only one named device object no matter how many NICs they bind themselves to. Some transports, such as TCP/IP, create one or more named device objects and "export" a set of device interfaces for each such device object. Other transport drivers create a separate named device object for each bound NIC, such as Nbf_Elnkii1, Nbf_Elnkii2, and so forth.

  • Performs any other necessary initialization tasks, such as binding to underlying NDIS intermediate and/or NIC drivers.

  • As it establishes bindings to each underlying NIC, a PnP-aware transport for Windows 2000 and later also calls TdiRegisterDeviceObject with the named device object that the transport creates. Then, it makes one or more calls to TdiRegisterNetAddress to register all known network addresses (whether of the local machine or of remote nodes) associated with the transport-created device object for its newly established binding.

When such a PnP-aware transport has completed its initialization on at least one but possibly more bindings so that it is capable of transferring data over the network, the transport must call TdiProviderReady. Typically, such a PnP-aware TDI transport calls TdiProviderReadyas a consequence of an NDIS call to the ProtocolPnPEventfunction at the lower edge of the transport stack with the input NET_PNP_EVENT code NetEventBindsComplete.

A TDI transport driver must provide an Unload routine unless that driver cannot be unloaded without rendering the system unusable. Most TDI transport drivers declare an Unload routine, and their DriverEntryroutines set its entry point in the driver object. For more information about transport Unload routines, see Unloading and Deregistering a TDI Transport Driver.

For more information about the kernel-mode support routines and objects used by TDI drivers, see Summary of Kernel-Mode Support Routines.

Note   The TDI feature is deprecated and will be removed in future versions of Microsoft Windows. Depending on how you use TDI, use either the Winsock Kernel (WSK) or Windows Filtering Platform (WFP). For more information about WFP and WSK, see Windows Filtering Platform and Winsock Kernel. For a Windows Core Networking blog entry about WSK and TDI, see Introduction to Winsock Kernel (WSK).

 

 

 

Send comments about this topic to Microsoft