From 06e455c247c4e7ba56cbdcd636e165418490b299 Mon Sep 17 00:00:00 2001 From: Gijs Vermeulen Date: Mon, 10 Aug 2020 12:09:10 +0200 Subject: [PATCH] wbemprox: Accept 0 and WBEM_FLAG_ALWAYS | WBEM_MASK_CONDITION_ORIGIN as flags in IWbemClassObject::GetNames(). Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=34770 Signed-off-by: Gijs Vermeulen Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- dlls/wbemprox/class.c | 12 ++++++++++-- dlls/wbemprox/tests/query.c | 15 +++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c index db6017e0c98..1a00cfc40a2 100644 --- a/dlls/wbemprox/class.c +++ b/dlls/wbemprox/class.c @@ -484,13 +484,21 @@ static HRESULT WINAPI class_object_GetNames( TRACE("%p, %s, %08x, %s, %p\n", iface, debugstr_w(wszQualifierName), lFlags, debugstr_variant(pQualifierVal), pNames); - if (lFlags != WBEM_FLAG_ALWAYS && + if (!pNames) + return WBEM_E_INVALID_PARAMETER; + + /* Combination used in a handful of broken apps */ + if (lFlags == (WBEM_FLAG_ALWAYS | WBEM_MASK_CONDITION_ORIGIN)) + lFlags = WBEM_FLAG_ALWAYS; + + if (lFlags && (lFlags != WBEM_FLAG_ALWAYS && lFlags != WBEM_FLAG_NONSYSTEM_ONLY && - lFlags != WBEM_FLAG_SYSTEM_ONLY) + lFlags != WBEM_FLAG_SYSTEM_ONLY)) { FIXME("flags %08x not supported\n", lFlags); return E_NOTIMPL; } + if (wszQualifierName || pQualifierVal) FIXME("qualifier not supported\n"); diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index a50002e1baf..d6c918c08de 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -1015,6 +1015,21 @@ static void test_GetNames( IWbemServices *services ) IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); if (!count) break; + hr = IWbemClassObject_GetNames( obj, NULL, 0, NULL, NULL ); + ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr ); + + hr = IWbemClassObject_GetNames( obj, NULL, 0, NULL, &names ); + ok( hr == S_OK, "got %08x\n", hr ); + SafeArrayDestroy( names ); + + hr = IWbemClassObject_GetNames( obj, NULL, WBEM_FLAG_ALWAYS, NULL, &names ); + ok( hr == S_OK, "got %08x\n", hr ); + SafeArrayDestroy( names ); + + hr = IWbemClassObject_GetNames( obj, NULL, WBEM_FLAG_ALWAYS | WBEM_MASK_CONDITION_ORIGIN, NULL, &names ); + ok( hr == S_OK, "got %08x\n", hr ); + SafeArrayDestroy( names ); + VariantInit( &val ); hr = IWbemClassObject_GetNames( obj, NULL, WBEM_FLAG_NONSYSTEM_ONLY, &val, &names ); ok( hr == S_OK, "got %08x\n", hr );