3.2.4.8 Application Requests Querying File Attributes

The application provides:

  • A handle to the Open identifying a file or named pipe.

  • The maximum output buffer it will accept.

  • The InformationClass of the attributes being queried, as specified in [MS-FSCC] section 2.4.

  • If the information being queried is FileFullEaInformation, the application also MUST provide the following:

    • A Boolean indicating whether to restart the EA scan.

    • A Boolean indicating whether only a single entry MUST be returned.

      The application can also provide one of the following:

    • The index of the first EA entry to return from the array of extended attributes that are associated with the file or named pipe. An index value of 1 corresponds to the first extended attribute.

    • A list of FILE_GET_EA_INFORMATION structures, as specified in [MS-FSCC] section 2.4.15.1.

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.

For the specified Open, the client MUST select a connection as specified in section 3.2.4.1.7. If no connection is available, the client MUST fail the query operation.

Otherwise, the client initializes an SMB2 QUERY_INFO Request following the syntax specified in section 2.2.37. The SMB2 header MUST be initialized as follows:

  • The Command field is set to SMB2 QUERY_INFO.

  • The MessageId field is set as specified in section 3.2.4.1.3.

  • The SessionId field is set to Open.TreeConnect.Session.SessionId.

  • The TreeId field is set to Open.TreeConnect.TreeConnectId.

The SMB2 QUERY_INFO Request MUST be initialized as follows:

  • The InfoType field is set to SMB2_0_INFO_FILE.

  • The FileInfoClass field is set to the InformationClass received from the application.

  • The OutputBufferLength field is set to the maximum output buffer the calling application will accept.

  • If the query is for FileFullEaInformation and the application has provided a list of EAs to query, the InputBufferOffset field MUST be set to the offset of the Buffer field from the start of the SMB2 header. Otherwise, the InputBufferOffset field SHOULD be set to 0.<160>

  • If the query is for FileFullEaInformation and the application has provided a list of EAs to query, the InputBufferLength field MUST be set to the length of the FILE_GET_EA_INFORMATION buffer provided by the application, as specified in [MS-FSCC] section 2.4.15.1. Otherwise, the InputBufferLength field SHOULD be set to 0.

  • If the query is for FileFullEaInformation, and the application has not provided a list of EAs to query, but has provided an extended attribute index, the AdditionalInformation field MUST be set to the extended attribute index provided by the calling application. Otherwise, the AdditionalInformation field MUST be set to 0.

  • If the query is for FileFullEaInformation, the Flags field in the SMB2 QUERY_INFO request MUST be set to zero or more of the following bit flags. Otherwise, it MUST be set to 0.

    • SL_RESTART_SCAN if the application requested that the EA scan be restarted.

    • SL_RETURN_SINGLE_ENTRY if the application requested that only a single entry be returned.

    • SL_INDEX_SPECIFIED if the application provided an EA index instead of a list of EAs.

  • The FileId field is set to Open.FileId.

The request MUST be sent to the server.