windows.media.speech: Add IAgileObject to SpeechRecognizer.

Also make some style improvements.

Signed-off-by: Bernhard Kölbl <besentv@gmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Bernhard Kölbl 2022-03-14 11:06:33 +01:00 committed by Alexandre Julliard
parent 9bfe419e67
commit d8a6fc032d
2 changed files with 20 additions and 14 deletions

View File

@ -56,19 +56,20 @@ static HRESULT WINAPI recognizer_QueryInterface( ISpeechRecognizer *iface, REFII
if (IsEqualGUID(iid, &IID_IUnknown) ||
IsEqualGUID(iid, &IID_IInspectable) ||
IsEqualGUID(iid, &IID_IAgileObject) ||
IsEqualGUID(iid, &IID_ISpeechRecognizer))
{
IInspectable_AddRef((*out = &impl->ISpeechRecognizer_iface));
return S_OK;
}
if(IsEqualGUID(iid, &IID_IClosable))
if (IsEqualGUID(iid, &IID_IClosable))
{
IInspectable_AddRef((*out = &impl->IClosable_iface));
return S_OK;
}
if(IsEqualGUID(iid, &IID_ISpeechRecognizer2))
if (IsEqualGUID(iid, &IID_ISpeechRecognizer2))
{
IInspectable_AddRef((*out = &impl->ISpeechRecognizer2_iface));
return S_OK;
@ -94,7 +95,7 @@ static ULONG WINAPI recognizer_Release( ISpeechRecognizer *iface )
ULONG ref = InterlockedDecrement(&impl->ref);
TRACE("iface %p, ref %lu.\n", iface, ref);
if(!ref)
if (!ref)
free(impl);
return ref;
@ -403,7 +404,7 @@ static HRESULT WINAPI activation_factory_GetTrustLevel( IActivationFactory *ifac
static HRESULT WINAPI activation_factory_ActivateInstance( IActivationFactory *iface, IInspectable **instance )
{
struct recognizer_statics *impl = impl_from_IActivationFactory(iface);
TRACE("iface %p, instance %p\n", iface, instance);
TRACE("iface %p, instance %p.\n", iface, instance);
return ISpeechRecognizerFactory_Create(&impl->ISpeechRecognizerFactory_iface, NULL, (ISpeechRecognizer **)instance);
}
@ -441,15 +442,15 @@ static HRESULT WINAPI recognizer_factory_Create( ISpeechRecognizerFactory *iface
return E_OUTOFMEMORY;
}
if(language)
FIXME("ILanguage parameter unused. Stub!\n");
if (language)
FIXME("language parameter unused. Stub!\n");
impl->ISpeechRecognizer_iface.lpVtbl = &speech_recognizer_vtbl;
impl->IClosable_iface.lpVtbl = &closable_vtbl;
impl->ISpeechRecognizer2_iface.lpVtbl = &speech_recognizer2_vtbl;
impl->ref = 1;
TRACE("created SpeechRecognizer %p\n", impl);
TRACE("created SpeechRecognizer %p.\n", impl);
*speechrecognizer = &impl->ISpeechRecognizer_iface;
return S_OK;

View File

@ -38,6 +38,8 @@
#include "wine/test.h"
#define SPERR_WINRT_INTERNAL_ERROR 0x800455a0
HRESULT WINAPI (*pDllGetActivationFactory)(HSTRING, IActivationFactory **);
static inline LONG get_ref(IUnknown *obj)
@ -148,7 +150,7 @@ static void test_ActivationFactory(void)
hdll = LoadLibraryW(L"windows.media.speech.dll");
if(hdll)
if (hdll)
{
pDllGetActivationFactory = (void *)GetProcAddress(hdll, "DllGetActivationFactory");
ok(!!pDllGetActivationFactory, "DllGetActivationFactory not found.\n");
@ -364,7 +366,7 @@ static void test_SpeechRecognizer(void)
hr = RoGetActivationFactory(hstr, &IID_IActivationFactory, (void **)&factory);
ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG), "RoGetActivationFactory failed, hr %#lx.\n", hr);
if(hr == REGDB_E_CLASSNOTREG) /* Win 8 and 8.1 */
if (hr == REGDB_E_CLASSNOTREG) /* Win 8 and 8.1 */
{
win_skip("SpeechRecognizer activation factory not available!\n");
goto done;
@ -379,7 +381,7 @@ static void test_SpeechRecognizer(void)
hr = ISpeechRecognizerStatics_get_SystemSpeechLanguage(sr_statics, &language);
todo_wine ok(hr == S_OK, "ISpeechRecognizerStatics_SystemSpeechLanguage failed, hr %#lx.\n", hr);
if(hr == S_OK)
if (hr == S_OK)
{
hr = ILanguage_get_LanguageTag(language, &hstr_lang);
ok(hr == S_OK, "ILanguage_get_LanguageTag failed, hr %#lx.\n", hr);
@ -395,7 +397,7 @@ static void test_SpeechRecognizer(void)
hr = IActivationFactory_QueryInterface(factory, &IID_ISpeechRecognizerStatics2, (void **)&sr_statics2);
ok(hr == S_OK || broken(hr == E_NOINTERFACE), "IActivationFactory_QueryInterface IID_ISpeechRecognizerStatics2 failed, hr %#lx.\n", hr);
if(hr == S_OK) /* SpeechRecognizerStatics2 not implemented on Win10 1507 */
if (hr == S_OK) /* SpeechRecognizerStatics2 not implemented on Win10 1507 */
{
ref = ISpeechRecognizerStatics2_Release(sr_statics2);
ok(ref == 3, "Got unexpected ref %lu.\n", ref);
@ -408,10 +410,13 @@ static void test_SpeechRecognizer(void)
ok(ref == 1, "Got unexpected ref %lu.\n", ref);
hr = RoActivateInstance(hstr, &inspectable);
ok(hr == S_OK || broken(hr == 0x800455a0), "Got unexpected hr %#lx.\n", hr);
ok(hr == S_OK || broken(hr == SPERR_WINRT_INTERNAL_ERROR), "Got unexpected hr %#lx.\n", hr);
if(hr == S_OK)
if (hr == S_OK)
{
check_refcount(inspectable, 1);
check_interface(factory, &IID_IAgileObject, TRUE);
hr = IInspectable_QueryInterface(inspectable, &IID_ISpeechRecognizer, (void **)&recognizer);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
@ -433,7 +438,7 @@ static void test_SpeechRecognizer(void)
ref = IInspectable_Release(inspectable);
ok(!ref, "Got unexpected ref %lu.\n", ref);
}
else if(hr == 0x800455a0) /* Not sure what this hr is... Probably if a language pack is not installed. */
else if (hr == SPERR_WINRT_INTERNAL_ERROR) /* Not sure when this triggers. Probably if a language pack is not installed. */
{
win_skip("Could not init SpeechRecognizer with default language!\n");
}