共用方式為


3.2.4.24 Application Requests Canceling an Operation

The application provides the CancelId of the operation that is to be canceled.

The client MUST enumerate all connections in the ConnectionTable and look up a Request in Connection.OutstandingRequests where Request.CancelId matches the application-supplied CancelId. If there is a match, the client performs the following:

The client initializes an SMB2 CANCEL Request following the syntax specified in section 2.2.30. The SMB2 header is initialized as follows:

  • The Command field MUST be set to SMB2 CANCEL.

  • The MessageId field SHOULD<179> be set to the identifier that is previously used for the request being canceled. Because the same MessageId is reused, cancel requests MUST NOT consume a sequence number.

  • If Request.AsyncId is not empty, indicating that the command has previously returned an interim response, the client sets AsyncId to Request.AsyncId and SMB2_FLAGS_ASYNC_COMMAND to TRUE in the Flags field and sets AsyncId to Request.AsyncId.

The SessionId field MUST be set to the session identifier that is previously used for the request being canceled. If the session identified by SessionId has Session.SigningRequired equal to TRUE, the client sets SMB2_FLAGS_SIGNED to TRUE in the Flags field. The SMB2 CANCEL Request MUST be initialized to the default values, as specified in 2.2.30.

The request MUST be sent to the server.

No status is returned to the caller.