ZwFlushBuffersFile routine

The ZwFlushBuffersFile routine is called by a file system filter driver to send a flush request for the specified file to the file system.

Syntax


NTSTATUS ZwFlushBuffersFile(
  _In_   HANDLE FileHandle,
  _Out_  PIO_STATUS_BLOCK IoStatusBlock
);

Parameters

FileHandle [in]

Handle returned by ZwCreateFile or ZwOpenFile for the file whose buffers will be flushed. This parameter is required and cannot be NULL.

IoStatusBlock [out]

Address of the caller's I/O status block. This parameter is required and cannot be NULL.

Return value

ZwFlushBuffersFile returns STATUS_SUCCESS or an appropriate NTSTATUS value, such as one of the following:

Return codeDescription
STATUS_MEDIA_WRITE_PROTECTED

The file resides on a write-protected volume; this is an error code.

STATUS_VOLUME_DISMOUNTED

The file resides on a volume that is not currently mounted; this is an error code.

 

Remarks

A file system filter driver can call ZwFlushBuffersFile 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 ZwFlushBuffersFile.

Callers of ZwFlushBuffersFile must be running at IRQL = PASSIVE_LEVEL and with special kernel APCs enabled.

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

Requirements

Version

Available starting with Windows Vista.

Header

Ntifs.h (include Ntifs.h)

Library

Ntoskrnl.lib

IRQL

PASSIVE_LEVEL (see Remarks section)

DDI compliance rules

PowerIrpDDis, HwStorPortProhibitedDDIs

See also

FltFlushBuffers
IRP_MJ_FLUSH_BUFFERS
ZwCreateFile
ZwOpenFile

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft