EldoS | Feel safer!

Software components for data protection, secure storage and transfer

enumerate directory Restart argument

Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.
#7764
Posted: 09/30/2008 12:28:24
by Constantin Scheder (Basic support level)
Joined: 09/19/2008
Posts: 3

We are logging the BOOL Restart argument for the CbFsEnumerateDirectory callback implementation and it is always FALSE in the normal course of using Windows Explorer on the virtual drive.

We have a reason to believe that in some cases the argument should be TRUE. For example, when deleting a file, we are getting called with a single CbFsEnumerateDirectory callback then come various calls to CbFsGetFileInfo and the CbFsDeleteFile callback. Finally, CbFsEnumerateDirectory is called again with the same EnumerationContext. As it's the same context, we are just continuing the enumeration where we left of. Say, there are 3 files - file1, file2, file3 - and we deleted file4. We started the enumeration with file1, now upon this 2nd call of CbFsEnumerateDirectory we are returning file2. Then on the third call we return file3 and that's it.

Unfortunately, the Windows Explorer is no longer showing file1 after the deletion of file4. Only upon doing a refresh (F5), file1 shows up again.

Could it be that the Restart argument is not properly passed to the CbFsEnumerateDirectory callback? If we received a Restart = TRUE on the second call to CbFsEnumerateDirectory, we could restart our directory enumeration and return file1 instead of file2. That should hopefully resolve the issue with Windows Explorer not showing file1.

Or do you have any other ideas what we might be doing wrong?
#7768
Posted: 09/30/2008 15:37:12
by Sid Schipper (Standard support level)
Joined: 03/14/2008
Posts: 285

I've done some more experimentation with this and I think we have the problem solved without using the Restart parameter. I will let you know if we need any more help in this area.
#7779
Posted: 10/02/2008 03:56:49
by Volodymyr Zinin (EldoS Corp.)

Hello,

We'll check it and answer here.
#7780
Posted: 10/02/2008 07:54:32
by Volodymyr Zinin (EldoS Corp.)

The Restart argument is set to true only when a program which is enumerating a directory wants to restart enumeration. For example if the system function ZwQueryDirectoryFile is used and its RestartScan argument is set to true.
During enumeration it's necessary to use EnumerationContext of the OnEnumerateDirectory callback. If it's set to NULL then this is start of an enumeration. In this case the context must be initialized. After all files in the directory are enumerated it's necessary to set the FileFound argument to false and after that the OnCloseEnumeration callback will be called in which EnumerationContext must be freed.

If your implementation of the OnEnumerateDirectory callback has the same behavior as described above then could you please send us a test program to reproduce the problem? I can't reproduce it with our Mounter sample. But if it's also reproducible with Mounter then please specify how we can do this.
Thanks.
#7787
Posted: 10/02/2008 13:29:38
by Sid Schipper (Standard support level)
Joined: 03/14/2008
Posts: 285

I have figured out what to do and we are doing it now without any problems. Thank you for your help.
Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages

Reply

Statistics

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