STGC (ole32)
Last changed: -139.149.31.230

.
Summary

C# Signature:

[DllImport("ole32.dll")]
static extern int StgCreateStorageEx([MarshalAs(UnmanagedType.LPWStr)] string
   pwcsName, uint grfMode, uint stgfmt, uint grfAttrs, [In] ref STGOPTIONS
   pStgOptions, IntPtr reserved2, [In] ref Guid riid,
   [MarshalAs(UnmanagedType.IUnknown)] out object ppObjectOpen);

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Define the ulSectorSize member of the STGOPTIONS structure using type uint (which is 32-bits in C#) instead of ulong (which is 64-bits in C#).

Please add some more!

Sample Code:

Please add some!

Alternative Managed API:

The Visual Studio SDK now has an OLE InterOp dll (freely available) that wraps all the structured storage functionality. The System.IO.Package in the NET 3.0 also wraps it in internal methods - but you can access them through the packaging api's.

See StgOpenStorageEx for an example of using the System.IO.Packaging classes to access OLE structured storage.

Documentation