The STGM enumeration values are used in the IStorage, IStream, and IPropertySetStorage interfaces. These elements are often combined using an OR operator.
[Flags] public enum STGM
Creates the new object while preserving existing data in a stream named "Contents".
Indicates that an existing storage object or stream should be removed before the new one replaces it.
Indicates that the underlying file is to be automatically destroyed when the root storage object is released.
In direct mode, each change to a storage or stream element is written as it occurs.
The STGM_DIRECT_SWMR supports direct mode for single-writer, multireader file operations.
Causes the create operation to fail if an existing object with the specified name exists.
In transacted mode, a temporary scratch file is usually used to save modifications until the Commit method is called.
This flag is used when opening a storage object with STGM_TRANSACTED and without STGM_SHARE_EXCLUSIVE or STGM_SHARE_DENY_WRITE.
Opens the storage object with exclusive access to the most recently committed version.
Indicates that the object is read-only, meaning that modifications cannot be made.
STGM_READWRITE allows you to both access and modify an object's data.
Specifies that subsequent openings of the object are not denied read or write access. If no flag from the sharing group is specified, this flag is assumed.
Prevents others from subsequently opening the object in STGM_READ mode. It is typically used on a root storage object.
Prevents others from subsequently opening the object for STGM_WRITE or STGM_READWRITE access.
Prevents others from subsequently opening the object in any mode. In transacted mode, sharing of STGM_SHARE_DENY_WRITE or STGM_SHARE_EXCLUSIVE can significantly improve performance since they don't require snapshotting.
STGM_SIMPLE is a mode that provides a much faster implementation of a compound file in a limited, but frequently used case.
In transacted mode, changes are buffered and written only if an explicit commit operation is called.
STGM_WRITE lets you save changes to the object, but does not permit access to its data.