| Previous | Next |
| ERROR_FLT_NO_HANDLER_DEFINED | ERROR_FLT_INVALID_ASYNCHRONOUS_REQUEST |
ERROR_FLT_CONTEXT_ALREADY_DEFINED
The object already owns a context of this type
ERROR_FLT_CONTEXT_ALREADY_DEFINED is normally returned by a FltSetXxxContext routine when FLT_SET_CONTEXT_KEEP_IF_EXISTS was requested and another context is already attached to the same object for this minifilter instance. It is a race-aware result: two threads can both allocate and initialize candidates, but only one becomes the installed context.
The losing thread should use the existing context returned through OldContext when the specific API supports it, then release every reference it owns. Replacing the context without a deliberate lifetime design can lose state observed by concurrent I/O and can invoke cleanup callbacks while other code still assumes the old object is authoritative.
Safe handling of the set race
- Treat the existing context as the canonical per-object state when using
KEEP_IF_EXISTS. - Release the newly allocated candidate after transferring or discarding any temporary initialization data.
- Release the returned old-context reference separately when the API provides one.
- Do not confuse this result with
ERROR_FLT_CONTEXT_ALREADY_LINKED, which describes reuse of the same context object.
References
- Microsoft: FltSetStreamContext
- Microsoft: minifilter context lifetime
- Microsoft: FltAllocateContext and reference counts
Looking for a different code? Search another status or error code.