Closing a Transport Address or Control Channel
After closing any associated connections, a TDI client is ready to close an open transport address.
When a client no longer has any use for an open transport address or control channel, it mustrelease that object as follows:
Pass the file object pointer returned by ObReferenceObjectByHandle to ObDereferenceObject.
Pass the file handle that was returned by ZwCreateFile when the connection endpoint was opened to ZwClose.
In a similar manner, a TDI client also can close any control channel it has opened in its underlying transport driver.
If the client opened the file object representing a control channel with a call to IoGetDeviceObjectPointer, it must pass the returned file object pointer to ObDereferenceObject to release the file object.
Then, the I/O manager submits IRPs to the transport's TdiDispatchCleanupand TdiDispatchCloseroutines.
These transport routines immediately close the transport address or control channel and free all associated client-specific transport driver resources. For example, TdiDispatchCleanup cancels any pending requests on a transport address that is being closed, deregisters any ClientEventXxx handlers on that address, and cleans up client-specific state for that address. If this client has released the last file handle for a particular transport address, the transport also releases internal state for that transport address.
After ZwClosereturns to the client, it cannot submit a request to the underlying transport for the transport address or control channel it previously had open. The client-specific file object representing that address or control channel no longer exists.
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).