CBFS Connect 2020 Python Edition

Questions / Feedback?

on_query_quotas Event

Fires when the OS needs to read quota information.

Syntax

class CBFSQueryQuotasEventParams(object):
  @property
  def sid() -> c_void_p: ...
  @property
  def sid_length() -> int: ...
  @property
  def index() -> int: ...
  @property
  def quota_found() -> bool: ...
  @quota_found.setter
  def quota_found(value) -> None: ...
  @property
  def quota_used() -> int: ...
  @quota_used.setter
  def quota_used(value) -> None: ...
  @property
  def quota_threshold() -> int: ...
  @quota_threshold.setter
  def quota_threshold(value) -> None: ...
  @property
  def quota_limit() -> int: ...
  @quota_limit.setter
  def quota_limit(value) -> None: ...
  @property
  def sid_out() -> c_void_p: ...
  @property
  def sid_out_length() -> int: ...
  @property
  def enumeration_context() -> int: ...
  @enumeration_context.setter
  def enumeration_context(value) -> None: ...
  @property
  def result_code() -> int: ...
  @result_code.setter
  def result_code(value) -> None: ...

# In class CBFS:
@property
def on_query_quotas() -> Callable[[CBFSQueryQuotasEventParams], None]: ...
@on_query_quotas.setter
def on_query_quotas(event_hook: Callable[[CBFSQueryQuotasEventParams], None]) -> None: ...

Remarks

This event fires when the OS needs to read quota information, set during earlier on_set_quotas events, for one or more security identifiers (SIDs).

This event only needs to be handled if the use_disk_quotas property is enabled. Quota information is read by the OS in one of two ways; to handle this event properly, applications must be able to handle both kinds of requests by doing the following:

  1. When the OS needs a specific SID's quota information, SID will point to a memory buffer which contains that SID (in binary form, with length SIDLength).
    • If the application has a quota stored for the specified SID, set QuotaFound to True, and return its information by setting QuotaUsed, QuotaThreshold, and QuotaLimit.
    • If the application does not have quota information stored for the SID, set QuotaFound to False and leave the other parameters unchanged.
    • For such requests, Index is always -1, no SIDOut buffer is available, and SIDOutLength is 0.
  2. When the OS needs all of the quota information the application has stored, this event fires with Index set to 0 first, then continues to fire with increasing indices until all quotas have been returned.
    • For each quota the application has stored, set QuotaFound to True, and return its information by setting QuotaUsed, QuotaThreshold, and QuotaLimit. Return the SID associated with the quota by copying it, in binary form, to the memory buffer pointed to by SIDOut. The capacity of the SIDOut buffer is specified by SIDOutLength.
    • If there are more quotas to return, set QuotaFound to False and leave the other parameters unchanged.
    • For such requests, no SID buffer is available, and SIDLength is 0.

Both this event and on_set_quotas cause a quota enumeration to be started; the on_close_quotas_enumeration event will fire when the OS has finished reading quota information (this applies for both of the cases described above).

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) 2021 Callback Technologies, Inc. - All rights reserved.
CBFS Connect 2020 Python Edition - Version 20.0 [Build 7880]