Compartilhar via


2.2.1 Mailslot Write Message

The SMB_COM_TRANSACTION data structure (see [MS-CIFS] section 2.2.4.33) for a mailslot write message required to be as follows:

Note The empty fields in the following table represent the continuation of the fields preceding them.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

SMB Header (32 bytes)

...

...

WordCount

TotalParameterCount

TotalDataCount

...

MaxParameterCount

MaxDataCount

...

MaxSetupCount

Reserved

Flags

...

Timeout

...

Reserved2

ParameterCount

...

ParameterOffset

DataCount

...

DataOffset

SetupCount

Reserved3

MailSlotOpcode

Priority

...

Class

ByteCount

...

MailslotName (variable)

...

Padding (variable)

...

Databytes (variable)

...

SMB Header (32 bytes): The format of the 32-byte SMB header is specified in [MS-SMB] section 2.2.3.1. For a mailslot write message, the header fields are required to be set to the following values:

  • Protocol: MUST be set to (0xFF, 'S', 'M', 'B'), as specified in [MS-SMB] section 2.2.3.1.

  • Command: MUST be set to 0x25 to represent the SMB_COM_TRANSACTION, as specified in [MS-SMB] section 2.2.3.1.

  • Status: SHOULD be set to 0 and MUST be ignored on receipt.

  • Flags: SHOULD<3> be set to 0x18 and MUST be ignored on receipt.

  • Flags2: SHOULD<4> be set to 0x04 and MUST be ignored on receipt.

  • PidHigh: SHOULD be set to 0 and MUST be ignored on receipt.

  • SecurityFeatures: SHOULD be set to 0 and MUST be ignored on receipt.

  • TID: SHOULD be set to 0 and MUST be ignored on receipt.

  • PIDLow: SHOULD<5> be set to 0xFEFF and MUST be ignored on receipt.

  • UID: SHOULD be set to 0 and MUST be ignored on receipt.

  • MID: SHOULD be set to 0 and MUST be ignored on receipt.

WordCount (1 byte): An unsigned 8-bit integer that specifies the count of words that occur between the WordCount field and the ByteCount field. For a mailslot write request, the WordCount value MUST be set to 0x11.

TotalParameterCount (2 bytes): An unsigned 16-bit integer that specifies the number of bytes in the parameter buffer. For a mailslot write request, the TotalParameterCount value MUST be set to zero and be ignored on receipt. Because this value MUST be set to zero, it indicates that no parameter array is being sent in this request.

TotalDataCount (2 bytes): An unsigned 16-bit integer that specifies the number of bytes in the DataBytes field. For a mailslot write request, the TotalDataCount value MUST be set to the size in bytes of the DataBytes field to be sent to the receiver. This value is always the same as the DataCount field for a mailslot write request.

MaxParameterCount (2 bytes): An unsigned 16-bit integer field. For a mailslot write request, the MaxParameterCount value SHOULD<6> be set to zero and MUST be ignored on receipt.

MaxDataCount (2 bytes): An unsigned 16-bit integer field. For a mailslot write request, the MaxDataCount field MUST be set to zero and MUST be ignored on receipt.

MaxSetupCount (1 byte): An unsigned 8-bit integer field. For a mailslot write request, the MaxSetupCount field MUST be set to zero and MUST be ignored on receipt.

Reserved (1 byte): An unsigned 8-bit integer reserved for future use. The Reserved field MUST be set to zero and ignored on receipt.

Flags (2 bytes): An unsigned 16-bit integer that consists of a set of options that provide additional information to the server on this request. The client MAY set either of the bits shown in the following table. Unused bit fields SHOULD be set to 0 by the client when sending a request and MUST be ignored when received by the server.

Value

Meaning

DISCONNECT_TID

0x0001

The server MUST disconnect the tree connect associated with the Tid received in the SMB header of this request after the request is completed. The client SHOULD NOT send an SMB_COM_TREE_DISCONNECT for this tree connect.

NO_RESPONSE

0x0002

The server MUST process this client request as a one-way transaction and MUST NOT send a response back to the client.<7>

Timeout (4 bytes): An unsigned 32-bit integer that represents the maximum amount of time in milliseconds to wait for the operation to be completed. The client MAY set this field to 0 to indicate that no time-out is given. If the operation is not completed within the specified time, the server MAY abort the request and send a failure response.<8>

Reserved2 (2 bytes): An unsigned 16-bit integer reserved for future use. The Reserved2 field MUST be set to zero and ignored on receipt.

ParameterCount (2 bytes): An unsigned 16-bit integer that specifies the count of bytes in the parameter buffer of this packet. For a mailslot write request, the ParameterCount field MUST be set to zero and ignored on receipt. Because this value MUST be set to zero, it indicates that no parameter array is being sent in this request.

ParameterOffset (2 bytes): An unsigned 16-bit integer that specifies the offset in bytes from the beginning of the SMB_COM_TRANSACTION packet to where the parameter buffer begins.

DataCount (2 bytes): An unsigned 16-bit integer that specifies the count of bytes in the DataBytes field. For a mailslot write request, the DataCount field MUST be set to the size in bytes of the DataBytes field to be sent to the receiver. This value is always the same as the TotalDataCount field.

DataOffset (2 bytes): An unsigned 16-bit integer that specifies the offset to the DataBytes field in this packet. For a mailslot write request, the DataOffset field MUST be set to the offset of the Databytes field from the beginning of the SMB_COM_TRANSACTION message.

SetupCount (1 byte): An unsigned 8-bit integer that MUST be set to 0x03.

Reserved3 (1 byte): An unsigned 8-bit integer reserved for future use. The Reserved3 field MUST be set to zero and ignored on receipt.

MailSlotOpcode (2 bytes): An unsigned 16-bit integer. The MailSlotOpcode field MUST be set to 0x0001.

Priority (2 bytes): An unsigned 16-bit integer that represents the numeric priority of the message being written to the mailslot. The Priority field MUST be in the range of 0 through 9. The larger the value, the higher the priority.<9>

Class (2 bytes): An unsigned 16-bit integer that represents the class of the mailslot request.<10> The Class field MUST be set to one of the following values.

Value

Meaning

Class 1

0x0001

A first-class mailslot is reliable and guarantees delivery of the message. This class MAY transmit messages of up to 65,535 bytes. Messages to class 1 mailslots MUST not be broadcast.

Class 2

0x0002

A second-class mailslot is unreliable and does not guarantee delivery of the message. This class MAY transmit messages up to a maximum length that depends on the configuration of the server but will never be less than 360 bytes. Messages to class 2 mailslots MAY be broadcast, which allows a message to be sent to a particular mailslot on all systems.

ByteCount (2 bytes): An unsigned 16-bit integer that MUST specify the number of bytes that follow this field. For a mailslot write request, the ByteCount field MAY be ignored on receipt, and the number of bytes that follow this field is determined by using the values in the DataOffset and DataCount fields.<11>

MailslotName (variable): A null-terminated, case-insensitive ASCII string that denotes the name of the mailslot to which the message is being sent. The string in the MailslotName field MUST be of the form "\mailslot\<name>", where <name> is the name of the mailslot. The <name> MUST be a non-empty string and names are not case sensitive. The name field MAY contain multiple directory levels, such as "\mailslot\directory\ms1", or a single level such as "\mailslot\ms1".<12>

Padding (variable): Padding data. The Padding field MUST be large enough so that the DataBytes field is 32-bit aligned. To that end, this field MUST be 0 through 3 bytes long, inclusive. The Padding field MUST be set to zero and ignored on receipt.

Databytes (variable): Buffer containing the mailslot message to be delivered to the server. The size of the mailslot message MUST NOT exceed the maximum allowed size, as specified in section 2.1.