Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
GetNames method

IWbemClassObject::GetNames method

The IWbemClassObject::GetNames method retrieves the names of the properties in the object. Furthermore, depending on user-supplied selection criteria, it can retrieve all or a subset of the properties. These properties can then be accessed by using IWbemClassObject::Get for each name. This method can also return system properties.

Syntax


HRESULT GetNames(
  [in]  LPCWSTR          wszQualifierName,
  [in]  LONG             lFlags,
  [in]  VARIANT          *pQualifierValue,
  [out] SAFEARRAY (BSTR) **pstrNames
);

Parameters

wszQualifierName [in]

A parameter that can be NULL. If not NULL, it must point to a valid LPCWSTR specifying a qualifier name which operates as part of a filter. This is handled as read-only. For more information, see Remarks.

lFlags [in]

For more information, see Remarks.

pQualifierValue [in]

A parameter that can be NULL. If not NULL, it must point to a valid VARIANT structure initialized to a filter value. This VARIANT is handled as read-only by the method. Thus, the caller must call VariantClear on it, if required. For more information, see Remarks.

pstrNames [out]

A parameter that cannot be NULL, but on entry this parameter must point to NULL. A new SAFEARRAY structure is always allocated, and the pointer is set to point to it. The returned array can have 0 elements, but is always allocated when WBEM_S_NO_ERROR returns. On error, a new SAFEARRAY structure is not returned.

Return value

This method returns an HRESULT indicating the status of the method call. The following table lists the value contained within an HRESULT. For general HRESULT values, see System Error Codes.

Return codeDescription
WBEM_E_FAILED

There has been a general failure.

WBEM_E_INVALID_PARAMETER

One or more parameters were invalid, or an incorrect combination of flags and parameters was specified.

WBEM_E_OUT_OF_MEMORY

There was not enough memory to complete the task.

WBEM_S_NO_ERROR

The call succeeded.

 

Remarks

The names returned are controlled by a combination of flags and parameters. For example, all names of all properties can be specified, or only the key properties can be specified, and so on. The primary filter is specified in the lFlags parameter; the other parameters vary depending upon it.

The flag values are bit fields, and can be combined. One flag from each of the following groups can be combined with a flag from each of the other groups. Flag values within a group are mutually exclusive.

Group 1 flagsDescription
WBEM_FLAG_ALWAYSReturn all property names. The strQualifierName and pQualifierVal parameters are not used.
WBEM_FLAG_ONLY_IF_TRUEReturn only properties that have a qualifier of the name specified by the parameter strQualifierName. If this flag is used, you must specify strQualifierName.
WBEM_FLAG_ONLY_IF_FALSEReturn only properties that do not have a qualifier of the name specified by the parameter strQualifierName. If this flag is used, you must specify strQualifierName.
WBEM_FLAG_ONLY_IF_IDENTICALReturn only properties that have a qualifier of the name specified by the parameter QualifierName, and also have a value identical to the value specified by the VARIANT structure pointed to by pQualifierVal. If this flag is used, you must specify both QualifierName and pQualifierVal.

 

Group 2 flagsDescription
WBEM_FLAG_KEYS_ONLYReturn only the names of the property or properties that define the keys.
WBEM_FLAG_REFS_ONLYReturn only property names that are object references.

 

Group 3 flagsDescription
WBEM_FLAG_LOCAL_ONLYReturn only property names that belong to the derived-most class. Exclude properties from the parent class or parent classes.
WBEM_FLAG_PROPAGATED_ONLYReturn only property names that belong to the parent class or parent classes.
WBEM_FLAG_SYSTEM_ONLYReturn only system properties.
WBEM_FLAG_NONSYSTEM_ONLYReturn only property names that are not system properties.

 

It is not an error for an empty list to be returned in cases where no properties match the specified filters.

For more information about using SAFEARRAY structures of BSTR values, see Retrieving Part of an Instance.

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Header

WbemCli.h (include Wbemidl.h)

IDL

WbemCli.idl

Library

WbemUuid.lib

DLL

CIMWin32.dll;
Esscli.dll;
Evntrprv.dll;
Fastprox.dll;
Framedyn.dll;
Krnlprov.dll;
Ncprov.dll;
Wbemcore.dll;
Wbemess.dll;
Wmipiprt.dll

CLSID

CLSID_WbemClassObject is defined as 9A653086-174F-11d2-B5F9-00104B703EFD

IID

IID_IWbemClassObject is defined as dc12a681-737f-11cf-884d-00aa004b2e24

See also

IWbemClassObject
WMI System Properties
IWbemClassObject::BeginEnumeration
IWbemClassObject::Get
WBEM_CONDITION_FLAG_TYPE

 

 

Show:
© 2015 Microsoft