[PATCH] windows.media.speech: Add stub SpeechSynthesizer class.

Rémi Bernon rbernon at codeweavers.com
Tue Nov 23 06:56:01 CST 2021


On 11/23/21 13:10, Paul Gofman wrote:
> +static HRESULT STDMETHODCALLTYPE speech_synthesizer_QueryInterface(
> +        ISpeechSynthesizer *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_ISpeechSynthesizer))
> +    {
> +        IUnknown_AddRef(iface);
> +        *out = iface;
> +        return S_OK;
> +    }
> +
> +    FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
> +    *out = NULL;
> +    return E_NOINTERFACE;
> +}

I think it's also supposed to implement IClosable, and 
ISpeechSynthesizer2 which, if they don't pull too many things, should 
probably not be too hard to add, and be accepted here as we declare them 
in the IDL.

>   struct windows_media_speech
>   {
>       IActivationFactory IActivationFactory_iface;
> @@ -259,8 +386,20 @@ static HRESULT STDMETHODCALLTYPE windows_media_speech_GetTrustLevel(
>   static HRESULT STDMETHODCALLTYPE windows_media_speech_ActivateInstance(
>           IActivationFactory *iface, IInspectable **instance)
>   {
> -    FIXME("iface %p, instance %p stub!\n", iface, instance);
> -    return E_NOTIMPL;
> +    struct speech_synthesizer *obj;
> +
> +    TRACE("iface %p, instance %p.\n", iface, instance);
> +
> +    if (!(obj = heap_alloc_zero(sizeof(*obj))))
> +    {
> +        *instance = NULL;
> +        return E_OUTOFMEMORY;
> +    }
> +
> +    obj->ISpeechSynthesizer_iface.lpVtbl = &speech_synthesizer_vtbl;
> +    obj->ref = 1;
> +    *instance = (IInspectable *)&obj->ISpeechSynthesizer_iface;
> +    return S_OK;
>   }
>   

As I understand it, although maybe tests could validate or invalidate 
this hypothesis, we will need a different activation factory for each 
class, instead of using the same one for every class and allocating 
ISpeechSynthesizer every time ActivateInstance is called.

Right now it was just all stubs so it didn't really matter, but if a 
different class was initially requested I think we would here silently 
activate an instance of the wrong class and return the wrong interface.

-- 
Rémi Bernon <rbernon at codeweavers.com>



More information about the wine-devel mailing list