Compartilhar via


3.2.4.20.6 Application Requests a Pass-Through Operation

An SMB2 server MAY<170> support pass-through operation requests.

The application provides:

  • A handle to the Open identifying a file or named pipe on which to issue the operation.

  • An input buffer.

  • An output buffer.

  • A maximum input buffer response size, in bytes.

  • A maximum output buffer response size, in bytes.

  • An operation code.

  • A Boolean indicating whether the operation is an FSCTL or an IOCTL.

If the handle is invalid, or if no Open referenced by the handle is found, the client MUST return an implementation-specific error code. If the handle is valid and Open is found, the client MUST proceed as follows.

For the specified Open, the client MUST select a connection as specified in section 3.2.4.1.7. If no connection is available, the client MUST fail the FSCTL or IOCTL operation.

Otherwise, the client initializes an SMB2 IOCTL Request following the syntax specified in section 2.2.31. The SMB2 header MUST be initialized as follows:

  • The Command field is set to SMB2 IOCTL.

  • The MessageId field is set as specified in section 3.2.4.1.3.

  • The SessionId field is set to Open.TreeConnect.Session.SessionId.

  • The TreeId field is set to Open.TreeConnect.TreeConnectId.

The SMB2 IOCTL Request MUST be initialized as follows:

  • The CtlCode field is set to the operation code that is received from the application.

  • The FileId field is set to Open.FileId.

  • The InputOffset field is set to the offset to the Buffer[], in bytes, from the beginning of the SMB2 header.

  • The InputCount field is set to the size, in bytes, of the application-provided input buffer.

  • The input buffer received from the application is copied into the request at InputOffset bytes from the beginning of the SMB2 header.

  • The OutputOffset field SHOULD<171> be set to zero.

  • The OutputCount field is set to 0.

  • The MaxInputResponse field is set to the maximum input buffer response size, in bytes, that the application will accept.

  • The MaxOutputResponse field is set to the maximum output buffer response size, in bytes, that the application will accept.

  • If the operation is an FSCTL, SMB2_0_IOCTL_IS_FSCTL in the Flags field is set to TRUE. Otherwise, it is set to FALSE.

The request MUST be sent to the server.