EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Get bytes on file open

Also by EldoS: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.
#14207
Posted: 08/17/2010 11:59:03
by Jeff Bogenschneider (Basic support level)
Joined: 08/17/2010
Posts: 7

When I get the contents of a directory from our web based file system I only want to create zero byte files to ensure top performance, this works fine, but I want to get the bytes for the file when I open it. The open file and enumerate directory events fire too often and the Read File event only seems to fire when the file is created (must be cached?)

Has anyone else attempted this or is another built in approach for this? It seems doomed since at the point of launch the os believes the file to be of zero bytes and that's the one it's going to open.
#14208
Posted: 08/17/2010 12:31:06
by Eugene Mayevski (EldoS Corp.)

You can't change the file size on the fly, yes. I.e. if you told the OS that the file has X bytes, you must be able to provide exactly X bytes. I guess you are trying to solve some other, wider, problem. In this case please describe it rather than checking [impossible] ways for narrow task.


Sincerely yours
Eugene Mayevski
#14209
Posted: 08/17/2010 12:53:49
by Jeff Bogenschneider (Basic support level)
Joined: 08/17/2010
Posts: 7

In other words we are trying to display the metadata about the file, but not the file itself. Then only retreive the bytes for the file when/if we want to open the file. The reason for this is our folders could sometimes have hundreds of files and we just can't download them all everytime a folder is opened at the client.

We have been using a webdav solution, but that only works for clients running XP.

It has occured to me that I can get all the files at first and then gradually replace them with the real files.
#14210
Posted: 08/17/2010 14:15:26
by Eugene Mayevski (EldoS Corp.)

I.e. you are worried that when the folder is opened in Explorer, too much file read operations is performed? This problem has an easy solution - network disk type. Please do the forum search, this question was discussed at least a dozen of times.


Sincerely yours
Eugene Mayevski
#14211
Posted: 08/17/2010 14:50:48
by Jeff Bogenschneider (Basic support level)
Joined: 08/17/2010
Posts: 7

I was going to try the network type, but wasn't sure if it would delay the read. I think there has been some changes to AddMounting methods since some of the earlier posts on the the subject, I'm having trouble getting the right syntax for the latest version, to create the network drive. What is the storage type to use? I would guess virtual, but that creates a ram disk?

mCbFs.StorageType = CbFsStorageType.stDiskPnP;
mCbFs.StorageCharacteristics = 0;
mCbFs.CreateStorage();

Then in the mounting:

mCbFs.AddMountingPoint(edtMountinPoint.Text + ";zywave;fileshare"(uint)CallbackFS.CbFsNetworkSymLinkFlags.nsmWriteNetworkAccess, null);

thanks, I'm very hopefull that this is what we're looking for!
#14213
Posted: 08/17/2010 15:54:41
by Volodymyr Zinin (EldoS Corp.)

You can use any type of storage.
But the least problematic (it means minimum influence on the system and as a result the system sends minimum requests to the storage) is
mCbFs.StorageType = CbFsStorageType.stDisk;
mCbFs.StorageCharacteristics = scRemovableMedia;
#14214
Posted: 08/18/2010 00:28:49
by Eugene Mayevski (EldoS Corp.)

Please do the search across the site for "network mounting point". When the file system is mounted as network, it's remote. The OS knows it and performs less reading from files. Removable media is still local, and Explorer reads lots of data from the files.


Sincerely yours
Eugene Mayevski
#14216
Posted: 08/18/2010 08:30:12
by Jeff Bogenschneider (Basic support level)
Joined: 08/17/2010
Posts: 7

ok I've been able to create a network mounting with:

Code
mCbFs.StorageType = CbFsStorageType.stDisk;
                mCbFs.StorageCharacteristics = CallbackFS.CallbackFileSystem.scRemovableMedia;
                mCbFs.CreateStorage();


then:
Code
/mCbFs.AddMountingPoint(edtMountinPoint.Text + ";;myshare", CallbackFS.CallbackFileSystem.CBFS_SYMLINK_NETWORK, null);


but I can't create folders or files, get an "access denied" error

if I try:
Code
mCbFs.AddMountingPoint(edtMountinPoint.Text + ";;myshare", CallbackFS.CallbackFileSystem.CBFS_SYMLINK_NETWORK_WRITE_NETWORK_ACCESS, null);

it doesn't error, but doesn't map.
#14217
Posted: 08/18/2010 09:08:05
by Eugene Mayevski (EldoS Corp.)

The flags can be combined ;)


Sincerely yours
Eugene Mayevski
#14219
Posted: 08/18/2010 10:29:59
by Jeff Bogenschneider (Basic support level)
Joined: 08/17/2010
Posts: 7

thanks, yes I should have tried the bitwise first as documented. The following maps the drive fine, however, I am still getting access denied when I try to add a file or directory. I was not having this issue for non-network drives.

Code
mCbFs.AddMountingPoint(edtMountinPoint.Text + ";;myshare", CallbackFS.CallbackFileSystem.CBFS_SYMLINK_NETWORK | CallbackFS.CallbackFileSystem.CBFS_SYMLINK_NETWORK_WRITE_NETWORK_ACCESS, null);
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.

Reply

Statistics

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