Hello,
I've written a wrapper for IStorage and I know the
majority of the code is working fine.
The only issue is with EnumElements. When its called the
function itself throws a COM Exception with the message
Invalid Pointer error.
My only guesses are that somehow my Interface declaration
of IEnumSTATSTG is incorrect or that the use of IntPtr is
incorrect for the void * used in EnumElements.
Is there another way to declare void * other than IntPtr.
If anybody can give me some help it would be greatly
appreciated.
CodeSnippet below
My IStorage is declared as
[ComImport]
InterfaceType(ComInterfaceType.InterfaceIsUnknown) ,
Guid("0000000b-0000-0000-C000-000000000046)]
public interface UCOMIStorage
{
...
int EnumElements(
int reserved1,
IntPtr reserved2,
int reserved3,
out UCOMIEnumSTATSTG
);
...
}
My IEnumSTATSTG is declared as
[ComImport,
InterfaceType(ComInterfaceType.InterfaceIsIUnknown ),
Guid("0000000d-0000-0000-C000-000000000046)]
public interface UCOMIEnumSTATSTG
{
...
}
The call to EnumElements called from a successfully opened
IStorage file is
UCOMIEnumSTATSTG IEnum;
int hRC = IStorageFile.EnumElements(0,IntPtr.Zero,0, out
IEnum);