Windows Dev Center

IWbemClassObject::Clone method

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.

Syntax


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

Parameters

ppCopy [out]

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

A new object is not returned on error.

Return value

This method returns an HRESULT indicating the status of the method call. The following table lists the value contained within an HRESULT. For general HRESULT values, see System Error Codes.

Return codeDescription
WBEM_E_FAILED

There has been a 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_S_NO_ERROR

The call succeeded.

 

Remarks

Use this method 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, use this method to create many new instances from a single source instance. For example, use IWbemClassObject::SpawnInstance to create a single starting instance, and 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.

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Header

WbemCli.h (include Wbemidl.h)

IDL

WbemCli.idl

Library

WbemUuid.lib

DLL

CIMWin32.dll;
Esscli.dll;
Evntrprv.dll;
Fastprox.dll;
Framedyn.dll;
Krnlprov.dll;
Ncprov.dll;
Wbemcore.dll;
Wbemess.dll;
Wmipiprt.dll

CLSID

CLSID_WbemClassObject is defined as 9A653086-174F-11d2-B5F9-00104B703EFD

IID

IID_IWbemClassObject is defined as dc12a681-737f-11cf-884d-00aa004b2e24

 

 

Show:
© 2015 Microsoft