FsRtlLookupPerFileContext function (ntifs.h)

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

Syntax

PFSRTL_PER_FILE_CONTEXT FsRtlLookupPerFileContext(
  [in]           PVOID *PerFileContextPointer,
  [in, optional] PVOID OwnerId,
  [in, optional] PVOID InstanceId
);

Parameters

[in] PerFileContextPointer

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.

[in, optional] OwnerId

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.

[in, optional] InstanceId

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.

Requirements

Requirement Value
Minimum supported client Windows Vista
Target Platform Universal
Header ntifs.h (include FltKernel.h, Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL <= APC_LEVEL

See also

FSRTL_PER_FILE_CONTEXT

FsRtlGetPerFileContextPointer

FsRtlInsertPerFileContext

FsRtlRemovePerFileContext

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