OnSetQuotas event/delegate/callback


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

CBFSConnect     See also    


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


    property OnSetQuotas : TCBSetQuotasEvent;
    TCBSetQuotasEvent = procedure( Sender : TObject; EnumerationInfo: TCBDiskQuotasEnumerationInfo; Sid: PSID; SidLength: LongWord; var DiskQuotaInformation: TDiskQuotaUserInformation (* DISKQUOTA_USER_INFORMATION *); RemoveQuota: boolean; var QuotaFound: boolean ) of object;

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

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

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

    public void CBSetQuotasEvent( CBFSConnect Sender, CBDiskQuotasEnumerationInfo EnumerationInfo, SecurityIdentifier Sid, ref CBFSConnect.DISKQUOTA_USER_INFORMATION DiskQuotaInformation, bool RemoveQuota, ref bool QuotaFound );

    Sub CBSetQuotasEvent( ByVal Sender As CBFSConnect, ByVal EnumerationInfo As CBDiskQuotasEnumerationInfo, ByVal Sid SecurityIdentifier , ByRef DiskQuotaInformation as DISKQUOTA_USER_INFORMATION, ByVal RemoveQuota As Boolean, ByRef QuotaFound As Boolean )


  • 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
  • DiskQuotaInformation - place quota-related information in this structure. The format of the structure is described in MSDN.
  • RemoveQuota - specifies whether the quota of the user with the given Sid should be set/updated or removed
  • QuotaFound - set this parameter to specify if the quota for the given Sid has been found


This event is fired when the OS needs to set, update or remove quota information for the given Sid. If RemoveQuota parameter is set to true, Quota for the given Sid must be removed.

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     OnQueryQuotas event