Interface IWbemWCOSmartEnum

The IWbemWCOSmartEnum interface is intended to allow enumerators access to more efficient object representations during an enumeration.  The IWbemObjectSink marshaling was modified to compress IWbemClassObject instances on sending, by stripping redundant class data, and decompressing data on receipt by mergine IWbemClassObject instances with shared class data via the IWbemObjectInternals interface.   Because the IEnumWbemClassObject is actually controlled by our server, by implementing this interface, the client side can query for this interface and use it as a pass through to another interface.  This is currently used by WINMGMT in conjunction with its IWbemEnumClassObject interface implementation, to perform "smart" enumerations.

This interface is derived from IUnknown and supports its methods.

IWbemWCOSmartEnum Methods Description
Next Returns requested objects in a byte array that must be unmarshaled into an object array.

 


IWbemWCOSmartEnum::Next

The IWbemWCOSmartEnum::Next method returns a byte array that must be unmarshaled by the receiver into an array of objects.  It requires that the client and server understand the format of the byte array so that appropriate marshaling/unmarshaling can occur.

HRESULT Next(
    [in] REFGUID proxyGUID,
    [in] LONG lTimeout,
    [in] ULONG uCount,
    [out] ULONG* puReturned,
    [out] ULONG* pdwBuffSize,
    [out, size_is(,*pdwBuffSize)] byte** pBuffer
    );


Parameters

proxyGUID
GUID that uniquely identifies the caller to the implementor.

lTimeout
Specifies the maximum amount of time in milliseconds that the call will block before returning. If you use the Constant WBEM_INFINITE (-1), the call blocks until objects are available. If you use the value zero (WBEM_NO_WAIT), the call will return immediately, whether any objects are available or not. Negative values other than -1 are invalid.

uCount
The number of requested objects.

puReturned
A pointer to a ULONG that receives the number of objects returned. This number can be less than the number requested in uCount. This pointer cannot be NULL.

pdwBuffSize
A pointer to a ULONG that receives the size of the buffer pointed to by pBuffer.

ppBuffer
A pointer to a byte array.  The implementor allocates the buffer using CoTaskMemAlloc().  The caller must free the buffer using CoTaskMemFree() when finished with the buffer.  The contents of the buffer must be previously agreed upon by the caller and the implementor.

Return Values

WBEM_E_INVALID_PARAMETER One or more invalid parameters were specified in the call.
WBEM_OUT_OF_MEMORY There was not enough memory to complete the enumeration.
WBEM_E_UNEXPECTED An object in the enumeration has been deleted destroying the validity of the enumeration.
WBEM_E_TRANSPORT_FAILURE This indicates the failure of the remote procedure call (RPC) link between the current process and CIMOM.
WBEM_S_NO_ERROR The number of objects returned was the same as the number requested.
WBEM_S_FALSE The number of objects returned was less than the number requested.
WBEM_S_TIMEDOUT A timeout occurred before you obtained all the objects.

Notes

The IEnumWbemClassObject::Next method may return WBEM_S_FALSE even when objects have been returned successfully. WBEM_S_NO_ERROR returns only when the number of objects returned matches the number requested in uCount. Therefore, you should use loop termination logic that examines the puReturned value to ensure you have reached the end of the enumeration.


See Also

IEnumWbemClassObject::Next