FsRtlLookupPerFileContext - NtDoc

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

PFSRTL_PER_FILE_CONTEXT FsRtlLookupPerFileContext(
  [in]           PVOID *PerFileContextPointer,
  [in, optional] PVOID OwnerId,
  [in, optional] PVOID InstanceId
);
View the official Windows Driver Kit DDI reference

NtDoc

No description available.

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

FsRtlLookupPerFileContext function

Description

The FsRtlLookupPerFileContext routine returns a pointer to a FSRTL_PER_FILE_CONTEXT object that is associated with a specified file.

Parameters

PerFileContextPointer [in]

A pointer to an opaque pointer that is 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.

OwnerId [in, optional]

A pointer to a filter driver-allocated variable that uniquely identifies the owner of the per-file context structure. The format of this variable is filter driver-specific. This parameter is optional, but must be non-NULL if InstanceId is non-NULL.

InstanceId [in, optional]

A pointer to a filter driver-allocated variable that can be used to distinguish among per-file context structures that are created by the same filter driver. The format of this variable is filter driver-specific. This parameter is optional.

Return value

A pointer to the first FSRTL_PER_FILE_CONTEXT structure that matches the OwnerId and InstanceId, if specified, or NULL if no match is found or the file system does not support per-file contexts.

Remarks

By not specifying OwnerID and InstanceId, a filter driver can search for the first context that is associated with a file.

If the file system does not support per-file context objects, NULL is returned. Use the FsRtlSupportsPerFileContexts macro to determine whether a file system supports per-file context objects.

See also

FSRTL_PER_FILE_CONTEXT

FsRtlGetPerFileContextPointer

FsRtlInsertPerFileContext

FsRtlRemovePerFileContext

Tracking Per-File Context in a Legacy File System Filter Driver