[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
);
A new object is not returned on error.
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. |
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.