Getting Contexts

Once a minifilter driver has set a context for an object, it can get the context by calling FltGetXxxContext, where Xxx is the context type.

In the following code example, taken from the SwapBuffers sample minifilter driver, 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.

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft