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


TdiDispatchClose routine

The TdiDispatchClose routine closes an address, connection endpoint, or control channel.

Syntax

NTSTATUS TdiDispatchClose(
  _In_ PDEVICE_OBJECT DeviceObject,
  _In_ PIRP           Irp
);

Parameters

  • DeviceObject [in]
    Pointer to the device object created by the TDI transport.

  • Irp [in]
    Pointer to the IRP with IRP_MJ_CLOSE set as the MajorFunctionCode in the I/O stack location of the transport driver.

    A transport calls IoGetCurrentIrpStackLocation with the given Irp to get a pointer to its own stack location in the IRP, shown in the following list as IrpSp. The transport can use the information set in the following members of the IRP in processing a close request:

    • IoStatus.Status
      Specifies the final status of the close operation. The transport sets this member to the same value that will be returned by TdiDispatchClose. ( IoStatus.Information is set to zero.)

    • IrpSp-> MajorFunction
      Specifies IRP_MJ_CLOSE. The transport can ignore this member if it exports a TdiDispatchClose routine that handles only close requests.

    • IrpSp -> FileObject
      Pointer to the file object representing an address, connection endpoint, or control channel. The transport driver uses the values of the FsContext and possibly FsContext2 fields in this file object to access any remaining driver-allocated state that TdiDispatchCleanup did not release already.

Return value

TdiDispatchClose returns STATUS_SUCCESS when it has carried out any driver-determined operations, such as releasing resources allocated to track the given address, connection endpoint, or control channel, for the file object being closed.

Remarks

TdiDispatchClose runs when the I/O manager is releasing its last reference to the handle of the file object representing an address, connection endpoint, or control channel. Such a file object is deallocated when this last reference to the file handle has been released.

When the I/O manager is closing the last handle to an open file object that represents an address, connection endpoint, or control channel, it calls TdiDispatchCleanup. In other words, the I/O manager always submits an IRP_MJ_CLEANUP request to a transport before it submits an IRP_MJ_CLOSE request for a particular file object.

Closing an address, connection endpoint, or control channel is an inherently synchronous operation. TdiDispatchClose can block waiting for internal driver functions to handle particular subtasks, but TdiDispatchClose must complete the input close IRP itself.

TdiDispatchClose is responsible for releasing any driver-allocated resources associated with the given file object, unless all such resources were already released by TdiDispatchCleanup.

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).

 

Requirements

Target platform

Desktop

Header

Wdm.h (include Ntddk.h, Wdm.h, or Ntddk.h)

IRQL

PASSIVE_LEVEL

See also

TdiDispatchCleanup

 

 

Send comments about this topic to Microsoft