Where's the CreationDisposition parameter and how do I distinguish between the Open and Create operations?

In order to simplify the user mode interface, CBFS Connect handles CreationDisposition itself and calls either the OnCreateFile or OnOpenFile callback/event. CBFS Connect knows whether the created/opened file exists because the information about it is obtained earlier by means of the OnGetFileInfo callback/event. Also, the CBFS Connect driver has an internal metadata cache where it holds information about recently used files/directories.

So, if your OnCreateFile handler is called, you need to create the file. If the file exists and CBFS Connect knows it, receiving OnCreateFile means that the file was requested for opening with the "CreateAlways" flag, which means that you need to truncate the existing file. If you don't want to truncate the file for whatever reason, return the ERROR_ALREADY_EXISTS error by throwing the exception with corresponding error code as the parameter.

Ready to get started?

Learn more about Callback Technologies or download a free trial.

Download Now