NtSetQuotaInformationFile function

The ZwSetQuotaInformationFile routine changes quota entries for the volume associated with the FileHandle parameter. All of the quota entries in the specified buffer are applied to the volume.


NTSTATUS ZwSetQuotaInformationFile(
  _In_  HANDLE           FileHandle,
  _Out_ PIO_STATUS_BLOCK IoStatusBlock,
  _In_  PVOID            Buffer,
  _In_  ULONG            Length



A handle for the file object that represents the file or volume for which the quota information is to be modified.


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


A buffer containing the new quota entries that should be applied to the volume. The quota information must be 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.


The length in bytes of the buffer.

Return Value

The ZwSetQuotaInformationFile routine returns STATUS_SUCCESS or an appropriate NTSTATUS value such as one of the following:

Return code Description
There were insufficient resources to complete the operation. This is an error code.
Quotas are not enabled on the volume. This is an error code.
The volume is read only. This is an error code.


The ZwSetQuotaInformationFile routine applies all of the quota entries in the specified Buffer parameter to the volume.

The IoCheckQuotaBufferValidity function can check whether the specified quota buffer passed as the Buffer parameter is valid.

A call to ZwSetQuotaInformationFile will result in an IRP_MJ_SET_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), ZwSetQuotaInformationFile will fail returning STATUS_INVALID_DEVICE_REQUEST.

Note If the call to the ZwSetQuotaInformationFile function occurs in user mode, you should use the name "NtSetQuotaInformationFile" instead of "ZwSetQuotaInformationFile".
For calls from kernel-mode drivers, the NtXxx and ZwXxx versions of a Windows Native System Services routine can behave differently in the way that they handle and interpret input parameters. For more information about the relationship between the NtXxx and ZwXxx versions of a routine, see Using Nt and Zw Versions of the Native System Services Routines.


Windows version Available in Windows 7 and later versions of Windows operating systems.
Target Platform Universal
Header ntifs.h (include Ntifs.h, FltKernel.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
DDI compliance rules PowerIrpDDis, HwStorPortProhibitedDDIs

See Also



Using Nt and Zw Versions of the Native System Services Routines






Send comments about this topic to Microsoft