ZwQueryQuotaInformationFile routine

The ZwQueryQuotaInformationFile routine retrieves quota entries associated with the volume specified by the FileHandle parameter.

Syntax


NTSTATUS ZwQueryQuotaInformationFile(
  _In_      HANDLE FileHandle,
  _Out_     PIO_STATUS_BLOCK IoStatusBlock,
  _Out_     PVOID Buffer,
  _In_      ULONG Length,
  _In_      BOOLEAN ReturnSingleEntry,
  _In_opt_  PVOID SidList,
  _In_      ULONG SidListLength,
  _In_opt_  PSID StartSid,
  _In_      BOOLEAN RestartScan
);

Parameters

FileHandle [in]

A handle for the file object that represents the file or volume for which the quota information is requested.

IoStatusBlock [out]

The address of the caller's I/O status block.

Buffer [out]

A buffer to receive the quota information for the volume. The quota information is formatted as one or more FILE_QUOTA_INFORMATION structures. The NextEntryOffset field in the FILE_QUOTA_INFORMATION structure contains the offset, in bytes, of the next quota entry in the list. If there are no more entries after the current one, this member is zero.

Length [in]

The length in bytes of the buffer.

ReturnSingleEntry [in]

A Boolean value that indicates if only a single entry should be returned rather than filling the buffer with as many entries as possible.

SidList [in, optional]

An optional list of SIDs whose quota information is to be returned. Each entry in the list is a FILE_GET_QUOTA_INFORMATION structure. The NextEntryOffset field in the FILE_GET_QUOTA_INFORMATION structure contains the offset, in bytes, of the next quota entry in the list. If there are no more entries after the current one, this member is zero.

SidListLength [in]

The length in bytes of the SID list, if one was specified.

StartSid [in, optional]

An optional pointer to the SID of the entry at which to begin scanning the quota information. This parameter should be set if the returned information is to start with an entry other than the first SID. This parameter is ignored if a SidList parameter is specified.

RestartScan [in]

A Boolean value that indicates whether the scan of the quota information is to be restarted from the beginning. Set this parameter to TRUE if the scan of the quota information is to start at the first entry in the volume's quota information list. Set to FALSE if resuming the scan from a previous call to ZwQueryQuotaInformationFile. The caller must set this parameter to TRUE when calling ZwQueryQuotaInformationFile for the first time.

Return value

The ZwQueryQuotaInformationFile routine returns STATUS_SUCCESS if at least one FILE_QUOTA_INFORMATION structure is returned in the Buffer parameter or an appropriate NTSTATUS value such as one of the following:

Return codeDescription
STATUS_INSUFFICIENT_RESOURCES

There were insufficient resources to complete the operation. This is an error code.

STATUS_INVALID_DEVICE_REQUEST

Quotas are not enabled on the volume. This is an error code.

STATUS_INVALID_SID

The StartSid parameter did not contain a valid SID. This is an error code.

STATUS_QUOTA_LIST_INCONSISTENT

The SidList parameter did not contain a valid, properly formed list. This is an error code.

 

Remarks

The amount of information returned by ZwQueryQuotaInformationFile is based on the size of the quota information associated with the volume, the size of the buffer, and whether a specific set of entries has been requested.

A call to ZwQueryQuotaInformationFile will result in an IRP_MJ_QUERY_QUOTA request being sent to the device object that is associated with the file object whose handle is stored in the FileHandle parameter.

If the underlying file system does not support quota information (FAT and CDFS file systems, for example), ZwQueryQuotaInformationFile will fail returning STATUS_INVALID_DEVICE_REQUEST.

Note  If the call to the ZwQueryQuotaInformationFile function occurs in user mode, you should use the name "NtQueryQuotaInformationFile" instead of "ZwQueryQuotaInformationFile".

Requirements

Version

Available in Windows 7 and later versions of Windows operating systems.

Header

Ntifs.h (include Ntifs.h or FltKernel.h)

Library

Ntoskrnl.lib

IRQL

PASSIVE_LEVEL

DDI compliance rules

PowerIrpDDis, HwStorPortProhibitedDDIs

See also

FILE_GET_QUOTA_INFORMATION
FILE_QUOTA_INFORMATION
IO_STATUS_BLOCK
IoCheckQuotaBufferValidity
IRP_MJ_QUERY_QUOTA
IRP_MJ_SET_QUOTA
ZwSetQuotaInformationFile

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft