EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Late OnCloseFile

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
Posted: 01/08/2016 02:35:57
by Yves Langisch (Standard support level)
Joined: 06/17/2015
Posts: 24

Copying a bunch of files in Windows Explorer to the remote drive I see the following callbacks:

  • OnGetFileInfo fileA.txt
  • OnCreateFile fileA.txt
  • n OnWriteFile callbacks
  • OnGetFileInfo fileB.txt
  • OnCreateFile fileB.txt
  • n OnWriteFile callbacks
  • ...
  • OnGetFileInfo fileZ.txt
  • OnCreateFile fileZ.txt
  • n OnWriteFile callbacks
  • ...
  • OnCloseFile fileA.txt
  • OnCloseFile fileB.txt
  • OnCloseFile fileZ.txt

Please note the late OnCloseFile callbacks. That could lead to many open connections against the remote server which can be a problem if there a connection limit per IP configured. These late close callbacks mainly happen with small files and fast connections. It looks like there is some fix time gap between the last write operation and the final close.

Is this behavior controlled by CBFS or is it the Windows Explorer deferring the close operations? I saw the CallAllOpenCloseCallbacks setting but I don't think that it affects my use case.

Posted: 01/08/2016 07:09:36
by Volodymyr Zinin (EldoS Corp.)

The OnClose callback is called at the time the system sends the IRP_MJ_CLOSE request to the CBFS driver. Unfortunately it is done only after all the references to the file have been closed. The references are not the same as the handles. These are different instances. Some system components as well as third party drivers can make a reference to a file and it prevents the file to be closed (for example in order to hold file data in a cache or to scan the file).
In your case, as a variant, use only one opening for the "backend" file (hold it in the FileInfo context). And close it only after all the OnClose callbacks come.



Topic viewed 1831 times



Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!