The ZwFlushBuffersFileEx routine is called by a file system filter driver to send a flush request for a given file to the file system. An optional flush operation flag can be set to control how file data is written to storage.
NTSTATUS ZwFlushBuffersFileEx( _In_ HANDLE FileHandle, _In_ ULONG Flags, _Out_ PIO_STATUS_BLOCK IoStatusBlock );
Flush operation flags. Flags can be 0 or one of the following values.
Value Meaning FLUSH_FLAGS_FILE_DATA_ONLY
If the file is on an NTFS file system, file data in the file cache will be written. No metadata is written and the underlying storage is not synchronized to flush its cache. This flag is not valid with volume handles.
If the file is on an NTFS file system, file data and metadata in the file cache will be written. The underlying storage is not synchronized to flush its cache. This flag is not valid with volume handles.
Address of the caller's I/O status block. This parameter is required and cannot be NULL.
ZwFlushBuffersFileEx returns STATUS_SUCCESS or an appropriate NTSTATUS value, such as one of the following:
The file resides on a write-protected volume; this is an error code.
The file resides on a volume that is not currently mounted; this is an error code.
The file does has neither write or append access.
A file system filter driver can call ZwFlushBuffersFileEx to issue an IRP_MJ_FLUSH_BUFFERS request to the file system for a given file. The flush operation is synchronous.
Minifilter drivers should call FltFlushBuffers instead of calling ZwFlushBuffersFileEx.
Callers of ZwFlushBuffersFileEx must be running at IRQL = PASSIVE_LEVEL and with special kernel APCs enabled.
Note If the call to the ZwFlushBuffersFileEx function occurs in user mode, you should use the name "NtFlushBuffersFileEx" instead of "ZwFlushBuffersFileEx".
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.
Available starting with Windows 8.
|Ntifs.h (include Ntifs.h)|
PASSIVE_LEVEL (See Remarks section.)