EldoS | Feel safer!

Software components for data protection, secure storage and transfer

CBFS does not call OnGetFileInfo to get file attributes?

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
#24456
Posted: 04/05/2013 03:44:44
by Andrew Solonovich (Standard support level)
Joined: 04/05/2013
Posts: 12

Hello,

We are using CBFS version 4.0.130 (with evaluation key). Disk mounted as network drive.

We have embedded context menu for explorer - it reads attributes of file to define which menu items to show.
When I press right mouse button on file in Exporer window , OnOpenFile with fileAccess = READ_ATTRIBUTES and OnCloseFile callbacks occur several times, but OnGetFileInfo does not. Yes, it was called before, but attributes of file could be already changed from another application..
Attributes of file returns only in OnEnumerateDirectory and OnGetFileInfo, so how CBFS knows which attributes to return without calling this handlers?
When we use driver dokan – GetFileInfo called in this situation.

P.S. I know about NotifyDirectoryChange, but the problem is that attributes of file can be changed from different machine, where no cbfs installed.

Any help appreciated
#24457
Posted: 04/05/2013 04:29:27
by Eugene Mayevski (EldoS Corp.)

The data is taken from the metadata cache.

If the information has been changed under the hood, you need to call NotifyDirectoryChange method to notify CBFS and the OS about the background change.


Sincerely yours
Eugene Mayevski
#24458
Posted: 04/05/2013 05:09:32
by Volodymyr Zinin (EldoS Corp.)

If only file attributes have been changed (file attributes and/or file times) then use NotifyDirectoryChange with the flag fanMetaDataModified.
Don't forget to specify the full path beginning with backslash + file name as the FileName parameter.
#24459
Posted: 04/05/2013 07:23:20
by Andrew Solonovich (Standard support level)
Joined: 04/05/2013
Posts: 12

Thanks for quick reply!

Quote
Eugene Mayevski wrote:
The data is taken from the metadata cache


Can I clear this cache? If not, when it will be updated or how to make it updated?

I make simply program which gets attribute of file. C# code:

string filename = textBox1.Text;
FileInfo fi = new FileInfo(filename);
fi.Refresh();
if (fi != null)
{
MessageBox.Show(fi.Attributes.ToString());
}
I changed attribute 'Compressed' to 'Normal' and back under the hood - to emulate changes made by remote user.

Due to my research - CBFS does not return correct attributes even when OnEnumerateDirectory (where handler returns new correct attributes) called - only after OnGetFileInfo attribute changes.

Refreshing Explorer with F5 causes OnEnumerateDirectory call and despite of correct attribute returning by handler - context menu gets old attribute.
Is it a bug, or I made mistake somewhere?

Attribute changes only after opening "Properties" window in Explorer which causes OnGetFileInfo call.

Thanks in advance.
#24460
Posted: 04/05/2013 08:04:59
by Volodymyr Zinin (EldoS Corp.)

You can clear the cache either for a separate file/directory by the use of NotifyDirectoryChange or the cache at whole (by setting sequentially the MetaDataCacheEnabled property to false and to true again).

The last method doesn't work for files/directories that are currently opened by programs. I.e. opened files still have the "old" attributes.
In the case of NotifyDirectoryChange if you specify any another than the fanMetaDataModified flag (i.e. you specify that file contents has been changed outside CallbackFS) and a file is currently opened then CallbackFS makes all handles to the file as invalid. It means that any I/O via these handles returns error immediately. Only successful operation will be closing handle (which is CloseHandle in win32 API).
In the case when the fanMetaDataModified flag is used and a file is opened its handles remains valid and only its metadata (file attributes and file size) will be re-requested when it's necessary by the use of the GetFileInfo or EnumerateDirectory callback call.
#24461
Posted: 04/05/2013 08:25:36
by Volodymyr Zinin (EldoS Corp.)

About the encrypted and compressed attributes. You can specify them in your OnGetFileInfo and DirectoryEnumeration callbacks and they will be visible for a file/directory. But CallbackFS doesn't support these attributes completely. For example a file with such attributes will be colored in Explorer with blue or green, but there are not ability to change these attributes via the file properties dialog in Explorer. The behavior will be the same as FAT file system has.
We are going to implement such completed support of these attributes in future.
#34609
Posted: 10/05/2015 10:18:26
by William Levra-Juillet (Priority Standard support level)
Joined: 09/05/2013
Posts: 49

Quote
Vladimir Zinin wrote:
We are going to implement such completed support of these attributes in future.


Sorry to dig up an old thread, but is there any progress on that?
We'd like to be able to use Explorer to set/clear the FILE_ATTRIBUTE_COMPRESSED flag.

Thx
#34610
Posted: 10/05/2015 13:40:27
by Volodymyr Zinin (EldoS Corp.)

Unfortunately it has not been implemented yet.
#34622
Posted: 10/07/2015 10:52:50
by William Levra-Juillet (Priority Standard support level)
Joined: 09/05/2013
Posts: 49

Thx Volodymyr,

In cbfs 6.0, and new OnFSCtl callback, is there any way to support FILE_ATTRIBUTE_COMPRESSED and/or FILE_FILE_COMPRESSION in FILE_FS_ATTRIBUTE_INFORMATION?
Just curious, as it might be worth switching to 6.0 for that reason.
Thx!
#34623
Posted: 10/07/2015 11:27:44
by Volodymyr Zinin (EldoS Corp.)

As I wrote above with the present version you can use the "compressed" attribute.

But the following isn't currently possible:
Quote
We'd like to be able to use Explorer to set/clear the FILE_ATTRIBUTE_COMPRESSED flag.


Perhaps we will add it to CBFS v.6.1.
Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.

Reply

Statistics

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