EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Is it possible to notice external changes in an open file's size?

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
Posted: 08/09/2016 13:26:36
by editshare (Standard support level)
Joined: 07/28/2015
Posts: 1


We have implemented a CallbackFS-based file system which accesses data on a remote server. The data can be changed externally from other clients of the same server.

We came across a problem when trying to make my CallbackFS-based filesystem aware of external changes of file size. When we have a file handle opened and we repeatedly query the file for its size using GetFileSizeEx, we get the same results each time even though the file size is changing on the server - our GetFileInfo callback is only called once for each descriptor.

We tried to work around this problem by using NotifyDirectoryChange, but that resulted in errors when trying to retrieve the file size again; I guess Volodymyr explained this in the following post:


(By the way, the remark about destroying existing handles is not present in the current version of CallbackFS's documentation.)

Considering all of the above, is there a way to make an existing file handle notice external changes to the file's size using CallbackFS?
Posted: 08/10/2016 07:06:16
by Volodymyr Zinin (EldoS Corp.)


Unfortunately Windows doesn't have such mechanism. A program can open a file, request its size, and then use this data many times. If the file size is changed outside then this program will still use the cached file size data, which is already incorrect.
You can use either fanModified or fanModifiedNotInvalidate. The difference between them is that the last one doesn't make already existing handles to the file as invalid.



Topic viewed 411 times

Number of guests: 1, registered members: 0, in total hidden: 0


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!