Rémi Bernon : windows.media.speech: Implement IInstalledVoicesStatic stub.

Alexandre Julliard julliard at winehq.org
Mon Mar 15 16:59:14 CDT 2021


Module: wine
Branch: master
Commit: f4dbded171228a9c57dd745791ddeb791f3ca79e
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f4dbded171228a9c57dd745791ddeb791f3ca79e

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Fri Mar 12 12:31:10 2021 +0100

windows.media.speech: Implement IInstalledVoicesStatic stub.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/windows.media.speech/main.c          | 89 +++++++++++++++++++++++++++++++
 dlls/windows.media.speech/tests/statics.c |  8 +--
 2 files changed, 93 insertions(+), 4 deletions(-)

diff --git a/dlls/windows.media.speech/main.c b/dlls/windows.media.speech/main.c
index a6b4fb2ff0a..0d1da641394 100644
--- a/dlls/windows.media.speech/main.c
+++ b/dlls/windows.media.speech/main.c
@@ -29,7 +29,10 @@
 #include "initguid.h"
 #include "activation.h"
 
+#define WIDL_using_Windows_Foundation
+#define WIDL_using_Windows_Foundation_Collections
 #include "windows.foundation.h"
+#define WIDL_using_Windows_Media_SpeechSynthesis
 #include "windows.media.speechsynthesis.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(speech);
@@ -46,6 +49,7 @@ static const char *debugstr_hstring(HSTRING hstr)
 struct windows_media_speech
 {
     IActivationFactory IActivationFactory_iface;
+    IInstalledVoicesStatic IInstalledVoicesStatic_iface;
     LONG ref;
 };
 
@@ -54,9 +58,16 @@ static inline struct windows_media_speech *impl_from_IActivationFactory(IActivat
     return CONTAINING_RECORD(iface, struct windows_media_speech, IActivationFactory_iface);
 }
 
+static inline struct windows_media_speech *impl_from_IInstalledVoicesStatic(IInstalledVoicesStatic *iface)
+{
+    return CONTAINING_RECORD(iface, struct windows_media_speech, IInstalledVoicesStatic_iface);
+}
+
 static HRESULT STDMETHODCALLTYPE windows_media_speech_QueryInterface(
         IActivationFactory *iface, REFIID iid, void **out)
 {
+    struct windows_media_speech *impl = impl_from_IActivationFactory(iface);
+
     TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out);
 
     if (IsEqualGUID(iid, &IID_IUnknown) ||
@@ -69,6 +80,13 @@ static HRESULT STDMETHODCALLTYPE windows_media_speech_QueryInterface(
         return S_OK;
     }
 
+    if (IsEqualGUID(iid, &IID_IInstalledVoicesStatic))
+    {
+        IUnknown_AddRef(iface);
+        *out = &impl->IInstalledVoicesStatic_iface;
+        return S_OK;
+    }
+
     FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
     *out = NULL;
     return E_NOINTERFACE;
@@ -133,9 +151,80 @@ static const struct IActivationFactoryVtbl activation_factory_vtbl =
     windows_media_speech_ActivateInstance,
 };
 
+static HRESULT STDMETHODCALLTYPE installed_voices_static_QueryInterface(
+        IInstalledVoicesStatic *iface, REFIID iid, void **out)
+{
+    struct windows_media_speech *impl = impl_from_IInstalledVoicesStatic(iface);
+    return windows_media_speech_QueryInterface(&impl->IActivationFactory_iface, iid, out);
+}
+
+static ULONG STDMETHODCALLTYPE installed_voices_static_AddRef(
+        IInstalledVoicesStatic *iface)
+{
+    struct windows_media_speech *impl = impl_from_IInstalledVoicesStatic(iface);
+    return windows_media_speech_AddRef(&impl->IActivationFactory_iface);
+}
+
+static ULONG STDMETHODCALLTYPE installed_voices_static_Release(
+        IInstalledVoicesStatic *iface)
+{
+    struct windows_media_speech *impl = impl_from_IInstalledVoicesStatic(iface);
+    return windows_media_speech_Release(&impl->IActivationFactory_iface);
+}
+
+static HRESULT STDMETHODCALLTYPE installed_voices_static_GetIids(
+        IInstalledVoicesStatic *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 installed_voices_static_GetRuntimeClassName(
+        IInstalledVoicesStatic *iface, HSTRING *class_name)
+{
+    FIXME("iface %p, class_name %p stub!\n", iface, class_name);
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE installed_voices_static_GetTrustLevel(
+        IInstalledVoicesStatic *iface, TrustLevel *trust_level)
+{
+    FIXME("iface %p, trust_level %p stub!\n", iface, trust_level);
+    return E_NOTIMPL;
+}
+
+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;
+}
+
+static HRESULT STDMETHODCALLTYPE installed_voices_static_get_DefaultVoice(
+    IInstalledVoicesStatic *iface, IVoiceInformation **value)
+{
+    FIXME("iface %p, value %p stub!\n", iface, value);
+    return E_NOTIMPL;
+}
+
+static const struct IInstalledVoicesStaticVtbl installed_voices_static_vtbl =
+{
+    installed_voices_static_QueryInterface,
+    installed_voices_static_AddRef,
+    installed_voices_static_Release,
+    /* IInspectable methods */
+    installed_voices_static_GetIids,
+    installed_voices_static_GetRuntimeClassName,
+    installed_voices_static_GetTrustLevel,
+    /* IInstalledVoicesStatic methods */
+    installed_voices_static_get_AllVoices,
+    installed_voices_static_get_DefaultVoice,
+};
+
 static struct windows_media_speech windows_media_speech =
 {
     {&activation_factory_vtbl},
+    {&installed_voices_static_vtbl},
     1
 };
 
diff --git a/dlls/windows.media.speech/tests/statics.c b/dlls/windows.media.speech/tests/statics.c
index 02bb267dc06..470b6d769c6 100644
--- a/dlls/windows.media.speech/tests/statics.c
+++ b/dlls/windows.media.speech/tests/statics.c
@@ -75,8 +75,7 @@ static void test_SpeechSynthesizer(void)
     ok(SUCCEEDED(hr), "IActivationFactory_QueryInterface IID_IAgileObject failed, hr %#x\n", hr);
 
     hr = IActivationFactory_QueryInterface(factory, &IID_IInstalledVoicesStatic, (void **)&voices_static);
-    todo_wine ok(SUCCEEDED(hr), "IActivationFactory_QueryInterface IID_IInstalledVoicesStatic failed, hr %#x\n", hr);
-    if (FAILED(hr)) goto done;
+    ok(SUCCEEDED(hr), "IActivationFactory_QueryInterface IID_IInstalledVoicesStatic failed, hr %#x\n", hr);
 
     hr = IInstalledVoicesStatic_QueryInterface(voices_static, &IID_IInspectable, (void **)&tmp_inspectable);
     ok(SUCCEEDED(hr), "IInstalledVoicesStatic_QueryInterface IID_IInspectable failed, hr %#x\n", hr);
@@ -89,7 +88,8 @@ static void test_SpeechSynthesizer(void)
     IAgileObject_Release(tmp_agile_object);
 
     hr = IInstalledVoicesStatic_get_AllVoices(voices_static, &voices);
-    ok(SUCCEEDED(hr), "IInstalledVoicesStatic_get_AllVoices failed, hr %#x\n", hr);
+    todo_wine ok(SUCCEEDED(hr), "IInstalledVoicesStatic_get_AllVoices failed, hr %#x\n", hr);
+    if (FAILED(hr)) goto done;
 
     hr = IVectorView_VoiceInformation_QueryInterface(voices, &IID_IInspectable, (void **)&tmp_inspectable);
     ok(SUCCEEDED(hr), "IVectorView_VoiceInformation_QueryInterface voices failed, hr %#x\n", hr);
@@ -107,10 +107,10 @@ static void test_SpeechSynthesizer(void)
     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);
 
-done:
     rc = IAgileObject_Release(agile_object);
     ok(rc == 3, "IAgileObject_Release returned unexpected refcount %d\n", rc);
     rc = IInspectable_Release(inspectable);




More information about the wine-cvs mailing list