Signed-off-by: Jactry Zeng jzeng@codeweavers.com --- dlls/sapi/tests/tts.c | 8 ++++++ dlls/sapi/tts.c | 62 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+)
diff --git a/dlls/sapi/tests/tts.c b/dlls/sapi/tests/tts.c index 2d62a9651d..092ea40c3b 100644 --- a/dlls/sapi/tests/tts.c +++ b/dlls/sapi/tests/tts.c @@ -37,6 +37,7 @@ static void _expect_ref(IUnknown *obj, ULONG ref, int line) static void test_interfaces(void) { ISpeechVoice *speech_voice, *speech_voice2; + IConnectionPointContainer *container; ISpVoice *spvoice, *spvoice2; IDispatch *dispatch; IUnknown *unk; @@ -82,6 +83,13 @@ static void test_interfaces(void) ISpVoice_Release(spvoice2); ISpVoice_Release(spvoice);
+ hr = ISpeechVoice_QueryInterface(speech_voice, &IID_IConnectionPointContainer, + (void **)&container); + ok(hr == S_OK, "ISpeechVoice_QueryInterface failed: %#x.\n", hr); + EXPECT_REF(speech_voice, 2); + EXPECT_REF(container, 2); + IConnectionPointContainer_Release(container); + ISpeechVoice_Release(speech_voice); }
diff --git a/dlls/sapi/tts.c b/dlls/sapi/tts.c index 8f1ecd1894..584c3d56b7 100644 --- a/dlls/sapi/tts.c +++ b/dlls/sapi/tts.c @@ -38,6 +38,7 @@ struct speech_voice { ISpeechVoice ISpeechVoice_iface; ISpVoice ISpVoice_iface; + IConnectionPointContainer IConnectionPointContainer_iface; LONG ref; };
@@ -51,6 +52,11 @@ static inline struct speech_voice *impl_from_ISpVoice(ISpVoice *iface) return CONTAINING_RECORD(iface, struct speech_voice, ISpVoice_iface); }
+static inline struct speech_voice *impl_from_IConnectionPointContainer(IConnectionPointContainer *iface) +{ + return CONTAINING_RECORD(iface, struct speech_voice, IConnectionPointContainer_iface); +} + /* ISpeechVoice interface */ static HRESULT WINAPI speech_voice_QueryInterface(ISpeechVoice *iface, REFIID iid, void **obj) { @@ -64,6 +70,8 @@ static HRESULT WINAPI speech_voice_QueryInterface(ISpeechVoice *iface, REFIID ii *obj = &This->ISpeechVoice_iface; else if (IsEqualIID(iid, &IID_ISpVoice)) *obj = &This->ISpVoice_iface; + else if (IsEqualIID(iid, &IID_IConnectionPointContainer)) + *obj = &This->IConnectionPointContainer_iface; else { *obj = NULL; @@ -726,6 +734,59 @@ static const ISpVoiceVtbl spvoice_vtbl = spvoice_DisplayUI };
+/* IConnectionPointContainer interface */ +static HRESULT WINAPI container_QueryInterface(IConnectionPointContainer *iface, REFIID iid, void **obj) +{ + struct speech_voice *This = impl_from_IConnectionPointContainer(iface); + + TRACE("(%p, %s %p).\n", iface, debugstr_guid(iid), obj); + + return ISpeechVoice_QueryInterface(&This->ISpeechVoice_iface, iid, obj); +} + +static ULONG WINAPI container_AddRef(IConnectionPointContainer *iface) +{ + struct speech_voice *This = impl_from_IConnectionPointContainer(iface); + + TRACE("(%p).\n", iface); + + return ISpeechVoice_AddRef(&This->ISpeechVoice_iface); +} + +static ULONG WINAPI container_Release(IConnectionPointContainer *iface) +{ + struct speech_voice *This = impl_from_IConnectionPointContainer(iface); + + TRACE("(%p).\n", iface); + + return ISpeechVoice_Release(&This->ISpeechVoice_iface); +} + +static HRESULT WINAPI container_EnumConnectionPoints(IConnectionPointContainer *iface, + IEnumConnectionPoints **enum_cp) +{ + FIXME("(%p, %p): stub.\n", iface, enum_cp); + + return E_NOTIMPL; +} + +static HRESULT WINAPI container_FindConnectionPoint(IConnectionPointContainer *iface, REFIID riid, + IConnectionPoint **cp) +{ + FIXME("(%p, %s, %p): stub.\n", iface, debugstr_guid(riid), cp); + + return E_NOTIMPL; +} + +const static IConnectionPointContainerVtbl container_vtbl = +{ + container_QueryInterface, + container_AddRef, + container_Release, + container_EnumConnectionPoints, + container_FindConnectionPoint +}; + HRESULT speech_voice_create(IUnknown *outer, REFIID iid, void **obj) { struct speech_voice *This = heap_alloc(sizeof(*This)); @@ -734,6 +795,7 @@ HRESULT speech_voice_create(IUnknown *outer, REFIID iid, void **obj) if (!This) return E_OUTOFMEMORY; This->ISpeechVoice_iface.lpVtbl = &speech_voice_vtbl; This->ISpVoice_iface.lpVtbl = &spvoice_vtbl; + This->IConnectionPointContainer_iface.lpVtbl = &container_vtbl; This->ref = 1;
hr = ISpeechVoice_QueryInterface(&This->ISpeechVoice_iface, iid, obj);