Windows Structured Storage - 32-bit vs 64-bit COM Interop
See the question and my original answer on StackOverflowYou should define the interface like this:
[ComImport]
[Guid("00000138-0000-0000-C000-000000000046")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IPropertyStorage
{
[PreserveSig]
uint ReadMultiple(
uint count,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] PropertySpec[] properties,
[Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] PropertyVariant[] values);
[PreserveSig]
uint WriteMultiple(
uint count,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] PropertySpec[] properties,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] PropertySpec[] values,
uint miniumumPropertyId);
// other methods left as an exercise to the reader...
}
Note the usage of the PreserveSig attribute. Well, it means you'll have to test the return values now :-)
Note: if you need more compound storage p/invoke declarations, you can have a look at this 100% free Nuget tool: CodeFluent Runtime Client. It contains a CompoundStorage class utility that you can use, or just inspect it using .NET Reflector or ILSpy and grab the p/invoke definitions it contains. It should support 32 and 64-bit worlds.