Module: wine Branch: master Commit: 91e4961d01ac250a717d67b2bff54c86734a6024 URL: https://source.winehq.org/git/wine.git/?a=commit;h=91e4961d01ac250a717d67b2b...
Author: Piotr Caban piotr@codeweavers.com Date: Wed Oct 17 08:47:20 2018 +0200
wbemprox: Return NULL signature when there are no input parameters.
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Hans Leidekker hans@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/wbemprox/class.c | 14 +++++++++++--- dlls/wbemprox/tests/query.c | 6 ++++-- 2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c index cc54fd5..983834d 100644 --- a/dlls/wbemprox/class.c +++ b/dlls/wbemprox/class.c @@ -839,6 +839,13 @@ HRESULT create_signature( const WCHAR *class, const WCHAR *method, enum param_di heap_free( query ); if (hr != S_OK) return hr;
+ if (!count_instances( iter )) + { + *sig = NULL; + IEnumWbemClassObject_Release( iter ); + return S_OK; + } + if (!(name = build_signature_table_name( class, method, dir ))) { IEnumWbemClassObject_Release( iter ); @@ -873,9 +880,9 @@ static HRESULT WINAPI class_object_GetMethod( if (hr == S_OK) { if (ppInSignature) *ppInSignature = in; - else IWbemClassObject_Release( in ); + else if (in) IWbemClassObject_Release( in ); if (ppOutSignature) *ppOutSignature = out; - else IWbemClassObject_Release( out ); + else if (out) IWbemClassObject_Release( out ); } else IWbemClassObject_Release( in ); return hr; @@ -939,7 +946,8 @@ static HRESULT WINAPI class_object_NextMethod( if (hr != S_OK) { SysFreeString( method ); - IWbemClassObject_Release( *ppInSignature ); + if (*ppInSignature) + IWbemClassObject_Release( *ppInSignature ); } else { diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index 168c290..95690cf 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -415,7 +415,7 @@ static void test_Win32_Process( IWbemServices *services, BOOL use_full_path ) WBEM_FLAVOR_ORIGIN_PROPAGATED; WCHAR full_path[MAX_COMPUTERNAME_LENGTH + ARRAY_SIZE(full_path_fmt)]; BSTR class, method; - IWbemClassObject *process, *out; + IWbemClassObject *process, *sig_in, *out; IWbemQualifierSet *qualifiers; VARIANT user, domain, retval, val; DWORD full_path_len = 0; @@ -442,8 +442,10 @@ static void test_Win32_Process( IWbemServices *services, BOOL use_full_path ) win_skip( "Win32_Process not available\n" ); return; } - hr = IWbemClassObject_GetMethod( process, getownerW, 0, NULL, NULL ); + sig_in = (void*)0xdeadbeef; + hr = IWbemClassObject_GetMethod( process, getownerW, 0, &sig_in, NULL ); ok( hr == S_OK, "failed to get GetOwner method %08x\n", hr ); + ok( !sig_in, "sig_in != NULL\n"); IWbemClassObject_Release( process );
out = NULL;