FsRtlInitPerFileContext macro

The FsRtlInitPerFileContext macro initializes a FSRTL_PER_FILE_CONTEXT structure.

Syntax

VOID FsRtlInitPerFileContext(
   FSRTL_PER_FILE_CONTEXT FileContext,
   PVOID                  OwnerId,
   PVOID                  InstanceId,
   PFREE_FUNCTION         FreeCallback
);

Parameters

  • FileContext
    The FSRTL_PER_FILE_CONTEXT object to be initialized.

  • OwnerId
    A pointer to a filter driver-allocated variable that uniquely identifies the owner of the per-file context structure. The format is filter driver-specific. This parameter must have a non-NULL value.

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

  • FreeCallback
    A pointer to a callback routine that frees the per-file context structure.

Return value

None

Remarks

This macro must be used before calling FsRtlInsertPerFileContext.

Filter writers should choose an OwnerID value that is both meaningful and convenient, such as the address of a driver object or device object.

Filter writers should use an InstanceID value that is both meaningful and convenient, such as the address of the file context object for the file. Use the FsRtlGetPerFileContextPointer macro to retrieve that address from a file object.

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

Desktop

Version

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

Header

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

IRQL

Any

See also

FSRTL_PER_FILE_CONTEXT

FsRtlInsertPerFileContext

 

 

Send comments about this topic to Microsoft