CcFastCopyRead function (ntifs.h)

The CcFastCopyRead routine performs a fast copy read from a cached file to a buffer in memory.

Syntax

void CcFastCopyRead(
  [in]  PFILE_OBJECT     FileObject,
  [in]  ULONG            FileOffset,
  [in]  ULONG            Length,
  [in]  ULONG            PageCount,
  [out] PVOID            Buffer,
  [out] PIO_STATUS_BLOCK IoStatus
);

Parameters

[in] FileObject

Pointer to a file object for the cached file from which the data is to be read.

[in] FileOffset

Starting byte offset within the cached file.

[in] Length

Length in bytes of the data to be read.

[in] PageCount

Number of pages spanned by the read.

[out] Buffer

Pointer to a buffer into which the data is to be copied.

[out] IoStatus

Pointer to a structure that receives the final completion status and information about the operation. If not all of the data is copied successfully, IoStatus.Information contains the actual number of bytes that were copied.

Return value

None

Remarks

CcFastCopyRead is a faster version of CcCopyRead. It differs from CcCopyRead in the following respects:

  • FileOffset is a ULONG, not a PLARGE_INTEGER.

  • There is no Wait parameter. The caller must be able to enter a wait state until all the data has been copied.

  • CcFastCopyRead does not return a BOOLEAN to indicate whether the read operation was successful.

FileOffset plus Length must be less than or equal to the size of the cached file, or an assertion failure will occur.

If any failure occurs, CcFastCopyRead raises a status exception for that particular failure. For example, if a pool allocation failure occurs, CcFastCopyRead raises a STATUS_INSUFFICIENT_RESOURCES exception; if an I/O error occurs, CcFastCopyRead raises the status exception of the I/O error. Therefore, to gain control if a failure occurs, the driver should wrap the call to CcFastCopyRead in a try-except or try-finally statement.

To cache a file, use CcInitializeCacheMap.

Requirements

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

See also

CcCopyRead

CcInitializeCacheMap

CcReadAhead

CcScheduleReadAhead

CcSetAdditionalCacheAttributes

CcSetReadAheadGranularity