Compartilhar via


2.2.4.41.1 Request

 SMB_Parameters
   {
   UCHAR WordCount;
   Words
     {
     UCHAR    AndXCommand;
     UCHAR    AndXReserved;
     USHORT   AndXOffset;
     USHORT   Flags;
     USHORT   AccessMode;
     SMB_FILE_ATTRIBUTES SearchAttrs;
     SMB_FILE_ATTRIBUTES FileAttrs;
     UTIME    CreationTime;
     USHORT OpenMode;
     ULONG  AllocationSize;
     ULONG  Timeout;
     USHORT Reserved[2];
     }
   }
 SMB_Data
   {
   USHORT ByteCount;
   Bytes
     {
     SMB_STRING FileName;
     }
   }
            


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_Parameters (31 bytes)

...

...

...

SMB_Data (variable)

...

SMB_Parameters (31 bytes):


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

WordCount

Words (30 bytes)

...

...

...

WordCount (1 byte): This field MUST be 0x0F.

Words (30 bytes):


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

AndXCommand

AndXReserved

AndXOffset

Flags

AccessMode

SearchAttrs

FileAttrs

CreationTime

OpenMode

AllocationSize

...

Timeout

...

Reserved

...

AndXCommand (1 byte): The command code for the next SMB command in the packet. This value MUST be set to 0xFF if there are no additional SMB commands in the client request packet.

AndXReserved (1 byte): A reserved field. This field MUST be 0x00 when the message is sent, and the server MUST ignore this value when the message is received.

AndXOffset (2 bytes): This field MUST be set to the offset, in bytes, from the start of the SMB Header (section 2.2.3.1) to the start of the WordCount field in the next SMB command in this packet. This field is valid only if the AndXCommand field is not set to 0xFF. If AndXCommand is 0xFF, this field MUST be ignored by the server.

Flags (2 bytes): A 16-bit field of flags for requesting attribute data and locking.

Name and  bitmask

Description

REQ_ATTRIB

0x0001

If this bit is set, the client requests that the file attribute data in the response be populated. All fields after the FID in the response are also populated. If this bit is not set, all fields after the FID in the response are zero.

REQ_OPLOCK

0x0002

Client requests an exclusive OpLock on the file.

REQ _OPLOCK_BATCH

0x0004

Client requests a Batch OpLock on the file.

AccessMode (2 bytes): A 16-bit field for encoding the requested access mode. See section 3.2.4.5.1 for a discussion on sharing modes.

Name and  bitmask

Values

Meaning

AccessMode

0x0007

0

Open for reading

1

Open for writing

2

Open for reading and writing

3

Open for execution

0x0008

Reserved

SharingMode

0x0070

0

Compatibility mode

1

Deny read/write/execute to others (exclusive use requested)

2

Deny write to others

3

Deny read/execute to others

4

Deny nothing to others

0x0080

Reserved

ReferenceLocality

0x0700

0

Unknown locality of reference

1

Mainly sequential access

2

Mainly random access

3

Random access with some locality

4 - 7

Undefined

0x0800

Reserved

CacheMode

0x1000

0

Perform caching on file

1

Do not cache the file

0x2000

Reserved

WritethroughMode

0x4000

0

Write-through mode. If this flag is set, no read ahead or write behind allowed on this file or device. When the response is returned, data is expected to be on the target disk or device.

1

0x8000

Reserved

SearchAttrs (2 bytes): The set of attributes that the file MUST have in order to be found. If none of the attribute bytes is set, the file attributes MUST refer to a regular file.<57>

FileAttrs (2 bytes): The set of attributes that the file is to have if the file needs to be created. If none of the attribute bytes is set, the file attributes MUST refer to a regular file.

CreationTime (4 bytes): A 32-bit integer time value to be assigned to the file as the time of creation if the file is created.

OpenMode (2 bytes): A 16-bit field that controls the way a file SHOULD be treated when it is opened for use by certain extended SMB requests.

Name and  bitmask

Values

Meaning

FileExistsOpts

0x0003

0

The request SHOULD fail and an error returned indicating the prior existence of the file.

1

The file is to be appended.

2

The file is to be truncated to zero (0) length.

3

Reserved

CreateFile

0x0010

0

If the file does not exist, return an error.

1

If the file does not exist, create it.

All other bits are reserved, SHOULD NOT be used by the client, and MUST be ignored by the server.

AllocationSize (4 bytes): The number of bytes to reserve on file creation or truncation. This field MAY be ignored by the server.

Timeout (4 bytes): This field is a 32-bit unsigned integer value containing the number of milliseconds to wait on a blocked open request before returning without successfully opening the file.

Reserved (4 bytes): This field is reserved and MUST be 0x00000000.

SMB_Data (variable):


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

ByteCount

Bytes (variable)

...

ByteCount (2 bytes): This field MUST be greater than or equal to 0x0002.

Bytes (variable):


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

FileName (variable)

...

FileName (variable): A buffer containing the name of the file to be opened.