EldoS | Feel safer!

Software components for data protection, secure storage and transfer

OpenFile several times with different access

Posted: 07/02/2013 03:14:34
by Andrew Solonovich (Standard support level)
Joined: 04/05/2013
Posts: 12

I have some questions about OpenFile callback.

1) as I know, CBFS by default does not call OpenFile without calling CloseFile more than once for the same file.
The question is - if system tries open file twice (without close) - first with desired access = read and share = read write, second with desired access = write and share = read, how CBFS will process this requests?
I need support opening file with different share and access types.

2) help file CBFS.chm describes OpenFile callback as function with 6 parameters, but in fact there are 7 parameters - help file needs update, isn't it?
Posted: 07/02/2013 03:51:30
by Volodymyr Zinin (Team)

Hello Andrew,

1. There is the CallbackFileSystem.CallAllOpenCloseCallbacks property for this. If it's set then the OnCreate/OnOpen callback is called for all file/directory openings.
CallbackFS handles DesiredAccess and ShareMode attributes internally. So in "simple" cases it isn't necessary to make additional work with these parameters. But in your callbacks you can access to the "backend files" (for example files located remotely) and these "backend files" can be opened and used outside your callbacks too (for example by another user from another machine in the network). So in this case you can use the DesiredAccess and ShareMode parameters to perform additional handling in order to protect data coherency.

2. Yes. We will correct the documentation. Thank you. In the last major version the parameter FileAttributes was added. It can be used to make additional processing for such attributes as FILE_FLAG_SEQUENTIAL_SCAN, FILE_FLAG_WRITE_THROUGH, FILE_FLAG_RANDOM_ACCESS, etc (for description of these flags see MSDN for the CreateFile API). For example this can be used in order to know whether it's necessary to do some local caching of remote "backend files".



Topic viewed 814 times

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


Back to top

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

Got it!