NTSTATUS
TdiDispatchClose (
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
TdiDispatchClose closes an address, connection endpoint, or control channel.
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:
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.
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.
By default, TdiDispatchClose runs at IRQL PASSIVE_LEVEL.