Please help me understand compound files (COM structured storage)

Normally I have no trouble following the MSDN documentation but I'm really lost when it comes to compound files. One of the code examples starts talking about PropertySets when none of the previous documentation even so much as mentioned what a PropertySet is.

I think I can figure out how to create a compound file and then go from there using trial and error when necessary but I have just a couple questions...

1) Is it possible to access a storage or stream in a compound file given an absolute path? Looking over the functions and interface methods all I can see is a way to enumerate the contents of a given storage.

2) Is it possible to use compound files as if they actually were filesystems? Say I have a 3rd party library that allows me to save some file to disk, can I say "save it as a stream in this compound file" instead? Or do I have to actually create the stream and copy the bytes from the file to the stream?

1) Is it possible to access a storage or stream in a compound file given an absolute path? Looking over the functions and interface methods all I can see is a way to enumerate the contents of a given storage.


My guess would be no. But I could be wrong. I'm thinking it would break the encapsulation of the interface, and I don't believe there is any documented way of interacting with the storages and streams without using the provided interfaces.


2) Is it possible to use compound files as if they actually were filesystems? Say I have a 3rd party library that allows me to save some file to disk, can I say "save it as a stream in this compound file" instead? Or do I have to actually create the stream and copy the bytes from the file to the stream?


My guess, again, would be no. You would need to take the input from the 3rd party library, and modify it to work within the Structured Storage interfaces provided. Unless the 3rd party library had facilities internal to it to write its output as structured storage.

I worked with this quite a bit some time ago, but never really incorporated any of it within any of my work, even though I thought of ways I could advantaegously use it. If you like, I can did up some easy examples for you.
Is it possible to access a storage or stream in a compound file given an absolute path?
No. It's for this reason that Microsoft have always (well, since '94) wanted to enforce a relationship between the file system and COM objects. Without it, compound documents are essentially streamed within a serialised COM object (like a Word document).

Is it possible to use compound files as if they actually were filesystems?
No, for pretty much the same reason. Also, note that NTFS supports multiple streams per file, but there have been no interesting uses of that facility in 20 years.

NTFS also has notional support for off-line files, but that's not gone anywhere either as far as I can tell.

Now that Microsoft is no longer the leading domestic compter technology, hopefully they'll stop reinventing the wheel and start producing useful technologies that have an attention span of more than 3 years.
Last edited on
They say to think of a compound file as a filesystem within a file, yet we can't actually use them as such?

A stream is supposed to be analogous to a file in what way?

If you can't use an absolute path does that mean you have to enumerate storages recursively to get at a specific stream? Or am I thinking about this wrong?

It's my understanding that windows uses compound files for its thumbs.db and Picasa does the same thing. I was writing a program that I think could benefit from that if only I could wrap my head around it...

I appreciate the replies.
Last edited on
Are you actually thinking of using this stuff or are you just curious?

You're just asking for trouble if you do. My advice would be to just use the filesystem, and don't even use the multi-stream stuff. Of course, if you have good reason to or just want the experience, go ahead.
I guess I'm just curious.

I wrote a media manager that generates lots of thumbnails and I need to store them somewhere. Since there's a method to create an IWICBitmap from an IStream source it seemed like a natural solution, and I read that thumbs.db uses it and I'm pretty sure Picasa does as well.
I see.

Well, just say no. A mind is a terrible thing to waste.
So what's your beef with compound files?

I saw some code and it doesn't seem too terribly difficult to use. I'm just confused about the questions I asked before...

Is there something you recommend as an alternative? I was using a zip file but I get the impression that compression is unnesessary and decompression is slowing things down.

By the way, I also was considering using a compound file to save and load the contents of a tree control.
So what's your beef with compound files?

It's a pointless dead-end technology. It's difficult to understand. It's difficult to use. It's difficult to administer. No other platform's going to knowingly use it.

To summarise, if you don't already know it and haven't used it, 2014 isn't the time to start.
Topic archived. No new replies allowed.