CFrameworkQuery::GetValuesForProp(LPCWSTR,std.vector<_bstr_t>&) method (frquery.h)

[The CFrameworkQuery class is part of the WMI Provider Framework which is now considered in final state, and no further development, enhancements, or updates will be available for non-security related issues affecting these libraries. The MI APIs should be used for all new development.]

The GetValuesForProp method returns all of the values for a particular property that are generated by that property as it appears within the query.

For example, a call to GetValuesForProp(L"Name", sa) returns the array sa, which contains all the values of "Name" that require instances to be sent back to satisfy the query. If sa contains {"a","b"}, then all the instances where "Name=a" plus all the instances where "Name=b" must be sent back to completely satisfy the query.

If the constraints on "Name" are not sufficiently limiting, an empty sa array is returned.

Syntax

HRESULT GetValuesForProp(
  LPCWSTR               wszPropName,
  std::vector<_bstr_t>& vectorNames
);

Parameters

wszPropName

Name of the target property.

vectorNames

Array of values for the property specified by wszPropName.

Return value

This method returns WBEM_S_NO_ERROR on success, and WBEM_E_FAILED, or any other HRESULT error code, on failure.

Remarks

Given a property name, this method returns all of the result values in a CHStringArray or vector container. The vector container holds _bstr_t objects that contain the result values.

For example, the following list lists the values that would be returned by GetValuesForProp for a variety of queries when called with wszPropName set to "Drive".

Query Return value Result
SELECT * FROM Win32_Directory

WHERE Drive = "C:"

WBEM_S_NO_ERROR C:
SELECT * FROM Win32_Directory

WHERE Drive = "C:" OR FileSize = 256

WBEM_S_NO_ERROR No results; aszNames is empty.
SELECT * FROM Win32_Directory

WHERE Drive = "C:" OR Drive = "D:"

WBEM_S_NO_ERROR C:, D:
SELECT * FROM Win32_Directory

WHERE Drive <> "C:"

WBEM_S_NO_ERROR No results; aszNames is empty.
SELECT * FROM Win32_Directory

WHERE Path = "\DOS"

WBEM_S_NO_ERROR No results; aszNames is empty.
 

The GetValuesForProp method only supports string types.

The following query, followed by a call to GetValuesForProp("PropInt", values), returns WBEM_E_INVALID_QUERY while GetValuesForProp("PropStr", values) returns S_OK.

SELECT * FROM Test WHERE PropInt = 32 AND PropStr = "a"

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header frquery.h (include FwCommon.h)
Library FrameDyn.lib
DLL FrameDynOS.dll; FrameDyn.dll

See also

CFrameworkQuery

Provider::ExecQuery