3.2.4.14 Application Requests Querying Quota Information

The application provides:

  • A handle to the Open identifying a directory.

  • A Boolean indicating whether the enumeration is being restarted.

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

  • The maximum output buffer it will accept.

  • It optionally can provide a list of the SIDs whose quota information is to be queried, in the form of a SidList of FILE_GET_QUOTA_INFORMATION structures linked via the NextOffset field, as specified in [MS-FSCC] section 2.4.40.1.

  • It optionally can provide a StartSid, in the form of a SID as specified in [MS-DTYP] section 2.4.2.2, to enumerate quota information from the SID in the SidBuffer field.

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_QUOTA.

  • The FileInfoClass field is set to 0.

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

  • The AdditionalInformation is set to 0.

  • The FileId field is set to Open.FileId.

  • An SMB2_QUERY_QUOTA_INFO structure is constructed and copied into the Buffer field of the SMB2 QUERY_INFO structure, and initialized as follows:

    • If only a single entry is to be returned, the client sets ReturnSingle to TRUE. Otherwise, it is set to FALSE.

    • If the application requires to restart the scan, the client sets RestartScan to TRUE. Otherwise, it is set to FALSE.

    • SidListLength, StartSidOffset, and StartSidLength are set based on the parameters received from the application as follows:

      • If the application provides a SidList, via one or more FILE_GET_QUOTA_INFORMATION structures linked by NextEntryOffset, they MUST be copied to the beginning of the SidBuffer, SidListLength MUST be set to their length in bytes, StartSidLength SHOULD be set to 0, and StartSidOffset SHOULD be set to 0.<164>

        Otherwise, if the application provides a StartSid, the SidBuffer field contains a SID as defined in [MS-DTYP] section 2.4.2.2. The SidListLength field MUST be set to zero, StartSidLength MUST be set to length, in bytes, of the StartSid. The StartSidOffset field SHOULD be set to offset, in bytes, from the beginning of SidBuffer.

      • If neither a SidList nor a StartSid are provided by the application, then SidListLength MUST be set to 0, StartSidLength SHOULD be set to 0, and StartSidOffset SHOULD be set to 0.

  • The InputBufferOffset field is set to the offset, in bytes, from the beginning of the SMB2 header to the SMB2_QUERY_QUOTA_INFO structure.

  • The InputBufferLength field is set to the size, in bytes, of the SMB2_QUERY_QUOTA_INFO structure, including any trailing buffer for the SidList.

The request MUST be sent to the server.