From: Dominick Meglio on
I'm trying to work with IFilter's from C#. When I use the LoadIFilter
method, it works great. It reads the file, everything is fine.
However,my files are in a database. Therefore, I'd rather use
BindIFilterFromStream which uses the IStream interface to process the
data. Unfortunately, it keeps failing with E_FAIL. I built a class
that implements IStream and when I call BindIFilterFromStream, my
IStream's Stat method gets called. My method is implemented as
follows:

public void Stat(out
System.Runtime.InteropServices.ComTypes.STATSTG pstatstg, int
grfStatFlag)
{
pstatstg = new
System.Runtime.InteropServices.ComTypes.STATSTG();
pstatstg.clsid = clsid;
pstatstg.cbSize = stream.Length;
pstatstg.type = (int)STGTY.STGTY_STREAM;
pstatstg.pwcsName = "SampleText.doc";
}

The CLSID I'm specifying is {98DE59A0-D175-11CD-A7BD-00006B827D94}
which I believe to be correct. It's the value I found in the registry
for .doc.

My code seems to execute fine, but after my method returns,
BindIFilterFromStream returns E_FAIL. None of my other IStream methods
get called (I have breakpoints in all of them), it just returns the
error. Does anyone have any clue what might cause this? I'd really
appreciate any help anyone can provide, I've been staring at this
error for 2 days with no progress.

Thank you in advance.