Export (0) Print
Expand All

MmCanFileBeTruncated routine

The MmCanFileBeTruncated routine checks whether a file can be truncated.

Syntax


BOOLEAN MmCanFileBeTruncated(
  _In_      PSECTION_OBJECT_POINTERS SectionPointer,
  _In_opt_  PLARGE_INTEGER NewFileSize
);

Parameters

SectionPointer [in]

Pointer to a structure that contains the file object's section object pointers.

NewFileSize [in, optional]

Pointer to a variable that specifies the size to which the file is to be truncated.

Return value

MmCanFileBeTruncated returns TRUE if the file can be truncated, FALSE otherwise.

Remarks

MmCanFileBeTruncated must always be called before a file is truncated.

A file cannot be truncated (and MmCanFileBeTruncated will return FALSE) if any of the following are true:

  • An image section exists for the file.

  • There are one or more outstanding write probes on the file's data section.

  • There is a mapped view of file's data section within the truncation range determined by NewFileSize.

  • One or more users hold references to the data section for the file, and NewFileSize <= the current file size.

Requirements

Header

Ntifs.h (include Ntifs.h)

Library

Ntoskrnl.lib

IRQL

< DISPATCH_LEVEL

See also

CcPurgeCacheSection
MmFlushImageSection

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft