Commit 434e94a6 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wbemprox: Implement IWbemQualifierSet::GetNames.

parent 8e2e8974
......@@ -101,19 +101,32 @@ static HRESULT create_qualifier_enum( const WCHAR *class, const WCHAR *member, c
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','_','_','Q','U','A','L',
'I','F','I','E','R','S',' ','W','H','E','R','E',' ','C','l','a','s','s','=',
'\'','%','s','\'',' ','A','N','D',' ','M','e','m','b','e','r','=','\'','%','s','\'',0};
static const WCHAR noneW[] = {'_','_','N','O','N','E',0};
static const WCHAR fmt3W[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','_','_','Q','U','A','L',
'I','F','I','E','R','S',' ','W','H','E','R','E',' ','C','l','a','s','s','=',
'\'','%','s','\'',0};
WCHAR *query;
HRESULT hr;
int len;
if (!member) member = noneW;
len = lstrlenW( class ) + lstrlenW( member );
if (name) len += lstrlenW( name ) + ARRAY_SIZE(fmtW);
else len += ARRAY_SIZE(fmt2W);
if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
if (name) swprintf( query, len, fmtW, class, member, name );
else swprintf( query, len, fmt2W, class, member );
if (member && name)
{
len = lstrlenW( class ) + lstrlenW( member ) + lstrlenW( name ) + ARRAY_SIZE(fmtW);
if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
swprintf( query, len, fmtW, class, member, name );
}
else if (member)
{
len = lstrlenW( class ) + lstrlenW( member ) + ARRAY_SIZE(fmt2W);
if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
swprintf( query, len, fmt2W, class, member );
}
else
{
len = lstrlenW( class ) + ARRAY_SIZE(fmt3W);
if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
swprintf( query, len, fmt3W, class );
}
hr = exec_query( query, iter );
heap_free( query );
......@@ -123,7 +136,6 @@ static HRESULT create_qualifier_enum( const WCHAR *class, const WCHAR *member, c
static HRESULT get_qualifier_value( const WCHAR *class, const WCHAR *member, const WCHAR *name,
VARIANT *val, LONG *flavor )
{
static const WCHAR qualifiersW[] = {'_','_','Q','U','A','L','I','F','I','E','R','S',0};
static const WCHAR intvalueW[] = {'I','n','t','e','g','e','r','V','a','l','u','e',0};
static const WCHAR strvalueW[] = {'S','t','r','i','n','g','V','a','l','u','e',0};
static const WCHAR boolvalueW[] = {'B','o','o','l','V','a','l','u','e',0};
......@@ -137,7 +149,7 @@ static HRESULT get_qualifier_value( const WCHAR *class, const WCHAR *member, con
hr = create_qualifier_enum( class, member, name, &iter );
if (FAILED( hr )) return hr;
hr = create_class_object( qualifiersW, iter, 0, NULL, &obj );
hr = create_class_object( NULL, iter, 0, NULL, &obj );
IEnumWbemClassObject_Release( iter );
if (FAILED( hr )) return hr;
......@@ -179,7 +191,12 @@ static HRESULT WINAPI qualifier_set_Get(
{
struct qualifier_set *set = impl_from_IWbemQualifierSet( iface );
FIXME("%p, %s, %08x, %p, %p\n", iface, debugstr_w(wszName), lFlags, pVal, plFlavor);
TRACE("%p, %s, %08x, %p, %p\n", iface, debugstr_w(wszName), lFlags, pVal, plFlavor);
if (lFlags)
{
FIXME("flags %08x not supported\n", lFlags);
return E_NOTIMPL;
}
return get_qualifier_value( set->class, set->member, wszName, pVal, plFlavor );
}
......@@ -206,8 +223,28 @@ static HRESULT WINAPI qualifier_set_GetNames(
LONG lFlags,
SAFEARRAY **pNames )
{
FIXME("%p, %08x, %p\n", iface, lFlags, pNames);
return E_NOTIMPL;
struct qualifier_set *set = impl_from_IWbemQualifierSet( iface );
IEnumWbemClassObject *iter;
IWbemClassObject *obj;
HRESULT hr;
TRACE("%p, %08x, %p\n", iface, lFlags, pNames);
if (lFlags)
{
FIXME("flags %08x not supported\n", lFlags);
return E_NOTIMPL;
}
hr = create_qualifier_enum( set->class, set->member, NULL, &iter );
if (FAILED( hr )) return hr;
hr = create_class_object( NULL, iter, 0, NULL, &obj );
IEnumWbemClassObject_Release( iter );
if (FAILED( hr )) return hr;
hr = IWbemClassObject_GetNames( obj, NULL, 0, NULL, pNames );
IWbemClassObject_Release( obj );
return hr;
}
static HRESULT WINAPI qualifier_set_BeginEnumeration(
......
......@@ -46,6 +46,8 @@ static HRESULT exec_query( IWbemServices *services, const WCHAR *str, IEnumWbemC
for (;;)
{
VARIANT var;
IWbemQualifierSet *qualifiers;
SAFEARRAY *names;
IEnumWbemClassObject_Next( *result, 10000, 1, &obj, &count );
if (!count) break;
......@@ -60,6 +62,15 @@ static HRESULT exec_query( IWbemServices *services, const WCHAR *str, IEnumWbemC
trace("description: %s\n", wine_dbgstr_w(V_BSTR(&var)));
VariantClear( &var );
}
hr = IWbemClassObject_GetQualifierSet( obj, &qualifiers );
ok( hr == S_OK, "got %08x\n", hr );
hr = IWbemQualifierSet_GetNames( qualifiers, 0, &names );
ok( hr == S_OK, "got %08x\n", hr );
SafeArrayDestroy( names );
IWbemQualifierSet_Release( qualifiers );
IWbemClassObject_Release( obj );
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment