3.3.5.15 Receiving an SMB2 IOCTL Request

When the server receives a request with an SMB2 Header with a Command value equal to SMB2 IOCTL, message handling proceeds as follows:

The server MUST locate the session, as specified in section 3.3.5.2.9.

The server MUST locate the tree connection, as specified in section 3.3.5.2.11.

If the Flags field of the request is not SMB2_0_IOCTL_IS_FSCTL, the server MUST fail the request with STATUS_NOT_SUPPORTED.

If the CtlCode is FSCTL_DFS_GET_REFERRALS, FSCTL_DFS_GET_REFERRALS_EX, FSCTL_QUERY_NETWORK_INTERFACE_INFO, FSCTL_VALIDATE_NEGOTIATE_INFO, or FSCTL_PIPE_WAIT and the value of FileId in the SMB2 Header of the request is not 0xFFFFFFFFFFFFFFFF, then the server MUST fail the request with STATUS_INVALID_PARAMETER.

For CtlCode values other than FSCTL_DFS_GET_REFERRALS, FSCTL_DFS_GET_REFERRALS_EX, FSCTL_QUERY_NETWORK_INTERFACE_INFO, FSCTL_VALIDATE_NEGOTIATE_INFO, and FSCTL_PIPE_WAIT, the server MUST locate the open on which the client is requesting the operation by performing a lookup in Session.OpenTable by using the FileId.Volatile field of the request as the lookup key. If no open is found or if Open.DurableFileId is not equal to FileId.Persistent, the server MUST fail the request with STATUS_FILE_CLOSED. Otherwise, the server MUST locate the Request in Connection.RequestList for which Request.MessageId matches the MessageId value in the SMB2 header, and set Request.Open to the Open.

If Open.IsPersistent is FALSE and Open.IsReplayEligible is TRUE, the server MUST set Open.IsReplayEligible to FALSE.

If either InputCount, MaxInputResponse, or MaxOutputResponse is greater than Connection.MaxTransactSize, the server SHOULD<370> fail the request with STATUS_INVALID_PARAMETER.

If InputCount is not equal to zero, the server MUST fail the request with STATUS_INVALID_PARAMETER in the following cases:

§ If InputOffset is greater than zero but less than (size of SMB2 header + size of the SMB2 IOCTL request not including Buffer).

§ If InputOffset is not a multiple of 8 bytes.

§ If InputOffset is greater than size of SMB2 Message.

  • If (InputOffset + InputCount) is greater than size of SMB2 Message.

    If InputCount is equal to zero and InputOffset is greater than size of SMB2 Message, the server MAY<371> fail the request with STATUS_INVALID_PARAMETER.

    The server SHOULD<372> ignore OutputOffset and OutputCount fields.

Note that any padding inserted in the response message between the input buffer and output buffer to align the output buffer to an 8-byte boundary, if necessary, is not included in the size of either the input or the output buffer.

The server MUST NOT return an output buffer containing more bytes of data than the MaxOutputResponse value specified by the client. If the underlying object store indicates an insufficient buffer passed in with STATUS_BUFFER_OVERFLOW, the server SHOULD set the OutputCount in the IOCTL response structure to the size of the data returned in that buffer by the underlying object store and SHOULD<373> copy OutputCount bytes into the output buffer, and MUST return a status of STATUS_BUFFER_OVERFLOW.

If Connection.SupportsMultiCredit is TRUE, the server MUST validate CreditCharge based on the maximum of (InputCount + OutputCount) and (MaxInputResponse + MaxOutputResponse), as specified in section 3.3.5.2.5. If the validation fails, it MUST fail the IOCTL request with STATUS_INVALID_PARAMETER.

The server SHOULD<374> fail the request with STATUS_NOT_SUPPORTED when an FSCTL is not allowed on the server, and SHOULD<375> fail the request with STATUS_INVALID_DEVICE_REQUEST when the

Processing of FSCTL_SET_INTEGRITY_INFORMATION_EX is handled as described in [MS-FSA] and [MS-FSCC] when the system is updated with  [MSKB-5014019], [MSKB-5014021], [MSKB-5014022], [MSKB-5014023], [MSKB-5014701], [MSKB-5014702], or [MSKB-5014710].

FSCTL is allowed, but is not supported on the file system on which the file or directory handle specified by the FSCTL exists, as specified in [MS-FSCC] section 2.2.

If IsSharedVHDSupported is FALSE, and CtlCode is FSCTL_SVHDX_SYNC_TUNNEL_REQUEST, FSCTL_QUERY_SHARED_VIRTUAL_DISK_SUPPORT, or FSCTL_SVHDX_ASYNC_TUNNEL_REQUEST, the server MUST fail the request with STATUS_INVALID_DEVICE_REQUEST.

Processing for a specific CtlCode is as specified in subsequent sections.

The status code returned by this operation MUST be one of those defined in [MS-ERREF]. Common status codes returned by this operation include:

  • STATUS_SUCCESS

  • STATUS_INSUFFICIENT_RESOURCES

  • STATUS_ACCESS_DENIED

  • STATUS_FILE_CLOSED

  • STATUS_NETWORK_NAME_DELETED

  • STATUS_USER_SESSION_DELETED

  • STATUS_NETWORK_SESSION_EXPIRED

  • STATUS_CANCELLED

  • STATUS_INVALID_PARAMETER

  • STATUS_BUFFER_OVERFLOW

  • STATUS_NOT_SUPPORTED

  • STATUS_BUFFER_TOO_SMALL

  • STATUS_OBJECT_NAME_NOT_FOUND

  • STATUS_END_OF_FILE

  • STATUS_INVALID_DEVICE_REQUEST