FsRtlInsertPerFileContext routine

The FsRtlInsertPerFileContext routine associates a FSRTL_PER_FILE_CONTEXT object with a driver-specified context object for a file.

Syntax


NTSTATUS FsRtlInsertPerFileContext(
  _In_ PVOID                   *PerFileContextPointer,
  _In_ PFSRTL_PER_FILE_CONTEXT Ptr
);

Parameters

PerFileContextPointer [in]

A pointer to an opaque pointer used by the file system runtime library (FSRTL) package to track file contexts. To retrieve this pointer from a file object, use the FsRtlGetPerFileContextPointer macro.

Ptr [in]

A pointer to the driver-specific context structure.

Return value

The FsRtlInsertPerFileContext routine returns STATUS_SUCCESS, or an appropriate error code, such as:

Return codeDescription
STATUS_INVALID_DEVICE_REQUEST

The underlying file system does not support filter file contexts. You can use the FsRtlSupportsPerFileContexts macro to check whether a file system supports per file context objects.

STATUS_INSUFFICIENT_RESOURCES

The system could not allocate resources (typically memory).

 

Remarks

The FsRtlGetPerFileContextPointer macro returns a FileContextSupportPointer for an open file.

Parameters

FileObject

FILE_OBJECT

A pointer to a file object.

Return value

PVOID

The FsRtlGetPerFileContextPointer macro returns an opaque pointer used by the file system runtime library (FSRTL) package to track file contexts. The macro returns NULL if the file system does not support the use of per-file context objects with files.

The FsRtlGetPerFileContextPointer macro returns the pointer to be passed to routines such as FsRtlInsertPerFileContext, FsRtlLookupPerFileContext, and FsRtlRemovePerFileContext.

For more information about how to use and create context objects, see Tracking Per-File Context in a Legacy File System Filter Driver.

Requirements

Target platform

Universal

Version

Available in Windows Vista and later versions of the Windows operating system.

Header

Ntifs.h (include FltKernel.h or Ntifs.h)

Library

NtosKrnl.lib

DLL

NtosKrnl.exe

IRQL

<=APC_LEVEL

See also

FSRTL_PER_FILE_CONTEXT
FsRtlLookupPerFileContext
FsRtlRemovePerFileContext
Tracking Per-File Context in a Legacy File System Filter Driver

 

 

Send comments about this topic to Microsoft

Show: