Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

IEnumWbemClassObject::Clone method

The IEnumWbemClassObject::Clone method makes a logical copy of the entire enumerator, retaining its current position in an enumeration. This method makes only a "best effort" copy. Due to the dynamic nature of many CIM objects, it is possible that the new enumerator does not enumerate the same set of objects as the source enumerator.

Note  When the enumeration is initialized with the WBEM_FLAG_FORWARD_ONLY flag, IEnumWbemClassObject::Clone is not supported.

Any pending asynchronous deliveries begun by NextAsync are not cloned.

Syntax


HRESULT Clone(
  [out] IEnumWbemClassObject **ppEnum
);

Parameters

ppEnum [out]

Receives a pointer to a new IEnumWbemClassObject object. The caller must call Release when the interface pointer is no longer required. On error, there will not be a return of a new object.

Return value

This method returns an HRESULT indicating the status of the method call.

On error, you can call the COM function GetErrorInfo to obtain more error information. COM-specific error codes may also be returned if network problems cause you to lose the remote connection to Windows Management.

The following table lists the value contained within an HRESULT.

Return codeDescription
WBEM_E_FAILED

An unspecified error occurred.

WBEM_E_INVALID_PARAMETER

The caller passed an invalid parameter.

WBEM_E_OUT_OF_MEMORY

There was not enough memory to complete the operation.

WBEM_E_TRANSPORT_FAILURE

This indicates the failure of the remote procedure call (RPC) link between the current process and Windows Management.

WBEM_S_NO_ERROR

The call succeeds and the current position was updated.

 

Remarks

Because the call-back to the sink might not be returned at the same authentication level as the client requires, it is recommended that you use semisynchronous communication instead of asynchronous. If you require asynchronous communication, see Calling a Method.

For more information about using methods semisynchronously, see IEnumWbemClassObject and Calling a Method.

Examples

The following code shows how to use the IEnumWbemClassObject::Clone method.


BOOL CloneEnum(IEnumWbemClassObject *pSrc)
{
    IEnumWbemClassObject *pCopy = 0;

    HRESULT hRes = pSrc->Clone(&pCopy);

    if (hRes != WBEM_S_NO_ERROR)       // Failed to clone it.
        return FALSE;

    // Use the copy of the enumerator.
    // ...

    pCopy->Release();

    return TRUE;
}

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Header

Wbemcli.h (include Wbemidl.h)

Library

Wbemuuid.lib

DLL

Fastprox.dll

 

 

Show:
© 2015 Microsoft