From af8b935892fe5da59f8183eff4a63a47fc550014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 12 Mar 2021 12:31:11 +0100 Subject: [PATCH] windows.media.speech: Implement IInstalledVoicesStatic::AllVoices stub. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Bernon Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/windows.media.speech/main.c | 125 +++++++++++++++++++++- dlls/windows.media.speech/tests/statics.c | 8 +- 2 files changed, 126 insertions(+), 7 deletions(-) diff --git a/dlls/windows.media.speech/main.c b/dlls/windows.media.speech/main.c index 0d1da641394..28b1c45c4fd 100644 --- a/dlls/windows.media.speech/main.c +++ b/dlls/windows.media.speech/main.c @@ -46,6 +46,125 @@ static const char *debugstr_hstring(HSTRING hstr) return wine_dbgstr_wn(str, len); } +struct voice_information_vector +{ + IVectorView_VoiceInformation IVectorView_VoiceInformation_iface; + LONG ref; +}; + +static inline struct voice_information_vector *impl_from_IVectorView_VoiceInformation(IVectorView_VoiceInformation *iface) +{ + return CONTAINING_RECORD(iface, struct voice_information_vector, IVectorView_VoiceInformation_iface); +} + +static HRESULT STDMETHODCALLTYPE vector_view_voice_information_QueryInterface( + IVectorView_VoiceInformation *iface, REFIID iid, void **out) +{ + TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IInspectable) || + IsEqualGUID(iid, &IID_IVectorView_VoiceInformation)) + { + IUnknown_AddRef(iface); + *out = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE vector_view_voice_information_AddRef( + IVectorView_VoiceInformation *iface) +{ + struct voice_information_vector *impl = impl_from_IVectorView_VoiceInformation(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %u.\n", iface, ref); + return ref; +} + +static ULONG STDMETHODCALLTYPE vector_view_voice_information_Release( + IVectorView_VoiceInformation *iface) +{ + struct voice_information_vector *impl = impl_from_IVectorView_VoiceInformation(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p, ref %u.\n", iface, ref); + return ref; +} + +static HRESULT STDMETHODCALLTYPE vector_view_voice_information_GetIids( + IVectorView_VoiceInformation *iface, ULONG *iid_count, IID **iids) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE vector_view_voice_information_GetRuntimeClassName( + IVectorView_VoiceInformation *iface, HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE vector_view_voice_information_GetTrustLevel( + IVectorView_VoiceInformation *iface, TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE vector_view_voice_information_GetAt( + IVectorView_VoiceInformation *iface, ULONG index, IVoiceInformation **value) +{ + FIXME("iface %p, index %#x, value %p stub!\n", iface, index, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE vector_view_voice_information_get_Size( + IVectorView_VoiceInformation *iface, ULONG *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE vector_view_voice_information_IndexOf( + IVectorView_VoiceInformation *iface, IVoiceInformation *element, ULONG *index, BOOLEAN *value) +{ + FIXME("iface %p, element %p, index %p, value %p stub!\n", iface, element, index, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE vector_view_voice_information_GetMany( + IVectorView_VoiceInformation *iface, ULONG start_index, IVoiceInformation **items, UINT *value) +{ + FIXME("iface %p, start_index %#x, items %p, value %p stub!\n", iface, start_index, items, value); + return E_NOTIMPL; +} + +static const struct IVectorView_VoiceInformationVtbl vector_view_voice_information_vtbl = +{ + vector_view_voice_information_QueryInterface, + vector_view_voice_information_AddRef, + vector_view_voice_information_Release, + /* IInspectable methods */ + vector_view_voice_information_GetIids, + vector_view_voice_information_GetRuntimeClassName, + vector_view_voice_information_GetTrustLevel, + /* IVectorView methods */ + vector_view_voice_information_GetAt, + vector_view_voice_information_get_Size, + vector_view_voice_information_IndexOf, + vector_view_voice_information_GetMany, +}; + +static struct voice_information_vector all_voices = +{ + {&vector_view_voice_information_vtbl}, + 0 +}; + struct windows_media_speech { IActivationFactory IActivationFactory_iface; @@ -196,8 +315,10 @@ static HRESULT STDMETHODCALLTYPE installed_voices_static_GetTrustLevel( static HRESULT STDMETHODCALLTYPE installed_voices_static_get_AllVoices( IInstalledVoicesStatic *iface, IVectorView_VoiceInformation **value) { - FIXME("iface %p, value %p stub!\n", iface, value); - return E_NOTIMPL; + TRACE("iface %p, value %p.\n", iface, value); + *value = &all_voices.IVectorView_VoiceInformation_iface; + IVectorView_VoiceInformation_AddRef(*value); + return S_OK; } static HRESULT STDMETHODCALLTYPE installed_voices_static_get_DefaultVoice( diff --git a/dlls/windows.media.speech/tests/statics.c b/dlls/windows.media.speech/tests/statics.c index 470b6d769c6..30994b3ac1d 100644 --- a/dlls/windows.media.speech/tests/statics.c +++ b/dlls/windows.media.speech/tests/statics.c @@ -88,8 +88,7 @@ static void test_SpeechSynthesizer(void) IAgileObject_Release(tmp_agile_object); hr = IInstalledVoicesStatic_get_AllVoices(voices_static, &voices); - todo_wine ok(SUCCEEDED(hr), "IInstalledVoicesStatic_get_AllVoices failed, hr %#x\n", hr); - if (FAILED(hr)) goto done; + ok(SUCCEEDED(hr), "IInstalledVoicesStatic_get_AllVoices failed, hr %#x\n", hr); hr = IVectorView_VoiceInformation_QueryInterface(voices, &IID_IInspectable, (void **)&tmp_inspectable); ok(SUCCEEDED(hr), "IVectorView_VoiceInformation_QueryInterface voices failed, hr %#x\n", hr); @@ -101,13 +100,12 @@ static void test_SpeechSynthesizer(void) size = 0xdeadbeef; hr = IVectorView_VoiceInformation_get_Size(voices, &size); - ok(SUCCEEDED(hr), "IVectorView_VoiceInformation_QueryInterface voices failed, hr %#x\n", hr); - ok(size != 0 && size != 0xdeadbeef, "IVectorView_VoiceInformation_get_Size returned %u\n", size); + todo_wine ok(SUCCEEDED(hr), "IVectorView_VoiceInformation_QueryInterface voices failed, hr %#x\n", hr); + todo_wine ok(size != 0 && size != 0xdeadbeef, "IVectorView_VoiceInformation_get_Size returned %u\n", size); rc = IVectorView_VoiceInformation_Release(voices); ok(rc == 0, "IVectorView_VoiceInformation_Release returned unexpected refcount %d\n", rc); -done: rc = IInstalledVoicesStatic_Release(voices_static); ok(rc == 4, "IInstalledVoicesStatic_Release returned unexpected refcount %d\n", rc);