[This is preliminary documentation and subject to change.]
The IWbemContext::Next method
HRESULT Next(
[in] LONG lFlags,
[out] BSTR *pbstrName,
[out] VARIANT *pValue
);
The caller must call SysFreeString on the returned string when it is no longer required. If WBEM_S_NO_MORE_DATA is returned, pbstrName is set to point to NULL, in which case SysFreeString should not be called.
Note If pbstrName points to a valid BSTR on entry, this BSTR is not freed, and a memory leak will occur.
If WBEM_S_NO_MORE_DATA is returned, this parameter is set to point to a VARIANT of type VT_NULL.
It is possible that an entire IWbemClassObject is returned inside the VARIANT. If that is the case, then VT_DISPATCH is the VARIANT type. The caller can take the IDispatch pointer and execute QueryInterface to obtain the IWbemClassObject pointer.
Note At the end of the enumeration, WBEM_S_NO_MORE_DATA is returned. The returned VARIANT is of type VT_NULL, and the returned pbstrName is NULL.
WBEM_E_INVALID_PARAMETER | An invalid parameter was specified, or the namespace could not be parsed. |
WBEM_E_UNEXPECTED | Caller did not call IWbemContext::BeginEnumeration. |
WBEM_NO_ERROR | Success. |
WBEM_S_NO_MORE_DATA | No more properties are left in the enumeration. |
WBEM_E_OUT_OF_MEMORY | There was not enough memory to complete the call. |
IWbemContext::BeginEnumeration, IWbemContext::EndEnumeration