Compartir a través de


3.1.4.4.4 IEnumWbemClassObject::Clone (Opnum 6)

The IEnumWbemClassObject::Clone method makes a logical copy of the entire enumerator. The cloned enumerator MUST have the same current position as the source enumerator.

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

ppEnum: Upon return, MUST contain a pointer to an IEnumWbemClassObject interface CIM object that is a logical copy of the entire enumerator that made the Clone method call, retaining the current position in an enumeration. This parameter MUST NOT be NULL. When returned by the server, this parameter can be NULL if a failure occurred or if there are no results.

Return Values: This method MUST return an HRESULT value that MUST indicate the status of the method call. The server MUST return WBEM_S_NO_ERROR (specified in section 2.2.11) to indicate the successful completion of the method.

WBEM_S_NO_ERROR (0x00)

The server MUST locate the entry in EnumWbemClassObjectTable with EnumWbemClassObjectPointer matching the IEnumWbemClassObject.

The server MUST validate that the security principal that makes the call is the same as the ClientSecurityContext of the SemiSinkResultSetObject pointed to by the entry in EnumWbemClassObjectTable; otherwise, WBEM_E_ACCESS_DENIED MUST be returned.

If the earlier semisynchronous operation is created by using WBEM_FLAG_FORWARD_ONLY, then IEnumWbemClassObject::Clone is not supported and the server MUST return WBEM_E_INVALID_OPERATION.

The server MUST serialize execution of IEnumWbemClassObject::Next call, asynchronous callbacks related to IEnumWbemClassObject::NextAsync call, IEnumWbemClassObject::Reset call, and IEnumWbemClassObject::Clone call.

As part of IEnumWbemClassObject::Clone, the server MUST create a new IEnumWbemClassObject enumerator as follows. Create a new entry in the EnumWbemClassObjectTable and store a reference to the newly created enumerator in EnumWbemClassObjectPointer. The new entry in EnumWbemClassObjectTable will copy the current pointer index value from the earlier enumerator. The new entry ResultSetPointer will point to SemiSinkResultSetObject that was created as part of an earlier semisynchronous operation and increment the RefCount of SemiSinkResultSetObject by one.

The successful method execution MUST fill the ppEnum parameter with an IEnumWbemClassObject interface pointer, as specified in section 3.1.4.4, which MUST be a copy of the source enumerator that retains the current position in an enumeration. The method MUST return WBEM_S_NO_ERROR.

If the original semisynchronous operation fails, the server MUST return the error code that the original method would have returned in its synchronous version.

The failed method execution MUST return an error in the format that is specified in section 2.2.11.