Can you restore a word document from 97-2003 only using its Compound File streams?

140 views Asked by At

I am trying to recover a word document that was using 97-2003 version. I do not remember why I did this, but I saved off the Compound File streams into a folder, and it is definitely something I would like to have back as the original document. Is there any solution for this?

Thanks!

1

There are 1 answers

1
Joseph Willcoxson On BEST ANSWER

Sure, you should theoretically be able to restore it.

You should be able to create a root compound document using

StgCreateDocfile() // or StgCreateStorageEx()

You will need the IStorage* pointer from this if it succeeds.

If you have a folder in your folder, you are going to have to create sub storages for each folder--and do it recursively. The API is IStorage::CreateStorage() ... look it up.

If you have a file in a folder, then a stream needs to be created in the storage that is equivalent to the folder. To create a stream, use IStorage::CreateStream()...look up arguments.

Looking at your screen shot, it has some streams named something like [1]CompObj or [5]SummaryDocumentInformation. For the [n] part, that is probably the equivalent of _T('\00n') where n is 1 or 5 or whatever--it's probably a control character. I've seen that in compound files. If you want to investigate, create a Word 97-2003 document and save as a .doc file and examine the structure.

So, something like [1]CompObj is really _T("\001CompObj")

The stuff above about [n] in your file names is an educated/experienced guess.