Managing Contexts in a Minifilter Driver

A context is a structure that is defined by the minifilter driver and that can be associated with a filter manager object. Minifilter drivers can create and set contexts for the following objects:

  • Files (Windows Vista and later only.)

  • Instances

  • Volumes

  • Streams

  • Stream handles (file objects)

  • Transactions (Windows Vista and later only.)

Except for volume contexts, which must be allocated from nonpaged pool, contexts can be allocated from paged or nonpaged pool.

The filter manager deletes contexts automatically when the objects that they are attached to are deleted, when a minifilter driver instance is detached from a volume, or when the minifilter driver is unloaded.

This section includes:

Registering Context Types

Creating Contexts

Setting Contexts

Getting Contexts

Referencing Contexts

Releasing Contexts

Deleting Contexts

Freeing Contexts

File System Support for Contexts

Best Practices