wbemprox: Don't crash in IWbemClassObject::Put() when called with empty class object.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40945
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gijs Vermeulen 2020-08-11 12:01:47 +02:00 committed by Alexandre Julliard
parent 11f2057768
commit c3bd08b022
2 changed files with 11 additions and 1 deletions

View File

@ -460,6 +460,9 @@ static HRESULT WINAPI class_object_Put(
if ((hr = get_column_index( co->record->table, wszName, &index )) != S_OK) return hr;
return record_set_value( co->record, index, pVal );
}
if (!ec) return S_OK;
return put_propval( ec->query->view, co->index, wszName, pVal, Type );
}

View File

@ -259,7 +259,7 @@ static void test_Win32_Service( IWbemServices *services )
{
BSTR class = SysAllocString( L"Win32_Service.Name=\"Spooler\"" ), empty = SysAllocString( L"" ), method;
IWbemClassObject *service, *out;
VARIANT state, retval;
VARIANT state, retval, classvar;
CIMTYPE type;
HRESULT hr;
@ -339,6 +339,13 @@ static void test_Win32_Service( IWbemServices *services )
hr = IWbemServices_GetObject( services, NULL, 0, NULL, &service, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( !!service, "expected non-NULL service\n" );
VariantInit(&classvar);
V_VT(&classvar) = VT_BSTR;
V_BSTR(&classvar) = SysAllocString(L"MyClass");
hr = IWbemClassObject_Put(service, L"__CLASS", 0, &classvar, 0);
ok( hr == S_OK, "got %08x\n", hr );
VariantClear(&classvar);
IWbemClassObject_Release( service );
service = NULL;