Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/wbemprox/class.c | 12 ++++++++++-- dlls/wbemprox/tests/query.c | 10 ++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c index d24d8cbb5ca..f48c815ef8d 100644 --- a/dlls/wbemprox/class.c +++ b/dlls/wbemprox/class.c @@ -674,13 +674,21 @@ static HRESULT WINAPI class_object_SpawnInstance( struct class_object *co = impl_from_IWbemClassObject( iface ); struct enum_class_object *ec = impl_from_IEnumWbemClassObject( co->iter ); struct table *table = get_view_table( ec->query->view, co->index ); + IEnumWbemClassObject *iter; struct record *record; + HRESULT hr;
TRACE("%p, %08x, %p\n", iface, lFlags, ppNewInstance);
if (!(record = create_record( table ))) return E_OUTOFMEMORY; - - return create_class_object( co->name, NULL, 0, record, ppNewInstance ); + if (FAILED(hr = IEnumWbemClassObject_Clone( co->iter, &iter ))) + { + destroy_record( record ); + return hr; + } + hr = create_class_object( co->name, iter, 0, record, ppNewInstance ); + IEnumWbemClassObject_Release( iter ); + return hr; }
static HRESULT WINAPI class_object_CompareTo( diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index b5de00b5dec..f650418e51f 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -753,6 +753,16 @@ static void test_StdRegProv( IWbemServices *services ) hr = IWbemClassObject_SpawnInstance( sig_in, 0, &in ); ok( hr == S_OK, "failed to spawn instance %08x\n", hr );
+ hr = IWbemClassObject_BeginEnumeration( in, 0 ); + ok( hr == S_OK, "failed to start enumeration %08x\n", hr ); + + hr = IWbemClassObject_Next( in, 0, &name, NULL, NULL, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + SysFreeString( name ); + + hr = IWbemClassObject_EndEnumeration( in ); + ok( hr == S_OK, "failed to end enumeration %08x\n", hr ); + V_VT( &defkey ) = VT_I4; V_I4( &defkey ) = 0x80000001; hr = IWbemClassObject_Put( in, L"hDefKey", 0, &defkey, 0 );