NTSTATUS
TdiDispatchClose (
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
TdiDispatchClose closes an address, connection endpoint, or control channel.
Parameters
DeviceObject
Points to the device object created by the TDI transport.
Irp
Points 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
Points to the file object representing an address, connection endpoint, or control channel. The transport driver uses the value(s) of the FsContext and possibly FsContext2 fields(s) 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.
Comments
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.
See Also