CBFS Connect 2020 .NET Edition

Questions / Feedback?

SetQuotas Event

Fires when the OS needs to update quota information.

Syntax

public event OnSetQuotasHandler OnSetQuotas;

public delegate void OnSetQuotasHandler(object sender, CbfsSetQuotasEventArgs e);

public class CbfsSetQuotasEventArgs : EventArgs {
  public IntPtr SID { get; }
  public int SIDLength { get; }
  public bool RemoveQuota { get; }
  public bool QuotaFound { get; set; }
  public long QuotaUsed { get; }
  public long QuotaThreshold { get; }
  public long QuotaLimit { get; }
  public IntPtr EnumerationContext { get; set; }
  public int ResultCode { get; set; }
}
Public Event OnSetQuotas As OnSetQuotasHandler

Public Delegate Sub OnSetQuotasHandler(sender As Object, e As CbfsSetQuotasEventArgs)

Public Class CbfsSetQuotasEventArgs Inherits EventArgs
  Public ReadOnly Property SID As IntPtr
  Public ReadOnly Property SIDLength As Integer
  Public ReadOnly Property RemoveQuota As Boolean
  Public Property QuotaFound As Boolean
  Public ReadOnly Property QuotaUsed As Long
  Public ReadOnly Property QuotaThreshold As Long
  Public ReadOnly Property QuotaLimit As Long
  Public Property EnumerationContext As IntPtr
  Public Property ResultCode As Integer
End Class

Remarks

This event fires when the OS needs to set, update, or remove quota information for the security identifier specified by SID. If quota information needs to be set/updated/removed for multiple SIDs, this event will fire multiple times in succession.

This event only needs to be handled if the UseDiskQuotas property is enabled. To handle this event properly, applications must either store or remove the quota information for the security identifier specified by SID:

  • If RemoveQuota is false, set or update the SID's quota information using the values specified by QuotaUsed, QuotaFound, and QuotaLimit.
  • If RemoveQuota is true, and the application has quota information stored for the SID, remove that information and set QuotaFound to true. If the application does not have quota information stored for the SID, set QuotaFound to false.
Both this event and QueryQuotas cause a quota enumeration to be started; the CloseQuotasEnumeration event will fire when the OS has finished setting/updating/removing quota information.

Descriptions of the QuotaUsed, QuotaThreshold, and QuotaLimit parameters can be found in the Windows API's DISKQUOTA_USER_INFORMATION structure documentation.

The EnumerationContext parameter is a placeholder for application-defined data associated with the enumeration. Please refer to the Contexts topic for more information.

Please refer to the Buffer Parameters topic for more information on how to work with memory buffer event parameters.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), set it to a non-zero value to report an appropriate error. Please refer to the Error Reporting and Handling topic for more information.

Copyright (c) 2022 Callback Technologies, Inc. - All rights reserved.
CBFS Connect 2020 .NET Edition - Version 20.0 [Build 8348]