TRANS2_QUERY_PATH_INFORMATION: Get File Attributes given Path

This request is used to get information about a specific file or subdirectory.

Client Request
==========================
Value
=========================================
WordCount 15
MaxSetupCount 0
SetupCount 1
Setup[0] TRANS2_QUERY_PATH_INFORMATION
Parameter Block Encoding
==========================
Description
=========================================
USHORT InformationLevel; Level of information requested
ULONG Reserved; Must be zero
STRING FileName; File or directory name

The following InformationLevels may be requested:

Information Level

================================
Value

=====
SMB_INFO_STANDARD 1
SMB_INFO_QUERY_EA_SIZE 2
SMB_INFO_QUERY_EAS_FROM_LIST 3
SMB_INFO_QUERY_ALL_EAS 4
SMB_INFO_IS_NAME_VALID 6
SMB_QUERY_FILE_BASIC_INFO 0x101
SMB_QUERY_FILE_STANDARD_INFO 0x102
SMB_QUERY_FILE_EA_INFO 0x103
SMB_QUERY_FILE_NAME_INFO 0x104
SMB_QUERY_FILE_ALL_INFO 0x107
SMB_QUERY_FILE_ALT_NAME_INFO 0x108
SMB_QUERY_FILE_STREAM_INFO 0x109
SMB_QUERY_FILE_COMPRESSION_INFO 0x10B

The requested information is placed in the Data portion of the transaction response. For the information levels greater than 0x100, the transaction response has 1 parameter word which should be ignored by the client.

SMB_INFO_STANDARD & SMB_INFO_QUERY_EA_SIZE

Data Block Encoding
===============================
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 (SMB_INFO_QUERY_EA_SIZE)

SMB_INFO_QUERY_EAS_FROM_LIST & SMB_INFO_QUERY_ALL_EAS

Response Field
====================
Value
===============================================
MaxDataCount Length of EAlist found (minimum value is 4)
Parameter Block Encoding
====================
Description
===============================================
USHORT EaErrorOffset Offset into EAList of EA error
Data Block Encoding
====================
Description
===============================================
ULONG ListLength; Length of the remaining data
UCHAR EaList[] The extended attributes list

SMB_INFO_IS_NAME_VALID

This requests checks to see if the name of the file contained in the request's Data field has a valid path syntax. No parameters or data are returned on this information request. An error is returned if the syntax of the name is incorrect. Success indicates the server accepts the path syntax, but it does not ensure the file or directory actually exists.

SMB_QUERY_FILE_BASIC_INFO

typedef struct {
    TIME CreationTime;
    TIME LastAccessTime;
    TIME LastWriteTime;
    TIME ChangeTime;
    ULONG FileAttributes;
} FILE_BASIC_INFORMATION;

SMB_QUERY_FILE_STANDARD_INFO

typedef struct {
    LARGE_INTEGER AllocationSize;
    LARGE_INTEGER EndOfFile;
    ULONG NumberOfLinks;
    BOOLEAN DeletePending;
    BOOLEAN Directory;
} FILE_STANDARD_INFORMATION;

SMB_QUERY_FILE_EA_INFO

typedef struct {
    ULONG EaSize;
} FILE_EA_INFORMATION;

SMB_QUERY_FILE_NAME_INFO

typedef struct {
    ULONG FileNameLength;
    WCHAR FileName[1];
} FILE_NAME_INFORMATION;

SMB_QUERY_FILE_ALL_INFO

typedef struct {
    LARGE_INTEGER IndexNumber;
} FILE_INTERNAL_INFORMATION;

typedef struct {
    ACCESS_MASK AccessFlags;
} FILE_ACCESS_INFORMATION;

typedef struct {
    LARGE_INTEGER CurrentByteOffset;
} FILE_POSITION_INFORMATION;

typedef struct {
    ULONG Mode;
} FILE_MODE_INFORMATION;

typedef struct {
    ULONG AlignmentRequirement;
} FILE_ALIGNMENT_INFORMATION;

typedef struct _FILE_ALL_INFORMATION {
    FILE_BASIC_INFORMATION BasicInformation;
    FILE_STANDARD_INFORMATION StandardInformation;
    FILE_INTERNAL_INFORMATION InternalInformation;
    FILE_EA_INFORMATION EaInformation;
    FILE_ACCESS_INFORMATION AccessInformation;
    FILE_POSITION_INFORMATION PositionInformation;
    FILE_MODE_INFORMATION ModeInformation;
    FILE_ALIGNMENT_INFORMATION AlignmentInformation;
    FILE_NAME_INFORMATION NameInformation;
} FILE_ALL_INFORMATION;

SMB_QUERY_FILE_ALT_NAME_INFO

This information level returns a FILE_NAME_INFORMATION structure.

SMB_QUERY_FILE_STREAM_INFO

typedef struct {
    ULONG NextEntryOffset;
    ULONG StreamNameLength;
    LARGE_INTEGER StreamSize;
    LARGE_INTEGER StreamAllocationSize;
    WCHAR StreamName[1];
} FILE_STREAM_INFORMATION;

SMB_QUERY_FILE_COMPRESSION_INFO

typedef struct {
    LARGE_INTEGER CompressedFileSize;
    USHORT CompressionFormat;
    UCHAR CompressionUnitShift;
    UCHAR ChunkShift;
    UCHAR ClusterShift;
    UCHAR Reserved[3];
} FILE_COMPRESSION_INFORMATION;