IWbemServices::CreateInstanceEnum

[This is preliminary documentation and subject to change.]

The IWbemServices::CreateInstanceEnum method creates an enumerator that returns the instances of a specified class according to user-specified selection criteria. This method implements a simple query. More complex queries may require the use of IWbemServices::ExecQuery.

Note that it is not an error for the returned enumerator to have zero elements

HRESULT IWbemServices::CreateInstanceEnum(
  [in] BSTR bstrClass, 
  [in] LONG lFlags, 
  [in] IWbemContext *pCtx, 
  [out] IEnumWbemClassObject **ppEnum 
);
 

Parameters

bstrClass
A valid BSTR containing the name of the class for which instances are desired. This parameter cannot be NULL.
lFlags
WBEM_FLAG_DEEP forces recursive enumeration into all subclasses derived from the specified class. Instances of Class as well as those of its derived classes are returned. WBEM_FLAG_SHALLOW forces the enumeration to include only instances of the specified class.
pCtx
Typically NULL. Otherwise, this is a pointer to an IWbemContext object required by the dynamic class provider that is producing the class instances. The values in the context object must be specified in the documentation for the provider in question.
ppEnum
Receives the pointer to the enumerator, which has a positive reference count. The caller must use Release on the pointer after it is no longer required.

Return Values

WBEM_E_ACCESS_DENIED The current user does not have permission to view instances of the specified class.
WBEM_E_FAILED Other unspecified errors.
WBEM_E_INVALID_CLASS The specified class is invalid.
WBEM_E_INVALID_PARAMETER An invalid parameter was specified, or the namespace could not be parsed.
WBEM_E_OUT_OF_MEMORY There was not enough memory to complete the operation.
WBEM_E_TRANSPORT_FAILURE The communications link between CIMOM and the client has failed.
WBEM_NO_ERROR The call succeeded.

On failure, you can obtain any available information from the COM function GetErrorInfo.

See Also

Error Objects, IWbemServices::CreateInstanceEnumAsync