// ntifs.h
NTSTATUS FsRtlInsertPerFileContext(
[in] PVOID *PerFileContextPointer,
[in] PFSRTL_PER_FILE_CONTEXT Ptr
);
View the official Windows Driver Kit DDI referenceNo description available.
The FsRtlInsertPerFileContext routine associates a FSRTL_PER_FILE_CONTEXT object with a driver-specified context object for a file.
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.
The FsRtlInsertPerFileContext routine returns STATUS_SUCCESS, or an appropriate error code, such as:
| Return code | Description |
|---|---|
| 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). |
The FsRtlGetPerFileContextPointer macro returns a FileContextSupportPointer for an open file.
Parameters
FileObject
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.
Tracking Per-File Context in a Legacy File System Filter Driver