Handling a Peek at Pipe Data 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_PEEK, message handling proceeds as follows:

The server MUST attempt to read the number of bytes specified in the request by MaxOutputResponse from the named pipe without removing the bytes from the pipe. If the read attempt fails, the server MUST fail the request and return the error code received from the named pipe. An FSCTL_PIPE_PEEK MUST never block. A MaxOutputResponse value of zero is allowed.

If the share on which the request is being executed is not a named pipe share, the server SHOULD<326> fail the request with STATUS_NOT_SUPPORTED.

If the read attempt succeeds, the server MUST then construct an SMB2 IOCTL response by following the syntax specified in section 2.2.32, with the following values:

  • CtlCode MUST be set to FSCTL_PIPE_PEEK.

  • 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 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<327> be set to zero.

  • OutputCount MUST be set to the number of bytes read from the pipe.

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