Module: wine Branch: stable Commit: 8a1a8865bc92b0a069cf1350a3cec4560e930cab URL: https://source.winehq.org/git/wine.git/?a=commit;h=8a1a8865bc92b0a069cf1350a... Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Sun Aug 9 19:30:09 2020 -0500 wbemprox: Return WBEM_E_NOT_FOUND from get_object() if no object is available. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49685 Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit a0c9aab5deffcdf30826574ba331ea8f18616ce3) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/wbemprox/services.c | 4 +++- dlls/wbemprox/tests/query.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dlls/wbemprox/services.c b/dlls/wbemprox/services.c index 5909c02e61f..8b3a3b1af42 100644 --- a/dlls/wbemprox/services.c +++ b/dlls/wbemprox/services.c @@ -456,6 +456,7 @@ HRESULT get_object( const WCHAR *object_path, IWbemClassObject **obj ) { IEnumWbemClassObject *iter; struct path *path; + ULONG count; HRESULT hr; hr = parse_path( object_path, &path ); @@ -467,7 +468,8 @@ HRESULT get_object( const WCHAR *object_path, IWbemClassObject **obj ) free_path( path ); return hr; } - hr = create_class_object( path->class, iter, 0, NULL, obj ); + hr = IEnumWbemClassObject_Next( iter, WBEM_INFINITE, 1, obj, &count ); + if (hr == WBEM_S_FALSE) hr = WBEM_E_NOT_FOUND; IEnumWbemClassObject_Release( iter ); free_path( path ); return hr; diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index 0212cdcb69e..a3a3565759f 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -271,7 +271,9 @@ static void test_Win32_Service( IWbemServices *services ) if (hr != S_OK) { win_skip( "Win32_Service not available\n" ); - goto out; + SysFreeString( empty ); + SysFreeString( class ); + return; } check_property( service, processidW, VT_I4, CIM_UINT32 ); @@ -347,9 +349,13 @@ static void test_Win32_Service( IWbemServices *services ) ok( hr == S_OK, "got %08x\n", hr ); if (service) IWbemClassObject_Release( service ); -out: SysFreeString( empty ); SysFreeString( class ); + + class = SysAllocString( L"Win32_Service.Name=\"nonexistent\"" ); + hr = IWbemServices_GetObject( services, class, 0, NULL, &service, NULL ); + ok( hr == WBEM_E_NOT_FOUND, "got %#08x\n", hr ); + SysFreeString( class ); } static void test_Win32_Bios( IWbemServices *services )