2.2.4.58.2 Response

 SMB_Parameters
   {
   UCHAR  WordCount;
   Words
     {
     USHORT Count;
     }
   }
 SMB_Data
   {
   USHORT ByteCount;
   Bytes
     {
     UCHAR                     BufferFormat;
     USHORT                    DataLength;
     SMB_Directory_Information DirectoryInformationData[DataLength];
     }
   }


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

SMB_Data (variable)

...

SMB_Parameters (3 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

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

Words (2 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

Count

Count (2 bytes): The number of directory entries returned in this response message. This value MUST be less than or equal to the value of MaxCount in the initial request.

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 0x0003.

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

BufferFormat

DataLength

DirectoryInformationData (variable)

...

BufferFormat (1 byte): This field MUST be 0x05, which indicates that a variable-size block is to follow.

DataLength (2 bytes): The size, in bytes, of the DirectoryInformationData array, which follows. This field MUST be equal to 43 times the value of SMB_Parameters.Count.

DirectoryInformationData (variable): Array of SMB_Directory_Information An array of zero or more SMB_Directory_Information records. The structure and contents of these records is specified below. Note that the SMB_Directory_Information record structure is a fixed 43 bytes in length.

 SMB_Directory_Information
   {
   SMB_Resume_Key      ResumeKey;
   UCHAR               FileAttributes;
   SMB_TIME            LastWriteTime;
   SMB_DATE            LastWriteDate;
   ULONG               FileSize;
   OEM_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

ResumeKey (21 bytes)

...

...

...

FileAttributes

LastWriteTime

LastWriteDate

FileSize

...

FileName (13 bytes)

...

...

...

ResumeKey (21 bytes): SMB_Resume_Key While each DirectoryInformationData entry has a ResumeKey field, the client MUST use only the ResumeKey value from the last DirectoryInformationData entry when continuing the search with a subsequent SMB_COM_SEARCH command.

FileAttributes (1 byte): These are the file system attributes of the file.

LastWriteTime (2 bytes): The time when the file was last modified. The SMB_TIME structure contains a set of bit fields indicating hours, minutes, and seconds (with a 2 second resolution).

LastWriteDate (2 bytes): The date when the file was last modified. The SMB_DATE structure contains a set of bit fields indicating the year, month, and date.

FileSize (4 bytes): The size of the file, in bytes. If the file is larger than (2 ** 32 - 1) bytes in size, the server SHOULD return the least significant 32 bits of the file size.

FileName (13 bytes): The null-terminated 8.3 name format file name. The file name and extension, including the '.' delimiter MUST be left-justified in the field. The character string MUST be padded with " " (space) characters, as necessary, to reach 12 bytes in length. The final byte of the field MUST contain the terminating null character.

Error Codes

SMB error class

SMB error code

NT status code

POSIX equivalent

Description

ERRDOS

(0x01)

ERRbadpath (0x0003)

STATUS_OBJECT_PATH_NOT_FOUND

(0xC000003A)

STATUS_OBJECT_PATH_SYNTAX_BAD

(0xC000003B)

ENOTDIR

A non-terminal component of the specified path was not a directory OR the path syntax is invalid.

ERRDOS

(0x01)

ERRnoaccess (0x0005)

STATUS_ACCESS_DENIED

(0xC0000022)

EACCES

No file system permission on the specified pathname.

ERRDOS

(0x01)

ERRbadfid (0x0006)

STATUS_INVALID_HANDLE

(0xC0000008)

STATUS_SMB_BAD_FID

(0x00060001)

ENFILE

Attempt to resume a search that was not active on the server.

ERRDOS

(0x01)

ERRnomem

(0x0008)

STATUS_INSUFF_SERVER_RESOURCES

(0xC0000205)

The server is out of resources.

ERRDOS

(0x01)

ERRnofiles (0x0012)

STATUS_NO_MORE_FILES

(0x80000006)

EOF

No more matching files found on the server.

ERRSRV

(0x02)

ERRerror

(0x0001)

STATUS_INVALID_SMB

(0x00010002)

Invalid SMB request.

ERRSRV

(0x02)

ERRinvtid

(0x0005)

STATUS_SMB_BAD_TID

(0x00050002)

The TID is no longer valid.

ERRDOS

(0x01)

ERROR_NO_MORE_SEARCH_HANDLES

(0x0071)

STATUS_OS2_NO_MORE_SIDS

(0x00710001)

EMFILE

ENFILE

Maximum number of searches has been exhausted.

ERRSRV

(0x02)

ERRbaduid

(0x005B)

STATUS_SMB_BAD_UID

(0x005B00002)

The UID in the header is not valid for this session.

ERRHRD (0x03)

ERRdata

(0x0017)

STATUS_CRC_ERROR

(0xC000003F)

EIO

Data I/O error (incorrect CRC on device).

In [XOPEN-SMB] it is noted that POSIX-style servers MAY also generate ENOENT while searching for files. ENOENT errors MUST be handled on the server side and MUST NOT be returned to the client.