Module: wine Branch: master Commit: a0c9aab5deffcdf30826574ba331ea8f18616ce3 URL: https://source.winehq.org/git/wine.git/?a=commit;h=a0c9aab5deffcdf30826574ba...
Author: Zebediah Figura z.figura12@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@gmail.com Signed-off-by: Hans Leidekker hans@codeweavers.com Signed-off-by: Alexandre Julliard julliard@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 e2b452e217..c0e535b3a1 100644 --- a/dlls/wbemprox/services.c +++ b/dlls/wbemprox/services.c @@ -450,6 +450,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 ); @@ -461,7 +462,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 e48722f3bc..a50002e1ba 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -267,7 +267,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, L"ProcessID", VT_I4, CIM_UINT32 ); @@ -343,9 +345,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 )