EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Understanding Enumerate Directory

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
#16051
Posted: 03/14/2011 23:49:32
by Sid Schipper (Standard support level)
Joined: 03/14/2008
Posts: 285

I am having some trouble understanding the Mapper sample in the CPP Samples.

In the OnEnumerateDirectory callback you seem to do a bunch of stuff using iterators when the Mask is not "*" (ExactMatch). What is that all about? I'd like to emulate it in my code but I don't understand it.

Why does the callback have to do something different if the Mask is "*", versus a Mask that is not "*"?

My application is very similar to that sample, except instead of doing what you do, I make calls to my database system to find the virtual files. My database system has an "OpenDirectory" call, which opens the virtual directory with the mask, so subsequent calls to read the virtual directory only get file names that match the mask. We also have a "CloseDirectory" call, a "RewindDirectory" call, and a "ReadDirectory" call, which gets the next file name from the virtual directory based on the mask.

Given that explanation, maybe you can tell me how I would replace your virtual file APIs in the Mapper sample with mine.
#16067
Posted: 03/16/2011 04:09:14
by Alexander Plas (EldoS Corp.)

Hello

Are you sure that you mean CPP Mapper sample? There are no additional branches depend on file mask.
#16073
Posted: 03/16/2011 10:25:06
by Sid Schipper (Standard support level)
Joined: 03/14/2008
Posts: 285

Yes, I am sure I have the right sample, but it is the "Mounter" sample, not the "Mapper" sample. Look at line 1017 in Mounter.cpp for a branch that depends on the mask.

Meanwhile, a colleague of mine and I sat down and did an extensive analysis of your sample code versus our application code and we came up with a new design that more closely emulates your sample. I implemented that design yesterday and it is working like a champ. Thank you, Eldos.
#16078
Posted: 03/17/2011 04:33:04
by Vladimir Cherniga (EldoS Corp.)

The Mounter sample you've mentioned is from VDisk CBFS sample. In OnEnumerateDirectory callback implementation it emulate the work of FindFirstFile, FindNextFile win32 api used in Mapper sample. Mapper sample is working with a windows directory structure on a physical storage as a source of cbfs files. VDisk and VMounter samples emulate directory structure in memory. All the staff from Vdisk's sample OnEnumerateDirectory callback tries to reproduce the FindFirstFile, FindNextFile, FindClose behavour.
#16080
Posted: 03/17/2011 15:11:52
by Sid Schipper (Standard support level)
Joined: 03/14/2008
Posts: 285

Yes, Vladimir and that is what my application does also. Our OpenDirectory call followed by the first ReadDirectory call is similar to FindFirstFile, and our ReadDirectory call is similar to FindNextFile and our CloseDirectory call is similar to FindClose, so we just used your sample and replaced everything with our calls and it worked fine.

It wasn't working so fine before, because I didn't really understand the relationship between your calls and the Windows calls. Now that I understand that I think we finally got it right.
Also by EldoS: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.

Reply

Statistics

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