Specifies whether all or just the first open and the last close operations are reported via callbacks.
property CallAllOpenCloseCallbacks : boolean;
void SetCallAllOpenCloseCallbacks(BOOL Value);
Public Property CallAllOpenCloseCallbacks As Boolean
void setCallAllOpenCloseCallbacks(boolean value)
Use this property to tell the driver when to call OnCreateFile and OnCloseFile callbacks. By default CallAllOpenCloseCallbacks is false and the driver doesn't call the callback functions if the file is opened for the second and subsequent times "in parallel" (i.e. when the file is already opened). Also the driver doesn't call OnCloseFile until the last close operation (i.e. until there are no more open handles). Such behaviour speeds up operations. In other words, if you open the file the same file from two threads, OnCreateFile will be called only once, for the first open operation. When you close two handles for the opened file, OnCloseFile is called only for the second close operation.
When CallAllOpenCloseCallbacks is true, the driver calls OnCreateFile each time the file is opened and OnCloseFile each time the handle of the file is closed. In other words, if you open the file the same file from two threads, OnCreateFile will be called twice, for each open operation. When you close two handles for the opened file, OnCloseFile is called for both close operations.
The drawback of having CallAllOpenCloseCallbacks set to false is that if the file is opened only for reading first, your OnOpenFile handler opens the backend for reading, and then the same file is opened for writing, your code won't be notified about changed open mode. You will think that the file is opened only for reading and you will "unexpectedly" (for your code) get OnWriteFile call. In this situation you need to either open the backend storage in read-write mode (always) or set CallAllOpenCloseCallbacks to true and track the mode in which files are opened.
Also when CallAllOpenCloseCallbacks is false, HandleInfo parameter of various events have no effect (as HandleInfo contains information per opened-handle, and with CallAllOpenCloseCallbacks set to false this information is not accessible to your applcation).