CcPurgeCacheSection function (ntifs.h)

The CcPurgeCacheSection routine purges all or a portion of a cached file from the system cache.

Syntax

BOOLEAN CcPurgeCacheSection(
  [in]           PSECTION_OBJECT_POINTERS SectionObjectPointer,
  [in, optional] PLARGE_INTEGER           FileOffset,
  [in]           ULONG                    Length,
                 ULONG                    Flags
);

Parameters

[in] SectionObjectPointer

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

[in, optional] FileOffset

Pointer to a variable that specifies the starting byte offset within the cached file where the data is to be purged.

If FileOffset is NULL, the entire file is purged from the cache.

If FileOffset is not NULL, only the byte range specified by FileOffset and Length is purged.

[in] Length

Length of the byte range to purge, starting at FileOffset. If Length is zero, the range from FileOffset to the end of the file is purged. If FileOffset is NULL, Length is ignored.

Flags

Set to TRUE to uninitialize any private cache maps for the file before purging the file data.

Return value

CcPurgeCacheSection returns TRUE if the cached file data was successfully purged, FALSE otherwise.

Remarks

File systems call CcPurgeCacheSection to purge stale data from the cache. For example, when a file is truncated but not deleted, CcPurgeCacheSection should be called to purge any cached data that is no longer part of the file.

CcPurgeCacheSection will not purge mapped files.

Before calling CcPurgeCacheSection, the caller must acquire the file exclusively and ensure that no thread, including the caller, has mapped or pinned any byte range in the file.

Requirements

Requirement Value
Target Platform Universal
Header ntifs.h (include Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL < DISPATCH_LEVEL

See also

CcFlushCache

CcInitializeCacheMap

CcIsFileCached

CcUninitializeCacheMap

MmFlushImageSection