TdiBuildQueryInformation

VOID
    TdiBuildQueryInformation (
        IN PIRP  Irp,
        IN PDEVICE_OBJECT  DevObj,
        IN PFILE_OBJECT  FileObj,
        IN PVOID  CompRoutine,
        IN PVOID  Contxt,
        IN UINT  QType,
        IN PMDL  MdlAddr
        );

TdiBuildQueryInformation sets up an internal device control IRP for a TDI_QUERY_INFORMATION request to the underlying transport in which the local-node client has already opened a file object representing an address, a connection endpoint, or a control channel.

Parameters

Irp
Points to a client-supplied IRP, either originating in a higher level network component or allocated with TdiBuildInternalDeviceControlIrp.
DevObj
Points to the device object created by the next lower TDI transport driver.
FileObj
Points to a file object representing an address, connection endpoint, or control channel.
CompRoutine
Specifies the entry point of a client-supplied IoCompletion routine or NULL. The I/O Manager calls this routine when the given IRP is completed, unless the client sets this parameter to NULL.
Contxt
Points to a client-determined context. This client-supplied pointer is passed in to the IoCompletion routine when it is called with the completed IRP. Contxt should be NULL if CompRoutine is NULL.
QType
Specifies what the client is querying. This parameter can be transport-defined or one of the following system-defined values, for which all transports support queries:
TDI_QUERY_ADDRESS_INFO
Specifies that the transport should return the information, formatted as a TDI_ADDRESS_INFO structure, in the client-supplied buffer mapped at MdlAddr.

FileObj must point to an open file object representing a transport address or a connection endpoint already associated with a transport address.

TDI_QUERY_CONNECTION_INFO
Specifies that the transport should return the information, formatted as a TDI_CONNECTION_INFO structure, in the client-supplied buffer mapped at MdlAddr.  

FileObj must point to an open file object representing a connection endpoint.

TDI_QUERY_BROADCAST_ADDRESS
Specifies that the transport should return the information, formatted as a TRANSPORT_ADDRESS structure, in the client-supplied buffer mapped at MdlAddr.

FileObject must point to an open file object representing a control channel.

TDI_QUERY_NETWORK_ADDRESS
Specifies that the transport should return the information, formatted as a TRANSPORT_ADDRESS structure, in the client-supplied buffer mapped at MdlAddr.

FileObj must point to an open file object representing a control channel.

TDI_QUERY_DATA_LINK_ADDRESS
Specifies that the transport should return the information, formatted as a TRANSPORT_ADDRESS structure, in the client-supplied buffer mapped at MdlAddr.

FileObj must point to an open file object representing a control channel.

TDI_QUERY_PROVIDER_INFO or TDI_QUERY_PROVIDER_INFORMATION
Specifies that the transport should return the information, formatted as a TDI_PROVIDER_INFO structure, in the client-supplied buffer mapped at MdlAddr.

FileObj must point to an open file object representing a control channel.

TDI_QUERY_PROVIDER_STATISTICS
Specifies that the transport should return the information, formatted as a TDI_PROVIDER_STATISTICS structure, in the client-supplied buffer mapped at MdlAddr.

FileObj must point to an open file object representing a control channel.

TDI_QUERY_DATAGRAM_INFO
Specifies that the transport should return the information, formatted as a TDI_DATAGRAM_INFO structure, in the client-supplied buffer mapped at MdlAddr.

FileObj usually points to an open file object representing a control channel. If the underlying transport supports it, FileObj can point to an open file object representing an address.

TDI_QUERY_MAX_DATAGRAM_INFO
Specifies that the transport should return the information, formatted as a TDI_MAX_DATAGRAM_INFO structure, in the client-supplied buffer mapped at MdlAddr.

FileObj usually points to an open file object representing a control channel. If the underlying transport supports it, FileObj can point to an open file object representing an address.

The underlying transport can support additional types of query-information requests at the discretion of the driver writer. Such a transport must define TDI_QUERY_XXX codes in which the most significant bit is set.

In addition to the preceding, clients of a NetBIOS transport can specify any of the following for QType:

TDI_QUERY_FIND_NAME
Specifies that the transport should return the information, formatted as FIND_NAME_HEADER followed by FIND_NAME_BUFFER structures, in the client-supplied buffer mapped at MdlAddr.

FileObj must point to an open file object representing an address.

TDI_QUERY_SESSION_STATUS
Specifies that the transport should return the information, formatted as SESSION_HEADER followed by SESSION_BUFFER structures, in the client-supplied buffer mapped at MdlAddr.

FileObj must point to an open file object representing a control channel.

TDI_QUERY_ADAPTER_STATUS
Specifies that the transport should return the information, formatted as an ADAPTER_STATUS structure, in the client-supplied buffer mapped at MdlAddr.

FileObj must point to an open file object representing a control channel.

For more information about the preceding structures, see the Win32 SDK.

MdlAddr
Points to an MDL mapping a client-supplied buffer containing any necessary request-specific information set up by the client. The transport returns the requested information in this buffer, formatted according to the given QType.

Comments

TdiBuildQueryInformation sets IRP_MJ_INTERNAL_DEVICE_CONTROL as the MajorFunction and TDI_QUERY_INFORMATION as the MinorFunction codes in the transport's I/O stack location of the given IRP.

A TDI client can use the query request to ask its underlying transport for information, such as connection-status information, a broadcast address it can use, or the features of the transport such as its size limits for sends, datagrams, and user-connect data.

The client can query information about an address, a connection endpoint, or a control channel, depending on the specified QType. The client must supply a FileObj pointer to TdiBuildQueryInformation to an open file object that is appropriate to the given QType. Otherwise, the underlying transport cannot satisfy its query request.

See Also

TDI_ADDRESS_INFO, TdiBuildInternalDeviceControlIrp, TDI_CONNECTION_INFO, TDI_DATAGRAM_INFO, TDI_MAX_DATAGRAM_INFO, TDI_PROVIDER_INFO, TDI_PROVIDER_STATISTICS, TDI_QUERY_INFORMATION, TRANSPORT_ADDRESS