22.214.171.124.3 Handling a Pipe Transaction Request
When the server receives a request with an SMB2 header with a Command value equal to SMB2 IOCTL, and a CtlCode of FSCTL_PIPE_TRANSCEIVE, message handling proceeds as follows.
If the share on which the request is being executed is not a named pipe share, the server SHOULD<321> fail the request with STATUS_NOT_SUPPORTED.
The server MUST attempt to write the number of bytes specified in the request by the InputCount field into the named pipe. If the write attempt fails, the server MUST fail the request returning the error code received from the named pipe.
The server MUST then attempt to read the number of bytes specified in the request by MaxOutputResponse from the named pipe. If the read attempt fails, the server MUST fail the request returning the error code received from the named pipe. For more information on reading from a pipe, see section 126.96.36.199.
If the read/write attempt is not finished in 1 millisecond, the server MUST send an interim response to the client. If the read/write attempt succeeds,<322> the server MUST then construct an SMB2 IOCTL response following the syntax specified in section 2.2.32, with the following values:
CtlCode MUST be set to FSCTL_PIPE_TRANSCEIVE.
FileId.Persistent MUST be set to Open.DurableFileId. FileId.Volatile MUST be set to Open.FileId.
InputOffset SHOULD be set to the offset, in bytes, from the beginning of the SMB2 header to the Buffer field of the response.
InputCount SHOULD<323> be set to zero.
If any data was read from the pipe, OutputOffset MUST be set to InputOffset + InputCount, rounded up to a multiple of 8. Otherwise, OutputOffset SHOULD<324> be set to zero.
OutputCount MUST be set to the number of bytes read from the pipe. If no data is to be returned, the server MUST set OutputCount to zero.
Flags MUST be set to zero.
The server MUST copy the bytes read into the Buffer field at the OutputOffset computed above.
The response MUST be sent to the client.