there are a few things that are not fully clear to me regarding contexts.
every FltGet***Context must be accompanied with a FltReleaseContext.
but if i i store a stream context pointer inside a streamhandle context, i dont have to release it after saving the reference in the context, only when cleaning up the streamhandle context.
is that right?
according to the help page of FltReleaseContext, “the Context pointer returned by FltDeleteContext must also be released by calling FltReleaseContext when they are no longer needed”.
but it is not stated anywhere on the FltDeleteContext page that it “returns” any context, and it’s only parameter has an “IN” prefix anyway
could it mean that this is true only in the case of FltDelete***Context, where the last parameter is OUT? (and i suppose it does not increase the refcount if this parameter is NULL, since it is OPTIONAL)
last questions are about setting contexts:
suppose i am in the InstanceSetupCallback.
i call a FltAllocateContext with FLT_INSTANCE_CONTEXT, if successfull, it now has the refcount of 1.
then i call a FltSetInstanceContext with FLT_SET_CONTEXT_KEEP_IF_EXISTS and NULL for OldContext.
in this case if it is successfull, the context would have a refcount of 2?
if i call FltSet***Context, and it returns STATUS_SUCCESS, it increases the refcount of the NewContext.
if i provide and OldContext too, will it increase the refcount if i set FLT_SET_CONTEXT_REPLACE_IF_EXISTS or FLT_SET_CONTEXT_KEEP_IF_EXISTS?
the help states the following: “After calling FltSetInstanceContext, the caller must call FltReleaseContext to decrement the reference count on NewContext, even if the call to FltSetInstanceContext was unsuccessful”
what is considered unsuccessfull?
does it really mean that FltSet***Context increases refcount (for NewContext) only when it returns STATUS_SUCCESS, STATUS_FLT_CONTEXT_ALREADY_DEFINED or STATUS_FLT_CONTEXT_ALREADY_LINKED?
thanks