TRANS2_FIND_FIRST2: Search Directory using Wildcards

Client Request
==================================
Value
==================================
WordCount 15
TotalDataCount Total size of extended attribute list
SetupCount 1
Setup[0] TRANS2_FIND_FIRST2
Parameter Block Encoding
==================================
Description
==================================
USHORT SearchAttributes;
USHORT SearchCount; Maximum number of entries to return
USHORT Flags; Additional information:
Bit 0 - close search after this request
Bit 1 - close search if end of search reached
Bit 2 - return resume keys for each entry found
Bit 3 - continue search from previous ending place
Bit 4 - find with backup intent
USHORT InformationLevel; See below
ULONG SearchStorageType;
STRING FileName; Pattern for the search
UCHAR Data[ TotalDataCount ] FEAList if InformationLevel is QUERY_EAS_FROM_LIST

Response Parameter Block
==================================
Description
==================================
USHORT Sid; Search handle
USHORT SearchCount; Number of entries returned
USHORT EndOfSearch; Was last entry returned?
USHORT EaErrorOffset; Offset into EA list if EA error
USHORT LastNameOffset; Offset into data to file name of last entry, if server needs it to resume search; else 0
UCHAR Data[ TotalDataCount ] Level dependent info about the matches found in the search

This request allows the client to search for the file(s) which match the file specification. The search can be continued if necessary with TRANS2_FIND_NEXT2. There are numerous levels of information which may be obtained for the returned files, the desired level is specified in the InformationLevel field of the request.

InformationLevel Name
=================================
Value
====================
SMB_INFO_STANDARD 1
SMB_INFO_QUERY_EA_SIZE 2
SMB_INFO_QUERY_EAS_FROM_LIST 3
SMB_FIND_FILE_DIRECTORY_INFO 0x101
SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102
SMB_FIND_FILE_NAMES_INFO 0x103
SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104

The following sections detail the data returned for each InformationLevel. The requested information is placed in the data portion of the transaction response. Note: a client which does not support long names can only request SMB_INFO_STANDARD.

SMB_INFO_STANDARD

Response Field
================================
Description
==================================
SMB_DATE CreationDate; Date when file was created
SMB_TIME CreationTime; Time when file was created
SMB_DATE LastAccessDate; Date of last file access
SMB_TIME LastAccessTime; Time of last file access
SMB_DATE LastWriteDate; Date of last write to the file
SMB_TIME LastWriteTime; Time of last write to the file
ULONG DataSize; File Size
ULONG AllocationSize; Size of filesystem allocation unit
USHORT Attributes; File Attributes
UCHAR FileNameLength; Length of filename in bytes
STRING FileName; Name of found file

SMB_INFO_QUERY_EA_SIZE

Response Field
=================================
Description
==================================
SMB_DATE CreationDate; Date when file was created
SMB_TIME CreationTime; Time when file was created
SMB_DATE LastAccessDate; Date of last file access
SMB_TIME LastAccessTime; Time of last file access
SMB_DATE LastWriteDate; Date of last write to the file
SMB_TIME LastWriteTime; Time of last write to the file
ULONG DataSize; File Size
ULONG AllocationSize; Size of filesystem allocation unit
USHORT Attributes; File Attributes
ULONG EaSize; Size of file's EA information
UCHAR FileNameLength; Length of filename in bytes
STRING FileName; Name of found file

SMB_INFO_QUERY_EAS_FROM_LIST

This request returns the same information as SMB_INFO_QUERY_EA_SIZE, but only for files which have an EA list which match the EA information in the data part of the request.

SMB_FIND_FILE_DIRECTORY_INFO

Response Field
=================================
Description
==================================
ULONG NextEntryOffset; Offset from this structure to beginning of next one
ULONG FileIndex;
LARGE_INTEGER CreationTime; file creation time
LARGE_INTEGER LastAccessTime; last access time
LARGE_INTEGER LastWriteTime; last write time
LARGE_INTEGER ChangeTime; last attribute change time
LARGE_INTEGER EndOfFile; file size
LARGE_INTEGER AllocationSize; size of filesystem allocation information
ULONG ExtFileAttributes; Extended file attributes (see section 3.11)
ULONG FileNameLength; Length of filename in bytes
STRING FileName; Name of the file

SMB_FIND_FILE_FULL_DIRECTORY_INFO

Response Field
=================================
Description
==================================
ULONG NextEntryOffset; Offset from this structure to beginning of next one
ULONG FileIndex;
LARGE_INTEGER CreationTime; file creation time
LARGE_INTEGER LastAccessTime; last access time
LARGE_INTEGER LastWriteTime; last write time
LARGE_INTEGER ChangeTime; last attribute change time
LARGE_INTEGER EndOfFile; file size
LARGE_INTEGER AllocationSize; size of filesystem allocation information
ULONG ExtFileAttributes; Extended file attributes (see section 3.11)
ULONG FileNameLength; Length of filename in bytes
ULONG EaSize; Size of file's extended attributes
STRING FileName; Name of the file

SMB_FIND_FILE_BOTH_DIRECTORY_INFO

Response Field
=================================
Description
==================================
ULONG NextEntryOffset; Offset from this structure to beginning of next one
ULONG FileIndex;
LARGE_INTEGER CreationTime; file creation time
LARGE_INTEGER LastAccessTime; last access time
LARGE_INTEGER LastWriteTime; last write time
LARGE_INTEGER ChangeTime; last attribute change time
LARGE_INTEGER EndOfFile; file size
LARGE_INTEGER AllocationSize; size of filesystem allocation information
ULONG ExtFileAttributes; Extended file attributes (see section 3.11)
ULONG FileNameLength; Length of FileName in bytes
ULONG EaSize; Size of file's extended attributes
UCHAR ShortNameLength; Length of file's short name in bytes
UCHAR Reserved
WCHAR ShortName[12]; File's 8.3 conformant name in Unicode
STRING FileName; Files full length name

SMB_FIND_FILE_NAMES_INFO

Response Field
=================================
Description
==================================
ULONG NextEntryOffset; Offset from this structure to beginning of next one
ULONG FileIndex;
ULONG FileNameLength; Length of FileName in bytes
STRING FileName; Files full length name