EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Name of named streams too long?

Posted: 11/08/2009 23:37:18
by Gavin McKay (Standard support level)
Joined: 09/01/2009
Posts: 48

Hi this one is a bit weird! I have implemented CbFsEnumerateNamedStreams with code as follows:

StreamName = "test";
                byte[] nameAsBytes = SPUtils.Utilities.StringToUTF8ByteArray(StreamName);
                StreamNameLength = nameAsBytes.Length;
                StreamSize = vfile.NamedStreamArray.Length;
                StreamAllocationSize = vfile.NamedStreamArray.Length;

which worked when I tried to open (for example) a text file "abc.txt" in notepad, but failed in Microsoft Word. At some point after enumerating the named streams, it tries to request "abc.txt\te".

If I change my named stream name to "ab" i.e. two characters long, it works, Word will open the file, and it doesn't make a request for "abc.txt\ab".

Any ideas? I am not requesting the named stream at this stage, but it seems to always request it in Word. My code is working again so I'm OK, just was curious as to why this was happening.
Posted: 11/09/2009 02:13:24
by Volodymyr Zinin (Team)

Hello Gavin,

Named streams are specified by the use of a colon symbol between a file name and its named stream. For example "abc.txt:stream_name". A backslash symbol is used to specify a file within a directory.
Your code works because you tell CallbackFS in the OnOpen callback that the file "ab" exists in the directory "abc.txt" and allows to open it.

BTW we implemented the named streams in the same way as NTFS has. So if something you want to implement doesn't work on a NTFS volume it probably won't work on a CallbackFS one.
Posted: 11/09/2009 05:14:18
by Gavin McKay (Standard support level)
Joined: 09/01/2009
Posts: 48

That's the strange thing though - I am not trying to open a named stream, I am trying to open "\abc.txt" via CbFs using Microsoft Word. I have implemented named streams via cbfs, but in this case I'm not requesting "\abc.txt:stream_name". I just noticed that in the EnumerateNamedStreams event in cbfs it requests "\abc.txt\st", even though the client application is only requesting "\abc.txt".

If you add an event to EnumerateNamedStreams, does it always get called, regardless of whether the client application is requesting a named stream or not? I'm trying to figure out why opening via Notepad does not request a named stream, but opening via MS Word does. Perhaps some strange thing that MS Word does?
Posted: 11/09/2009 05:54:05
by Eugene Mayevski (Team)

As I know, Word uses secondary streams when they are available.

Sincerely yours
Eugene Mayevski
Posted: 11/09/2009 16:31:43
by Gavin McKay (Standard support level)
Joined: 09/01/2009
Posts: 48

Aha! That would explain it then - Word must be checking for named streams. Might be for implementing previews of files and things like that perhaps. Perhaps it is Word that cannot handle stream names > 2 characters?

Thanks, I'll check into this.



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