EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Get bytes on file open

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
Posted: 08/18/2010 11:08:12
by Jeff Bogenschneider (Basic support level)
Joined: 08/17/2010
Posts: 7

ok, I figured out the situation where I'm getting access denied. If I add files right after the mounting I'm ok, but if I attempt to add files from within the CbFsEnumerateDirectory event I get the error.

That makes me wonder though how I'm going to load the contents of a directory when opened. Will it allow me from the open file event? Otherwise I have to build the entire directory structure right away?
Posted: 08/18/2010 11:36:01
by Eugene Mayevski (EldoS Corp.)

AddMountingPoint does 2 things:

1) create a mounting point
2) optionally share a disk so that it becomes visible as a share.


Sincerely yours
Eugene Mayevski
Posted: 08/18/2010 11:50:55
by Eugene Mayevski (EldoS Corp.)

You don't "add" files to CBFS disk. You provide a listing of whatever you have in response to CbFsEnumerateDirectory. I.e. the OS asks you "what do you have for me in the root folder?", and you tell it "I have folders A and B and files X and Y". You don't create any files or folders.

Please refer to samples for a guide.

Sincerely yours
Eugene Mayevski
Posted: 08/19/2010 17:53:15
by Jeff Bogenschneider (Basic support level)
Joined: 08/17/2010
Posts: 7

So basically the end solution I was looking for was to set the AllocationSize and EndOfFile properties of the VirtualFile object to match the downloaded file's bytes and then set the intial MemoryStream to a small ten byte block (has to be greater than zero or read event won't fire!!). Then on the "read event" I would download the file, then execute the VirtualFile "write" method with the downloaded byte array and then windows explorer would read and open that one instead.
The network mounting helps a lot as the read only happens on file open now.
Posted: 08/20/2010 01:29:04
by Eugene Mayevski (EldoS Corp.)

You still try thinking about some active actions. This is not the way Callback File System works. You only provide the data to the OS. You don't proactively write anything or set anything. I don't know what VirtualFile is (probably that's some object in the sample code), but in your real project you would have your own VirtualFile which wouldn't have any stream inside. Instead you would have methods that perform reading from actual data location.

BTW Android platform has the same callback-based concept and it takes some time to switch your mind from doing something proactively to responding to requests.

Sincerely yours
Eugene Mayevski
Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.



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