Commit 492a9653 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wbemprox: Make name and value optional in IWbemClassObject::Next.

parent a9c6ff23
...@@ -532,8 +532,11 @@ static HRESULT WINAPI class_object_Next( ...@@ -532,8 +532,11 @@ static HRESULT WINAPI class_object_Next(
SysFreeString( prop ); SysFreeString( prop );
return hr; return hr;
} }
obj->index_property = i + 1; obj->index_property = i + 1;
*strName = prop; if (strName) *strName = prop;
else SysFreeString( prop );
return S_OK; return S_OK;
} }
return WBEM_S_NO_MORE_DATA; return WBEM_S_NO_MORE_DATA;
......
...@@ -668,50 +668,71 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC ...@@ -668,50 +668,71 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC
if (!strcmpiW( name, classW )) if (!strcmpiW( name, classW ))
{ {
V_VT( ret ) = VT_BSTR; if (ret)
V_BSTR( ret ) = build_classname( view ); {
V_VT( ret ) = VT_BSTR;
V_BSTR( ret ) = build_classname( view );
}
if (type) *type = CIM_STRING; if (type) *type = CIM_STRING;
return S_OK; return S_OK;
} }
if (!strcmpiW( name, genusW )) if (!strcmpiW( name, genusW ))
{ {
V_VT( ret ) = VT_I4; if (ret)
V_I4( ret ) = WBEM_GENUS_INSTANCE; /* FIXME */ {
V_VT( ret ) = VT_I4;
V_I4( ret ) = WBEM_GENUS_INSTANCE; /* FIXME */
}
if (type) *type = CIM_SINT32; if (type) *type = CIM_SINT32;
return S_OK; return S_OK;
} }
else if (!strcmpiW( name, namespaceW )) else if (!strcmpiW( name, namespaceW ))
{ {
V_VT( ret ) = VT_BSTR; if (ret)
V_BSTR( ret ) = build_namespace( view ); {
V_VT( ret ) = VT_BSTR;
V_BSTR( ret ) = build_namespace( view );
}
if (type) *type = CIM_STRING; if (type) *type = CIM_STRING;
return S_OK; return S_OK;
} }
else if (!strcmpiW( name, pathW )) else if (!strcmpiW( name, pathW ))
{ {
V_VT( ret ) = VT_BSTR; if (ret)
V_BSTR( ret ) = build_path( view, index, name ); {
V_VT( ret ) = VT_BSTR;
V_BSTR( ret ) = build_path( view, index, name );
}
if (type) *type = CIM_STRING; if (type) *type = CIM_STRING;
return S_OK; return S_OK;
} }
if (!strcmpiW( name, propcountW )) if (!strcmpiW( name, propcountW ))
{ {
V_VT( ret ) = VT_I4; if (ret)
V_I4( ret ) = count_selected_properties( view ); {
V_VT( ret ) = VT_I4;
V_I4( ret ) = count_selected_properties( view );
}
if (type) *type = CIM_SINT32; if (type) *type = CIM_SINT32;
return S_OK; return S_OK;
} }
else if (!strcmpiW( name, relpathW )) else if (!strcmpiW( name, relpathW ))
{ {
V_VT( ret ) = VT_BSTR; if (ret)
V_BSTR( ret ) = build_relpath( view, index, name ); {
V_VT( ret ) = VT_BSTR;
V_BSTR( ret ) = build_relpath( view, index, name );
}
if (type) *type = CIM_STRING; if (type) *type = CIM_STRING;
return S_OK; return S_OK;
} }
else if (!strcmpiW( name, serverW )) else if (!strcmpiW( name, serverW ))
{ {
V_VT( ret ) = VT_BSTR; if (ret)
V_BSTR( ret ) = build_servername( view ); {
V_VT( ret ) = VT_BSTR;
V_BSTR( ret ) = build_servername( view );
}
if (type) *type = CIM_STRING; if (type) *type = CIM_STRING;
return S_OK; return S_OK;
} }
...@@ -835,6 +856,11 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR ...@@ -835,6 +856,11 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR
hr = get_value( view->table, row, column, &val ); hr = get_value( view->table, row, column, &val );
if (hr != S_OK) return hr; if (hr != S_OK) return hr;
if (type) *type = view->table->columns[column].type & COL_TYPE_MASK;
if (flavor) *flavor = 0;
if (!ret) return S_OK;
vartype = view->table->columns[column].vartype; vartype = view->table->columns[column].vartype;
if (view->table->columns[column].type & CIM_FLAG_ARRAY) if (view->table->columns[column].type & CIM_FLAG_ARRAY)
{ {
...@@ -843,8 +869,10 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR ...@@ -843,8 +869,10 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR
val_ptr = to_safearray( (const struct array *)(INT_PTR)val, basetype ); val_ptr = to_safearray( (const struct array *)(INT_PTR)val, basetype );
if (!val_ptr) vartype = VT_NULL; if (!val_ptr) vartype = VT_NULL;
else if (!vartype) vartype = to_vartype( basetype ) | VT_ARRAY; else if (!vartype) vartype = to_vartype( basetype ) | VT_ARRAY;
goto done; set_variant( vartype, val, val_ptr, ret );
return S_OK;
} }
switch (view->table->columns[column].type & COL_TYPE_MASK) switch (view->table->columns[column].type & COL_TYPE_MASK)
{ {
case CIM_BOOLEAN: case CIM_BOOLEAN:
...@@ -891,10 +919,7 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR ...@@ -891,10 +919,7 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR
return WBEM_E_FAILED; return WBEM_E_FAILED;
} }
done:
set_variant( vartype, val, val_ptr, ret ); set_variant( vartype, val, val_ptr, ret );
if (type) *type = view->table->columns[column].type & COL_TYPE_MASK;
if (flavor) *flavor = 0;
return S_OK; return S_OK;
} }
......
...@@ -1194,6 +1194,8 @@ static void test_Win32_OperatingSystem( IWbemServices *services ) ...@@ -1194,6 +1194,8 @@ static void test_Win32_OperatingSystem( IWbemServices *services )
hr = IWbemClassObject_BeginEnumeration( obj, 0 ); hr = IWbemClassObject_BeginEnumeration( obj, 0 );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
while (IWbemClassObject_Next( obj, 0, NULL, NULL, NULL, NULL ) == S_OK) {}
hr = IWbemClassObject_EndEnumeration( obj ); hr = IWbemClassObject_EndEnumeration( obj );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
......
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