Hans Leidekker : wbemprox: Make name and value optional in IWbemClassObject::Next.
Alexandre Julliard
julliard at winehq.org
Tue Oct 9 16:22:47 CDT 2018
Module: wine
Branch: master
Commit: 492a9653f5e297bdc49d66c31435eb17f958868d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=492a9653f5e297bdc49d66c31435eb17f958868d
Author: Hans Leidekker <hans at codeweavers.com>
Date: Tue Oct 9 15:25:03 2018 +0200
wbemprox: Make name and value optional in IWbemClassObject::Next.
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wbemprox/class.c | 5 +++-
dlls/wbemprox/query.c | 61 ++++++++++++++++++++++++++++++++-------------
dlls/wbemprox/tests/query.c | 2 ++
3 files changed, 49 insertions(+), 19 deletions(-)
diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c
index 3f299ea..cc54fd5 100644
--- a/dlls/wbemprox/class.c
+++ b/dlls/wbemprox/class.c
@@ -532,8 +532,11 @@ static HRESULT WINAPI class_object_Next(
SysFreeString( prop );
return hr;
}
+
obj->index_property = i + 1;
- *strName = prop;
+ if (strName) *strName = prop;
+ else SysFreeString( prop );
+
return S_OK;
}
return WBEM_S_NO_MORE_DATA;
diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c
index 8a51266..d193574 100644
--- a/dlls/wbemprox/query.c
+++ b/dlls/wbemprox/query.c
@@ -668,50 +668,71 @@ static HRESULT get_system_propval( const struct view *view, UINT index, const WC
if (!strcmpiW( name, classW ))
{
- V_VT( ret ) = VT_BSTR;
- V_BSTR( ret ) = build_classname( view );
+ if (ret)
+ {
+ V_VT( ret ) = VT_BSTR;
+ V_BSTR( ret ) = build_classname( view );
+ }
if (type) *type = CIM_STRING;
return S_OK;
}
if (!strcmpiW( name, genusW ))
{
- V_VT( ret ) = VT_I4;
- V_I4( ret ) = WBEM_GENUS_INSTANCE; /* FIXME */
+ if (ret)
+ {
+ V_VT( ret ) = VT_I4;
+ V_I4( ret ) = WBEM_GENUS_INSTANCE; /* FIXME */
+ }
if (type) *type = CIM_SINT32;
return S_OK;
}
else if (!strcmpiW( name, namespaceW ))
{
- V_VT( ret ) = VT_BSTR;
- V_BSTR( ret ) = build_namespace( view );
+ if (ret)
+ {
+ V_VT( ret ) = VT_BSTR;
+ V_BSTR( ret ) = build_namespace( view );
+ }
if (type) *type = CIM_STRING;
return S_OK;
}
else if (!strcmpiW( name, pathW ))
{
- V_VT( ret ) = VT_BSTR;
- V_BSTR( ret ) = build_path( view, index, name );
+ if (ret)
+ {
+ V_VT( ret ) = VT_BSTR;
+ V_BSTR( ret ) = build_path( view, index, name );
+ }
if (type) *type = CIM_STRING;
return S_OK;
}
if (!strcmpiW( name, propcountW ))
{
- V_VT( ret ) = VT_I4;
- V_I4( ret ) = count_selected_properties( view );
+ if (ret)
+ {
+ V_VT( ret ) = VT_I4;
+ V_I4( ret ) = count_selected_properties( view );
+ }
if (type) *type = CIM_SINT32;
return S_OK;
}
else if (!strcmpiW( name, relpathW ))
{
- V_VT( ret ) = VT_BSTR;
- V_BSTR( ret ) = build_relpath( view, index, name );
+ if (ret)
+ {
+ V_VT( ret ) = VT_BSTR;
+ V_BSTR( ret ) = build_relpath( view, index, name );
+ }
if (type) *type = CIM_STRING;
return S_OK;
}
else if (!strcmpiW( name, serverW ))
{
- V_VT( ret ) = VT_BSTR;
- V_BSTR( ret ) = build_servername( view );
+ if (ret)
+ {
+ V_VT( ret ) = VT_BSTR;
+ V_BSTR( ret ) = build_servername( view );
+ }
if (type) *type = CIM_STRING;
return S_OK;
}
@@ -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 );
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;
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
val_ptr = to_safearray( (const struct array *)(INT_PTR)val, basetype );
if (!val_ptr) vartype = VT_NULL;
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)
{
case CIM_BOOLEAN:
@@ -891,10 +919,7 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR
return WBEM_E_FAILED;
}
-done:
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;
}
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index b2f5d68..387952d 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -1194,6 +1194,8 @@ static void test_Win32_OperatingSystem( IWbemServices *services )
hr = IWbemClassObject_BeginEnumeration( obj, 0 );
ok( hr == S_OK, "got %08x\n", hr );
+ while (IWbemClassObject_Next( obj, 0, NULL, NULL, NULL, NULL ) == S_OK) {}
+
hr = IWbemClassObject_EndEnumeration( obj );
ok( hr == S_OK, "got %08x\n", hr );
More information about the wine-cvs
mailing list