CcSetFileSizes - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// ntifs.h

VOID CcSetFileSizes(
  [in] PFILE_OBJECT   FileObject,
  [in] PCC_FILE_SIZES FileSizes
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-ntifs-ccsetfilesizes)

CcSetFileSizes function

Description

The CcSetFileSizes routine updates the cache maps and section object for a cached file whose size has changed. Use CcSetFileSizesEx instead since it provides an NTSTATUS return code along with better guidance for error handling.

Parameters

FileObject [in]

Pointer to a file object for the cached file.

FileSizes [in]

Pointer to a CC_FILE_SIZES structure containing the new file size information.

Remarks

File systems must call CcSetFileSizesEx or CcSetFileSizes to update the cache manager data structures whenever one of the following changes is made to a cached file:

If any failure occurs, CcSetFileSizes raises a status exception for that particular failure. For example, if a pool allocation failure occurs, CcSetFileSizes raises a STATUS_INSUFFICIENT_RESOURCES exception. Therefore, to gain control if a failure occurs, the driver should wrap the call to CcSetFileSizes in a try-except or try-finally statement.

The file system must ensure that the cache map is valid and will remain so for the duration of this call.

To cache a file, use CcInitializeCacheMap.

To get the size of the cached file, pass FileObject to CcGetFileSizePointer.

See also

CcInitializeCacheMap

CcSetFileSizesEx