Compound file enumeration

M

Max Akbar

Hi all,

I am trying to enumerate the elements of a Compound storage file and I get an error (System.NullReferenceException) when I execute the "EnumElements" of the "UCOMIStorage". I can open the Compound file just fine just can't enumerate it's elements. Am I declaring something incorrectly?

Sample Code:

// Declaration of UCOMIStorage
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("0000000b-0000-0000-C000-000000000046")]
interface UCOMIStorage
{
void CreateStream(
[MarshalAs(UnmanagedType.LPWStr)] string wcsName,
int grfMode, //Access mode for the new stream
int reserved1, //Reserved; must be zero
int reserved2, //Reserved; must be zero
out UCOMIStream stream //Pointer to output variable
);

void OpenStream(
[MarshalAs(UnmanagedType.LPWStr)] string wcsName,
IntPtr reserved1, //Reserved; must be NULL
int grfMode, //Access mode for the new stream
int reserved2, //Reserved; must be zero
out UCOMIStream stream //Pointer to output variable
);

void EnumElements(
int reserved1,
IntPtr reserved2,
int reserved3,
out IEnumSTATSTG ppenum);
}


// Declaration of IEnumSTATSTG
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("0000000d-0000-0000-C000-000000000046")]
interface IEnumSTATSTG
{
void Next(Int64 celt, out STATSTG rgelt, out Int64 pceltFetched);
}
 
M

Max Akbar

nevermind I got it needed to define all of the interface methods.

Regards,
-Max
Hi all,

I am trying to enumerate the elements of a Compound storage file and I get an error (System.NullReferenceException) when I execute the "EnumElements" of the "UCOMIStorage". I can open the Compound file just fine just can't enumerate it's elements. Am I declaring something incorrectly?

Sample Code:

// Declaration of UCOMIStorage
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("0000000b-0000-0000-C000-000000000046")]
interface UCOMIStorage
{
void CreateStream(
[MarshalAs(UnmanagedType.LPWStr)] string wcsName,
int grfMode, //Access mode for the new stream
int reserved1, //Reserved; must be zero
int reserved2, //Reserved; must be zero
out UCOMIStream stream //Pointer to output variable
);

void OpenStream(
[MarshalAs(UnmanagedType.LPWStr)] string wcsName,
IntPtr reserved1, //Reserved; must be NULL
int grfMode, //Access mode for the new stream
int reserved2, //Reserved; must be zero
out UCOMIStream stream //Pointer to output variable
);

void EnumElements(
int reserved1,
IntPtr reserved2,
int reserved3,
out IEnumSTATSTG ppenum);
}


// Declaration of IEnumSTATSTG
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("0000000d-0000-0000-C000-000000000046")]
interface IEnumSTATSTG
{
void Next(Int64 celt, out STATSTG rgelt, out Int64 pceltFetched);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top