EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Callback to change file properties

Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.
#27082
Posted: 11/01/2013 18:24:39
by Sid Schipper (Standard support level)
Joined: 03/14/2008
Posts: 285

Attached is a screen shot of a message that I receive when I drag and drop a file onto my virtual disk. I do not believe the message is an error, as the file properties do change when copying that particular file. What I am curious about is if there is a CbFs call back in which I could take the properties of the old file and copy them to the new file?


#27083
Posted: 11/02/2013 02:44:19
by Eugene Mayevski (EldoS Corp.)

Quite interesting, but it's not clear about what properties the OS is talking. Maybe these are extended attributes, but I am not sure.


Sincerely yours
Eugene Mayevski
#27084
Posted: 11/04/2013 00:47:25
by Volodymyr Zinin (EldoS Corp.)

In the case a file is moved from one disk to another then for the destination file system it looks like a new file is created. I.e. the create request is come (the file properties are specified during this request) and then several write requests occur to "fill" the file with data.
#27154
Posted: 11/05/2013 09:58:25
by Sid Schipper (Standard support level)
Joined: 03/14/2008
Posts: 285

So in the CreateFile callback I could probably mess around somehow with the file properties, maybe interrogating the operating system for properties of the source file and somehow recreating those properties on the new file. I'll mess around with it a little and let you know what I find out.
#27164
Posted: 11/06/2013 00:59:13
by Volodymyr Zinin (EldoS Corp.)

Let's consider the following situation:
Some program calls the CreateFile system API and specifies the OPEN_ALWAYS flag. I.e. if the file exists then it will be opened and if it doesn't exist then a new file will be created.
In the case the file already exists CBFS calls the OnOpenFile callback and the FileAttributes parameter of this call can be used to make additional processing for such attributes as FILE_FLAG_SEQUENTIAL_SCAN, FILE_FLAG_WRITE_THROUGH, FILE_FLAG_RANDOM_ACCESS, etc. CBFS already knows the real attributes for the file because it has obtained the file attributes before via the OnGetFileInfo or OnEnumerateDirectory callback.
In the case the file doesn't exist CBFS calls the OnCreateFile callback and the FileAttributes parameter will contain the requested attributes for the file (as they are specified in the originating CreateFile call). And in the case the OnCreateFile callback call has been successful then CBFS caches these attributes and uses them in the following file processing.
If it occurs that after the creation of the "backend" file its attributes are different than it was specified during the OnCreateFile callback call then you can call NotifyDirectoryChange("\...\filename.ext", fanMetaDataModified). It causes CBFS to remove the cached attributes from its metadata cache.
Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.

Reply

Statistics

Topic viewed 1204 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!