// fltkernel.h
NTSTATUS FLTAPI FltSetTransactionContext(
[in] PFLT_INSTANCE Instance,
[in] PKTRANSACTION Transaction,
[in] FLT_SET_CONTEXT_OPERATION Operation,
[in] PFLT_CONTEXT NewContext,
[out, optional] PFLT_CONTEXT *OldContext
);
View the official Windows Driver Kit DDI reference
No description available.
The FltSetTransactionContext routine sets a context on a transaction.
Instance
[in]Opaque instance pointer for the caller.
Transaction
[in]Opaque transaction pointer for the transaction on which the context is being set.
Operation
[in]Flag that specifies the details of the operation to be performed. This parameter must be one of the following:
Flag | Meaning |
---|---|
FLT_SET_CONTEXT_REPLACE_IF_EXISTS | If a context is already set for the transaction pointed to by the Transaction parameter, FltSetTransactionContext will replace it with the context pointed to by the NewContext parameter. Otherwise, it will set the context pointed to by the NewContext parameter as the context for the transaction pointed to by the Transaction parameter. |
FLT_SET_CONTEXT_KEEP_IF_EXISTS | If a context is already set for the transaction pointed to by the Transaction parameter, FltSetTransactionContext will return STATUS_FLT_CONTEXT_ALREADY_DEFINED, and will not replace the existing context or increment the reference count. If a context has not already been set, this routine will set the context pointed to by the NewContext parameter as the context for transaction pointed to by the Transaction parameter, and will increment the reference count. |
NewContext
[in]Pointer to the new context to be set for the transaction. This parameter is required and cannot be NULL.
OldContext
[out, optional]Pointer to a caller-allocated variable that receives the address of the existing transaction context, if one is already set. This parameter is optional and can be NULL. For more information about this parameter, see the following Remarks section.
FltSetTransactionContext returns STATUS_SUCCESS or an appropriate NTSTATUS value such as one of the following:
Return code | Description |
---|---|
STATUS_FLT_CONTEXT_ALREADY_DEFINED | If FLT_SET_CONTEXT_KEEP_IF_EXISTS was specified for the Operation parameter, this error code indicates that a context is already attached to the transaction. Only one context can be attached to a transaction for a given minifilter driver. |
STATUS_FLT_CONTEXT_ALREADY_LINKED | The context pointed to by the NewContext parameter is already linked to an object. In other words, this error code indicates that NewContext is already in use due to a successful prior call of an FltSetXxxContext routine. |
STATUS_FLT_DELETING_OBJECT | |
The instance specified in the Instance parameter is being torn down. This is an error code. | |
STATUS_INVALID_PARAMETER | An invalid parameter was passed. For example, the NewContext parameter does not point to a valid transaction context, or an invalid value was specified for the Operation parameter. This is an error code. |
For more information about contexts, see About minifilter contexts.
A minifilter driver calls FltSetTransactionContext to attach a context to a transaction or to remove or replace an existing transaction context. A minifilter driver can attach only one context to a given transaction.
If FltSetTransactionContext succeeds:
Else if FltSetTransactionContext fails:
Regardless of success:
For more information, see Referencing Contexts.
For more information, see Setting Contexts, and Releasing Contexts:
To get a transaction context, call FltGetTransactionContext.