188.8.131.52 Application Requests Enumerating a Directory
The application provides:
A handle to the Open identifying a directory.
The maximum buffer size it will accept in response.
A Boolean indicating whether the enumeration should be restarted.
A Boolean indicating whether only a single entry should be returned.
A Boolean indicating whether the file specifier has been changed if the enumeration is being restarted.
A 4-byte index number to resume the enumeration from if the destination file system supports it (optional).
A file specifier string for the enumeration.
If the handle is invalid, or if no Open referenced by the handle is found, the client MUST return an implementation-specific error code. If the handle is valid and Open is found, the client MUST proceed as follows.
If Open.Connection is NULL, and Open.Durable is TRUE, the client SHOULD attempt to reconnect to this open, as specified in section 184.108.40.206. If the reconnect succeeds, the enumeration MUST be retried. If it fails, the error code MUST be returned to the application.
If Open.Connection is NULL, and Open.Durable is FALSE, the client MUST fail the enumeration operation.
The Command field is set to SMB2 QUERY_DIRECTORY.
The SessionId field is set to Open.TreeConnect.Session.SessionId.
The TreeId field is set to Open.TreeConnect.TreeConnectId.
The SMB2 QUERY_DIRECTORY Request MUST be initialized as follows:
The FileInformationClass field is set to the InformationClass that is received from the application.
The OutputBufferLength field is set to the maximum output buffer that the calling application will accept. An OutputBufferLength exceeding Connection.MaxTransactSize will be rejected by the server.
If a file specifier string is provided, the client copies it into the Buffer and sets the FileNameOffset to the offset, in bytes, from the beginning of the SMB2 header to the start of the Buffer; and the FileNameLength to the length, in bytes, of the file specifier string. Otherwise, it sets FileNameOffset and FileNameLength to 0.
If a file index was provided by the application, the client sets the value in the FileIndex field and sets SMB2_INDEX_SPECIFIED to TRUE in the Flags field.
The FileId field is set to Open.FileId.
The Flags field MUST be set to a combination of zero or more of the following bit values, as specified in section 2.2.37:
SMB2_RESTART_SCANS if the application requested that the enumeration be restarted.
SMB2_REOPEN if the application requested that the enumeration be restarted and indicated that the file specifier has changed<127>.
SMB2_RETURN_SINGLE_ENTRY if the application requested that only a single entry be returned.
If Connection.Dialect is not "2.0.2" and if Connection.SupportsMultiCredit is TRUE, the CreditCharge field in the SMB2 header MUST be set to ( 1 + (OutputBufferLength – 1) / 65536 ).
The MessageId field in the SMB2 header is set as specified in section 220.127.116.11.3, and the request is sent to the server.