Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

2.2.33 SMB2 QUERY_DIRECTORY Request

The SMB2 QUERY_DIRECTORY Request packet is sent by the client to obtain a directory enumeration on a directory open. This request consists of an SMB2 header, as specified in section 2.2.1, followed by this request structure:


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

StructureSize

FileInformationClass

Flags

FileIndex

FileId

...

...

...

FileNameOffset

FileNameLength

OutputBufferLength

Buffer (variable)

...

StructureSize (2 bytes): The client MUST set this field to 33, indicating the size of the request structure, not including the header. The client MUST set this field to this value regardless of how long Buffer[] actually is in the request being sent.

 

FileInformationClass (1 byte): The file information class describing the format that data MUST be returned in. Possible values are as specified in [MS-FSCC] section 2.4. This field MUST contain one of the following values:

Value Meaning

FileDirectoryInformation
0x01

Basic information about a file or directory. Basic information is defined as the file's name, time stamp, size and attributes. File attributes are as specified in [MS-FSCC] section 2.6.

FileFullDirectoryInformation
0x02

Full information about a file or directory. Full information is defined as all the basic information plus extended attribute size.

FileIdFullDirectoryInformation
0x26

Full information plus volume file ID about a file or directory. A volume file ID is defined as a number assigned by the underlying object store that uniquely identifies a file within a volume.

FileBothDirectoryInformation
0x03

Basic information plus extended attribute size and short name about a file or directory.

FileIdBothDirectoryInformation
0x25

FileBothDirectoryInformation plus volume file ID about a file or directory.

FileNamesInformation
0x0C

Detailed information on the names of files and directories in a directory.

Flags (1 byte): Flags indicating how the query directory operation MUST be processed. This field MUST be a logical OR of the following values, or zero if none are selected:

Value Meaning

SMB2_RESTART_SCANS
0x01

The server MUST restart the enumeration from the beginning, but the search pattern is not changed.

SMB2_RETURN_SINGLE_ENTRY
0x02

The server MUST only return the first entry of the search results.

SMB2_INDEX_SPECIFIED
0x04

The server SHOULD<64> return entries beginning at the byte number specified by FileIndex.

SMB2_REOPEN
0x10

The server MUST restart the enumeration from the beginning, and the search pattern MUST be changed to the provided value. This often involves silently closing and reopening the directory on the server side.

SMB2_REOPEN implies SMB2_RESTART_SCANS as well.

FileIndex (4 bytes): The byte offset within the directory, indicating the position at which to resume the enumeration. If SMB2_INDEX_SPECIFIED is set in Flags, this value MUST be supplied, and should be based on the FileIndex value received in a previous enumeration response. Otherwise, it MUST be set to zero and the server MUST ignore it.

FileId (16 bytes): An SMB2_FILEID identifier of the directory on which to perform the enumeration. This is returned from an SMB2 Create Request to open a directory on the server.

FileNameOffset (2 bytes): The offset, in bytes, from the beginning of the SMB2 header to the search pattern to be used for the enumeration. This field MUST be 0 if no search pattern is provided.

FileNameLength (2 bytes): The length, in bytes, of the search pattern. This field MUST be 0 if no search pattern is provided.

OutputBufferLength (4 bytes): The maximum number of bytes the server is allowed to return in the SMB2 QUERY_DIRECTORY Response.

Buffer (variable): A variable-length buffer containing the Unicode search pattern for the request, as described by the FileNameOffset and FileNameLength fields. The format, including wildcards and other conventions for this pattern, is specified in [MS-CIFS] section 2.2.1.1.3.<65>

 
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.