IStream::Commit (Compact 2013)


This method ensures that any changes made to a stream object opened in transacted mode are reflected in the parent storage.

If the stream object is opened in direct mode, IStream::Commit has no effect other than flushing all memory buffers to the next level storage object.

The OLE compound file implementation of streams does not support opening streams in transacted mode.

HRESULT Commit( 
  DWORD grfCommitFlags 


[in] Value that controls how the changes for the stream object are committed.

For a definition of these values, see the STGC enumeration.

The following table shows the return values for this method.




Changes to the stream object were successfully committed to the parent level.


Asynchronous Storage only: Part or all of the stream's data is currently unavailable.


The commit operation failed due to lack of space on the storage device.


The object has been invalidated by a revert operation above it in the transaction tree.

This method ensures that changes to a stream object opened in transacted mode are reflected in the parent storage.

Changes that have been made to the stream since it was opened or last committed are reflected to the parent storage object.

If the parent is opened in transacted mode, the parent may still revert at a later time, rolling back the changes to this stream object.

The compound file implementation does not support opening streams in transacted mode, so this method has very little effect other than to flush memory buffers.

If the stream is open in direct mode, this method ensures that any memory buffers have been flushed out to the underlying storage object. This is much like a flush in traditional file systems.

The IStream::Commit method is useful on a direct mode stream when the implementation of the IStream interface is a wrapper for underlying file system APIs. In this case, IStream::Commit would be connected to the file system's flush call.

To determine whether the platform supports this interface, see Determining Supported COM APIs.