OnQueryQuotas event/delegate/callback

Filter:

Pascal    C++ (Lib)    C++ (VCL)    C++ (.NET)    C#    VB.NET    Java 

CBFSConnect     See also    

Overview

The event is fired when the OS needs to read quota information.

Declaration

[Pascal]
    property OnQueryQuotas : TCbFQueryQuotasEvent;
    TCbFQueryQuotasEvent = procedure( Sender : TObject; EnumerationInfo: TCBDiskQuotasEnumerationInfo; Sid: PSID; SidLength: LongWord; Index: LongWord; var DiskQuotaInformation: TDiskQuotaUserInformation (* DISKQUOTA_USER_INFORMATION *); var SidBuffer; SidBufferLength: LongWord; var QuotaFound: boolean ) of object;

[C++ (Lib)]
    void (__stdcall *CbFQueryQuotasEvent)(void* Sender, CBDiskQuotasEnumerationInfo* EnumerationInfo, PSID Sid, unsigned long SidLength, unsigned long Index, PDISKQUOTA_USER_INFORMATION DiskQuotaInformation, void* SidBuffer, unsigned long SidBufferLength, bool * QuotaFound );

[C++ (VCL)]
    typedef void (__closure *TCbFQueryQuotasEvent)( System::TObject* Sender, TCBDiskQuotasEnumerationInfo* EnumerationInfo, void* Sid, unsigned long SidLength, unsigned long Index, Cbfsapi::DISKQUOTA_USER_INFORMATION & DiskQuotaInformation, void* SidBuffer, unsigned long SidBufferLength, bool & QuotaFound );

[C++ (.NET)]
    public __delegate void CbFQueryQuotasEvent( CBFSConnect^ Sender, CBDiskQuotasEnumerationInfo^ EnumerationInfo, SecurityIdentifier^ Sid, UInt32 Index, CBFSConnect::DISKQUOTA_USER_INFORMATION% DiskQuotaInformation, SecurityIdentifier^% SidOut, bool & QuotaFound );

[C#]
    public void CbFQueryQuotasEvent( CBFSConnect Sender, CBDiskQuotasEnumerationInfo EnumerationInfo, SecurityIdentifier Sid, UInt32 Index, ref CBFSConnect.DISKQUOTA_USER_INFORMATION DiskQuotaInformation, ref SecurityIdentifier SidOut, ref bool QuotaFound );

[VB.NET]
    Sub CbFQueryQuotasEvent( ByVal Sender As CBFSConnect, ByVal EnumerationInfo As CBDiskQuotasEnumerationInfo, ByVal Sid SecurityIdentifier , ByVal Index as UInt32, ByRef DiskQuotaInformation as DISKQUOTA_USER_INFORMATION, ByRef SidOut As SecurityIdentifier, ByRef QuotaFound As Boolean )

Parameters

  • Sender - reference to the class that called the delegate/event handler
  • EnumerationInfo - information about current enumeration
  • Sid - Sid of the user, for whom the quota is requested
  • SidLength - The length of Sid parameter
  • Index - Specifies the index during enumeration, if Sid is not set (see Description section for details)
  • DiskQuotaInformation - place quota-related information in this structure. The format of the structure is described in MSDN.
  • SidOut - You need to place the Sid here during enumeration (see Description for details)
  • SidBuffer - The buffer to which you need to place the Sid during enumeration (see Description for details)
  • SidBufferLength - The length of Sid buffer
  • QuotaFound - set this parameter to specify if the quota has been found

Description

This event is fired when the OS wants to read quota information. Quota information can be requested in two ways:

  1. with SID specified (retrieval of information about the particular user), and
  2. with SID not specified (enumeration of quotas set for different SIDs)

If SID is specified (retrieval mode), you need to fill the DiskQuotaInformation structure. If SID is not specified (enumeration mode), you need to fill the DiskQuotaInformation structure and also provide the Sid, to which this information is related, via SidBuffer buffer (SidOut object in .NET API).

SidBuffer has the maximum length of SidBufferLength. If the length of the value being placed to SidBuffer exceeds the value of SidBufferLength, you should throw ECBFSConnectError with ERROR_INSUFFICIENT_BUFFER code.

Both OnSetQuotas and OnQueryQuotas start the enumeration (hence the use of EnumerationInfo parameter). After the operation is complete, OnCloseQuotasEnumeration event is fired, and there you can release the allocated resources.

The callback / event is optional, i.e. you don't have to handle it if you don't support disk quotas.

Error handling

See Error handling topic for detailed information about how to report errors, which occur in the event handlers, back to CBFS Connect.

See also

OnCloseQuotasEnumeration event     OnSetQuotas event