Bewerken

Delen via


ZwSetQuotaInformationFile function (ntifs.h)

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.

Syntax

NTSYSAPI NTSTATUS ZwSetQuotaInformationFile(
  [in]  HANDLE           FileHandle,
  [out] PIO_STATUS_BLOCK IoStatusBlock,
  [in]  PVOID            Buffer,
  [in]  ULONG            Length
);

Parameters

[in] FileHandle

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

[out] IoStatusBlock

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

[in] Buffer

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.

[in] Length

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
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_MEDIA_WRITE_PROTECTED The volume is read only. This is an error code.

Remarks

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.

Requirements

Requirement Value
Minimum supported client Windows 7
Target Platform Universal
Header ntifs.h (include Ntifs.h, FltKernel.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL PASSIVE_LEVEL
DDI compliance rules HwStorPortProhibitedDDIs(storport), PowerIrpDDis(wdm)

See also

FILE_GET_QUOTA_INFORMATION

FILE_QUOTA_INFORMATION

IO_STATUS_BLOCK

IRP_MJ_QUERY_QUOTA

IRP_MJ_SET_QUOTA

IoCheckQuotaBufferValidity

Using Nt and Zw Versions of the Native System Services Routines

ZwQueryQuotaInformationFile