Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

IWbemServices::CreateClassEnum method

The IWbemServices::CreateClassEnum method returns an enumerator for all classes that satisfy selection criteria. The caller must use the returned enumerator to retrieve the class definitions, calling IEnumWbemClassObject::Next to obtain each class or blocks of classes. It finishes by calling IEnumWbemClassObject::Release.

Note  It is not an error for the returned enumerator to have 0 (zero) elements.

Syntax


HRESULT CreateClassEnum(
  [in]   const BSTR strSuperclass,
  [in]   LONG lFlags,
  [in]   IWbemContext *pCtx,
  [out]  IEnumWbemClassObject **ppEnum
);

Parameters

strSuperclass [in]

If not NULL or blank, specifies a parent class name. Only classes that are subclasses of this class are returned in the enumerator. If it is NULL or blank, and lFlags is WBEM_FLAG_SHALLOW, only the top-level classes are returned (that is, classes that have no parent class). If it is NULL or blank and lFlags is WBEM_FLAG_DEEP, all classes within the namespace are returned.

lFlags [in]

The following flags affect the behavior of this method. The suggested value for this parameter is WBEM_FLAG_RETURN_IMMEDIATELY and WBEM_FLAG_FORWARD_ONLY for best performance.

FlagMeaning
WBEM_FLAG_USE_AMENDED_QUALIFIERS

If this flag is set, WMI retrieves the amended qualifiers stored in the localized namespace of the current connection's locale. If not set, only the qualifiers stored in the immediate namespace are retrieved.

WBEM_FLAG_DEEP

This flag forces the enumeration to include all subclasses in the hierarchy, but not this class.

WBEM_FLAG_SHALLOW

This flag forces the enumeration to include only pure instances of this class, excluding all instances of subclasses that supply properties not found in this class.

WBEM_FLAG_RETURN_IMMEDIATELY

This flag causes a semisynchronous call. For more information, see Calling a Method.

WBEM_FLAG_FORWARD_ONLY

This flag causes a forward-only enumerator to be returned. Typically, forward-only enumerators are faster and use less memory than conventional enumerators, but they do not allow calls to Clone or Reset.

WBEM_FLAG_BIDIRECTIONAL

This flag causes WMI to retain pointers to objects of the enumeration until the client releases the enumerator. Because object pointers are not released immediately, this method may fail with an HRESULT of WBEM_E_OUT_OF_MEMORY if the client attempts to enumerate a large number of objects. This flag is implied by default if you set the lFlags parameter to 0 (zero).

 

pCtx [in]

Typically NULL. Otherwise, this is a pointer to an IWbemContext object that can be used by the provider that is providing the requested classes. The values in the context object must be specified in the documentation for the provider. For more information about this parameter, see Making Calls to WMI.

ppEnum [out]

Receives the pointer to the enumerator. The returned object has a positive reference count. The caller must call Release on the pointer when it is no longer required.

Return value

This method returns an HRESULT that indicates the status of a method call. The following table lists the value contained within an HRESULT.

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

COM-specific error codes also can be returned if network problems cause you to lose the remote connection to Windows Management.

Return codeDescription
WBEM_E_ACCESS_DENIED

The current user does not have permission to view one or more of the classes that a call can return.

WBEM_E_FAILED

This indicates other unspecified errors.

WBEM_E_INVALID_CLASS

The specified class does not exist.

WBEM_E_INVALID_PARAMETER

A specified parameter is not valid.

WBEM_E_OUT_OF_MEMORY

There is not enough memory to complete the operation.

WBEM_E_SHUTTING_DOWN

WMI was probably stopped and restarted. A new call to ConnectServer is needed.

WBEM_E_TRANSPORT_FAILURE

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

WBEM_S_NO_ERROR

The call succeeded.

 

Examples

For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.

For C++ code examples, see WMI C++ Application Examples.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Header

Wbemcli.h (include Wbemidl.h)

Library

Wbemuuid.lib

DLL

Fastprox.dll;
Esscli.dll;
Framedyn.dll;
Ntevt.dll;
Stdprov.dll;
Viewprov.dll;
Wbemcomn.dll;
Wbemcore.dll;
Wbemess.dll;
Wbemsvc.dll;
Wmipicmp.dll;
Wmidcprv.dll;
Wmipjobj.dll;
Wmiprvsd.dll

See also

IWbemServices
Retrieving an Error Code
IEnumWbemClassObject
IWbemServices::CreateClassEnumAsync

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.