IWbemClassObject::Clone

[This is preliminary documentation and subject to change.]

The IWbemClassObject::Clone method returns a new object that is a complete clone of the current object. The new object has a COM reference count of 1.

HRESULT IWbemClassObject::Clone(
  [out] IWbemClassObject **ppCopy
);
 

Parameters

ppCopy
This parameter cannot be NULL. It receives the copy of the current object. The caller must call IWbemClassObject::Release on the returned object when it is no longer required.

A new object is not returned on error.

Return Values

WBEM_E_FAILED General failure.
WBEM_E_INVALID_PARAMETER NULL was specified as a parameter, and it is not legal in this usage.
WBEM_E_OUT_OF_MEMORY There was not enough memory to clone the object.
WBEM_NO_ERROR Success.

Remarks

This method is used to duplicate a class definition, or to duplicate an instance. This can be useful when the original copy of the object is required for backup purposes while a new copy is modified. Likewise, this method can be used to create many new instances from a single source instance. For example, you can use IWbemClassObject::SpawnInstance to create a single starting instance, and you can use IWbemClassObject::Clone to produce 100 copies of the instance quickly. Each object can be modified subsequently to take on its particular values.

It is not possible to use this method to convert a class definition into an instance, or convert an instance into a class definition.