FltGetSectionContext function (fltkernel.h)

The FltGetSectionContext routine retrieves a section context that was created for a file stream by a specified minifilter driver instance.

Syntax

NTSTATUS FLTAPI FltGetSectionContext(
  [in]  PFLT_INSTANCE Instance,
  [in]  PFILE_OBJECT  FileObject,
  [out] PFLT_CONTEXT  *Context
);

Parameters

[in] Instance

An opaque instance pointer for the minifilter driver instance whose context is to be retrieved.

[in] FileObject

A pointer to a file object for the stream.

[out] Context

A pointer to a caller-allocated variable that receives the address of the context. This parameter is required and can't be set to NULL.

Return value

FltGetSectionContext returns STATUS_SUCCESS when it successfully returns the requested section context. Otherwise, it returns an appropriate NTSTATUS value, such as one of the following:

Return code Description
STATUS_NOT_FOUND No matching context was found on this file at this time, so FltMgr set Context to NULL_CONTEXT. This is an error code.
STATUS_NOT_SUPPORTED The volume attached to this instance does not support section contexts. This is an error code.

Remarks

For more information about contexts, see About minifilter contexts.

FltGetSectionContext retrieves a section context that was created for a file stream by a specified minifilter driver instance. A section context is created by calling FltCreateSectionForDataScan.

FltGetSectionContext increments the reference count on the context that the Context parameter points to. When this context pointer is no longer needed, the caller must decrement its reference count by calling FltReleaseContext. Thus every successful call to FltGetSectionContext must be matched by a subsequent call to FltReleaseContext.

To allocate a new context, call FltAllocateContext.

Minifilters must not explicitly delete a section context passed to FltCreateSectionForDataScan. A section context is deallocated and removed from a stream by calling FltCloseSectionForDataScan in this case.

Requirements

Requirement Value
Minimum supported client Windows 8
Target Platform Universal
Header fltkernel.h (include Fltkernel.h)
Library FltMgr.lib
DLL Fltmgr.sys
IRQL <= APC_LEVEL

See also

FltAllocateContext

FltCloseSectionForDataScan

FltCreateSectionForDataScan

FltReleaseContext