MmDoesFileHaveUserWritableReferences function

The MmDoesFileHaveUserWritableReferences function returns the number of writable references for a file object.

Syntax


ULONG MmDoesFileHaveUserWritableReferences(
  _In_ PSECTION_OBJECT_POINTERS SectionPointer
);

Parameters

SectionPointer [in]

Pointer to a SECTION_OBJECT_POINTERS structure that contains the file object's section object pointers. This parameter is required and cannot be NULL.

Return value

MmDoesFileHaveUserWritableReferences returns the number of writable references for the file object associated with the SectionPointer parameter.

Remarks

MmDoesFileHaveUserWritableReferences returns the number of writable references for the file object that is associated with the SectionPointer parameter. This return value is the sum of the following numbers:

  • The number of writable file handles for the associated file object.

  • The number of writable sections for the associated file object.

  • The number of writable views for the associated file object.

  • The number of outstanding MDLs, which are mapping regions for the associated file object.

For transactional file systems, you can use this function to determine if a given transaction is referencing a file object that can change. If so, the transaction must be rolled back because atomicity cannot be guaranteed.

Prior to calling MmDoesFileHaveUserWritableReferences, transactional file systems must check and intercept the creation of file objects that specify write access. Specifically, prior to starting a transaction, transactional file systems must ensure that there are no writable file objects that currently exist for the given file in the transaction. While the transaction is ongoing, transactional file systems must fail the requests to create file objects with write access for the transacted files.

Note   This function can be used to detect if there are writable views for a file object even when all file handles and section handles for the file object have been closed.
 

For more information about transactions, see Kernel Transaction Manager Design Guide and Kernel Transaction Manager Routines.

For more information about file objects, see FILE_OBJECT.

Requirements

Target platform

Universal

Version

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

Header

Ntifs.h (include Fltkernel.h or Ntifs.h)

Library

NtosKrnl.lib

DLL

NtosKrnl.exe

IRQL

<= APC_LEVEL

See also

FILE_OBJECT

 

 

Send comments about this topic to Microsoft

Show: