CleanupContext Event

Fires when the application-defined data stored in one or more contexts needs to be cleaned up.

Syntax

virtual int FireCleanupContext(CBFilterCleanupContextEventParams *e);
typedef struct {
void *FileContext;
void *HandleContext;
int ResultCode; int reserved; } CBFilterCleanupContextEventParams;
virtual INT FireCleanupContext(CBFilterCleanupContextEventParams *e);
typedef struct {
LPVOID FileContext;
LPVOID HandleContext;
INT ResultCode; INT reserved; } CBFilterCleanupContextEventParams;

Remarks

This event fires after a file or directory is closed, just before any contexts related to it are discarded, giving applications a chance to clean up any information stored in them.

The FileContext and HandleContext parameters are placeholders for application-defined data associated with the file and specific handle, respectively. Please refer to the Contexts topic for more information.

When a handle to some file or directory is closed, this event will fire if the HandleContext associated with that handle is not NULL. When the last handle to the file or directory is closed, this event will fire if the HandleContext associated with that handle and/or the FileContext associated with that file or directory is not NULL. After this event fires, the applicable contexts are set back to NULL automatically.

Applications that need to know the name of the file or directory this event is firing for should store a copy of said name in the context itself during an earlier event.

This event is optional; it will fire regardless of whether any filter rules are present, but only if FileContext, HandleContext, or both, are not already NULL. Applications that clean up their contexts (and set them back to NULL) when a file is being closed, or earlier, do not need to handle this event.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), set it to a non-zero value to report an appropriate error. Please refer to the Error Reporting and Handling topic for more information.

This event is fired synchronously; please refer to the Event Types topic for more information.

 
 
Copyright (c) 2021 Callback Technologies, Inc. - All rights reserved.
CBFS Filter 2020 C++ Edition - Version 20.0 [Build 7836]