Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- dlls/wbemprox/services.c | 6 +++++- dlls/wbemprox/tests/query.c | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/dlls/wbemprox/services.c b/dlls/wbemprox/services.c index c0e535b3a1..3a0963e1f6 100644 --- a/dlls/wbemprox/services.c +++ b/dlls/wbemprox/services.c @@ -463,7 +463,11 @@ HRESULT get_object( const WCHAR *object_path, IWbemClassObject **obj ) return hr; } hr = IEnumWbemClassObject_Next( iter, WBEM_INFINITE, 1, obj, &count ); - if (hr == WBEM_S_FALSE) hr = WBEM_E_NOT_FOUND; + if (hr == WBEM_S_FALSE) + { + hr = WBEM_E_NOT_FOUND; + *obj = NULL; + } IEnumWbemClassObject_Release( iter ); free_path( path ); return hr; diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index d6c918c08d..df0c26aa97 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -338,19 +338,23 @@ static void test_Win32_Service( IWbemServices *services ) service = NULL; hr = IWbemServices_GetObject( services, NULL, 0, NULL, &service, NULL ); ok( hr == S_OK, "got %08x\n", hr ); - if (service) IWbemClassObject_Release( service ); + ok( !!service, "expected non-NULL service\n" ); + IWbemClassObject_Release( service );
service = NULL; hr = IWbemServices_GetObject( services, empty, 0, NULL, &service, NULL ); ok( hr == S_OK, "got %08x\n", hr ); - if (service) IWbemClassObject_Release( service ); + ok( !!service, "expected non-NULL service\n" ); + IWbemClassObject_Release( service );
SysFreeString( empty ); SysFreeString( class );
class = SysAllocString( L"Win32_Service.Name="nonexistent"" ); + service = (IWbemClassObject *)0xdeadbeef; hr = IWbemServices_GetObject( services, class, 0, NULL, &service, NULL ); ok( hr == WBEM_E_NOT_FOUND, "got %#08x\n", hr ); + ok( service == NULL, "expected NULL service, got %p\n", service ); SysFreeString( class ); }
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40945 Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- dlls/wbemprox/class.c | 3 +++ dlls/wbemprox/tests/query.c | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c index 1a00cfc40a..e048fb3db8 100644 --- a/dlls/wbemprox/class.c +++ b/dlls/wbemprox/class.c @@ -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 ); }
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index df0c26aa97..17942cd89a 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -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;
Signed-off-by: Hans Leidekker hans@codeweavers.com