EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Get bytes on file open

Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.
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 (Team)

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 (Team)

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 (Team)

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: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.



Topic viewed 5470 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!