Getting Contexts
Once a minifilter driver has set a context for an object, it can get the context by calling one of the following get routines:
- FltGetContexts
- FltGetContextsEx
- FltGetFileContext
- FltGetInstanceContext
- FltGetStreamContext
- FltGetStreamHandleContext
- FltGetTransactionContext
- FltGetVolumeContext
Every successful get routine increments the reference count on the context, requiring that the minifilter call FltReleaseContext when it no longer needs the context pointer.
In the following code example, taken from the SwapBuffers sample minifilter, the minifilter driver calls FltGetVolumeContext to get a volume context:
status = FltGetVolumeContext(
FltObjects->Filter, //Filter
FltObjects->Volume, //Volume
&volCtx); //Context
...
if (volCtx != NULL) {
FltReleaseContext(volCtx);
}
If the call to FltGetVolumeContext is successful, the Context parameter receives the address of the caller's volume context. FltGetVolumeContext increments the reference count on the Context pointer. Thus, when this pointer is no longer needed, the minifilter driver must release it by calling FltReleaseContext.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for