IStorage::CopyTo

Copies the entire contents of this open storage object into another storage object.

HRESULT CopyTo(

DWORD ciidExclude,
//Number of elements in rgiidExclude
IID const * rgiidExclude,
//Array of interface identifiers (IIDs)
SNB snbExclude,
//Points to a block of stream names in the storage object
IStorage * pstgDest
//Points to destination storage object
);

Parameters

ciidExclude

[in]The number of elements in the array pointed to by rgiidExclude. If rgiidExclude is NULL, then ciidExclude is ignored.

rgiidExclude

[in]Specifies an array of interface identifiers the caller takes responsibility for copying from the source to the destination. This array can include interfaces that this storage object does not support. It can be NULL, indicating that all other interfaces are to be copied. If non-NULL, an array length of zero indicates that no other interfaces are to be copied, only the state exposed by the IStorage object.

snbExclude

[in]Specifies a block of elements in this storage object that are not to be copied to the destination. These elements are not created in the destination. If IID_IStorage is in the rgiidExclude array, then this parameter is ignored. This parameter may be NULL.

pstgDest

[in]Points to the open storage object into which this storage object is to be copied. The destination storage object can be a different implementation of the IStorage interface from the source storage object. Thus, IStorage::CopyTo can only use publicly available methods of the destination storage object. If pstgDest is open in transacted mode, it can be reverted by calling its IStorage::Revert method.

Return Values

S_OK

The storage object was successfully copied.

STG_S_DESTLACKSINTERFACE

The destination lacks an interface that the source requested to be copied. The lack of an interface does not prevent other parts of the copy operation to be successfully completed.

STG_E_ACCESSDENIED

The destination storage object is a child of the source storage object.

STG_E_INSUFFICIENTMEMORY

The copy was not completed due to a lack of memory.

STG_E_INVALIDPOINTER

The pointer specified for the storage object was invalid.

STG_E_INVALIDPARAMETER

One of the parameters was invalid.

STG_E_TOOMANYOPENFILES

The copy was not completed because there are too many open files.

STG_E_MEDIUMFULL

The copy was not completed because the storage medium is full.

Comments

This method merges elements contained in the source storage object with those already present in the destination. The layout of the destination storage object may differ from the source storage object.

The copy process is recursive, invoking IStorage::CopyTo and IStream::CopyTo on the elements nested inside the source.

If an attempt is made to copy a stream on top of an existing stream with the same name, the existing destination stream is first removed and then replaced with the source stream. Attempting to copy a source storage object on top of an existing destination storage object does not remove the existing storage. Thus, after the copy operation, the destination IStorage contains older elements if they were not replaced by newer ones.

Note to Callers

The following example illustrates using the CopyTo method to copy everything possible from the source to the destination:

pstg->CopyTo(0, Null, Null, pstgDest)

This is the most commonly used form of this operation, used in most Full Save and SaveAs scenarios.

See Also

IStorage::MoveElementTo, IStorage::Revert

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database