The filter manager enables minifilter drivers to associate contexts with objects to preserve state across I/O operations. Objects that can have contexts include volumes, instances, streams, and stream handles.
Contexts can be allocated from paged or nonpaged pool except for volume contexts, which must be allocated from nonpaged pool.
Contexts are freed automatically when all outstanding references have been released. If the minifilter driver defines a context cleanup callback routine, the filter manager calls the routine before the context is freed.
The filter manager takes care of deleting contexts when the associated object is deleted, when an instance is detached, and when the minifilter driver is unloaded.
If a minifilter driver supports only one instance per volume, use instance contexts rather than volume contexts for better performance. You can also improve performance by storing a pointer to the minifilter driver instance context inside stream or stream handle contexts.
Contexts are not supported for paging files or during the following operations:
Preoperation processing for create requests
Postoperation processing for close requests
Processing of IRP_MJ_NETWORK_QUERY_OPEN requests
See the CTX sample for an example of a minifilter driver that uses contexts.
The filter manager provides the following support routines for creating, registering, and setting contexts:
The following routines are provided for querying context support:
The following routines are provided for getting and referencing contexts:
The following routines are provided for releasing and deleting contexts:
|Callback Routine Name||Callback Routine Type|