Compartir a través de


3.2.4.12 Application Requests Querying File Attributes

The application provides:

  • A valid Client.Session.

  • The Client.TreeConnect representing the share in which the file to be queried exists.

  • If the file is not already open, the full pathname relative to the TID. Otherwise, attributes SHOULD be queried using a valid FID representing the opened file.

  • The Information Level that defines the format of the data to query, as specified in [MS-FSCC] section 2.4.

  • If the Information Level provided is SMB_INFO_QUERY_EAS_FROM_LIST, the application provides a list of extended attributes.

The client can use any of the following commands to query file attributes. The SMB_COM_QUERY_INFORMATION and SMB_COM_QUERY_INFORMATION2 commands are deprecated; the client SHOULD use the TRANS2_QUERY_PATH_INFORMATION or the TRANS2_QUERY_FILE_INFORMATION transaction subcommand instead. The transaction subcommands can also be used to query named pipe attributes. The client MUST map the application-provided Information Level to the Query Information Levels, as specified in section 2.2.8.

  • SMB_COM_QUERY_INFORMATION (deprecated)

    The client MUST construct the SMB_COM_QUERY_INFORMATION request as defined in section 2.2.4.9. This command retrieves the following file attributes:

    • Basic SMB_FILE_ATTRIBUTES, as described in section 2.2.1.2.4.

    • Last write time of the file.

    • The size of the file (limited to a 32-bit value).

      The file to be queried MUST be identified by a full pathname, relative to the TID.

  • SMB_COM_QUERY_INFORMATION2 (deprecated)

    The client MUST construct the SMB_COM_QUERY_INFORMATION2 request as defined in section 2.2.4.31. This command retrieves the following file attributes:

    • Basic SMB_FILE_ATTRIBUTES, as described in section 2.2.1.2.4.

    • The date and time of file creation, last access, and last write.

    • The file size (limited to a 32-bit value).

    • The file allocation size (limited to a 32-bit value), which can be larger than the actual number of bytes contained in the file.

      The file to be queried MUST be identified by a FID (an open file handle).

  • TRANS2_QUERY_PATH_INFORMATION

    The client MUST construct a TRANS2_QUERY_PATH_INFORMATION subcommand request as defined in section 2.2.6.6. The TRANS2_QUERY_PATH_INFORMATION request MUST be transported to the server using the Transaction2 subprotocol. This transaction subcommand provides access to extended file information, including:

    • Basic SMB_FILE_ATTRIBUTES, as described in section 2.2.1.2.4.

    • The creation time, last access time, and last write time attributes of the file.

    • The file size (limited to a 32-bit value).

    • The file allocation size (limited to a 32-bit value), which can be larger than the actual number of bytes contained in the file.

    • The number of bytes allocated to extended attribute name/value pairs.

    • Extended attributes.

    • The number of hard links to the file.

    • The file name and alternate file name.

    • The ability to list alternate file streams.

    • Whether or not the file is actually a directory.

    • Whether or not the file is marked for delete upon close.

    • Whether or not the file is compressed.

      The file to be queried MUST be identified by a full pathname, relative to the TID.

  • TRANS2_QUERY_FILE_INFORMATION

    The client MUST construct a TRANS2_QUERY_FILE_INFORMATION subcommand request as defined in section 2.2.6.8. The TRANS2_QUERY_FILE_INFORMATION request MUST be sent to the server using the Transaction2 subprotocol as a transport. This transaction is identical to TRANS2_QUERY_PATH_INFORMATION except that the file to be queried MUST be identified by FID rather than by pathname.

The request MUST be sent to the server as described in section 3.2.4.1.