Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The MmCanFileBeTruncated routine checks whether a file can be truncated.
Syntax
BOOLEAN MmCanFileBeTruncated(
[in] PSECTION_OBJECT_POINTERS SectionPointer,
[in, optional] PLARGE_INTEGER NewFileSize
);
Parameters
[in] SectionPointer
Pointer to a structure that contains the file object's section object pointers.
[in, optional] NewFileSize
Pointer to a variable that specifies the size in bytes to which the file is to be truncated. If this parameter is NULL, then a length of zero is assumed and MmCanFileBeTruncated checks whether the entire file can 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
Requirement | Value |
---|---|
Target Platform | Universal |
Header | ntifs.h (include Ntifs.h) |
Library | NtosKrnl.lib |
DLL | NtosKrnl.exe |
IRQL | < DISPATCH_LEVEL |