diff --git a/dlls/sapi/tests/token.c b/dlls/sapi/tests/token.c index a7d164389d9..0fe142f89a8 100644 --- a/dlls/sapi/tests/token.c +++ b/dlls/sapi/tests/token.c @@ -604,6 +604,8 @@ static void test_object_token(void) static const WCHAR test_token_id[] = L"HKEY_LOCAL_MACHINE\\Software\\Wine\\Winetest\\sapi\\TestToken"; ISpObjectToken *token; + IDispatch *disp; + ISpeechObjectToken *speech_token; ISpDataKey *sub_key; HRESULT hr; LPWSTR tempW, token_id; @@ -611,6 +613,31 @@ static void test_object_token(void) DWORD regid; IUnknown *obj; + hr = CoCreateInstance( &CLSID_SpObjectToken, NULL, CLSCTX_INPROC_SERVER, + &IID_ISpObjectToken, (void **)&token ); + ok( hr == S_OK, "got %08lx\n", hr ); + + hr = ISpObjectToken_QueryInterface( token, &IID_IDispatch, (void **)&disp ); + ok( hr == S_OK, "got %08lx\n", hr ); + IDispatch_Release( disp ); + + hr = ISpObjectToken_QueryInterface( token, &IID_ISpeechObjectToken, (void **)&speech_token ); + ok( hr == S_OK, "got %08lx\n", hr ); + ISpeechObjectToken_Release( speech_token ); + + ISpObjectToken_Release( token ); + + hr = CoCreateInstance( &CLSID_SpObjectToken, NULL, CLSCTX_INPROC_SERVER, + &IID_IDispatch, (void **)&disp ); + ok( hr == S_OK, "got %08lx\n", hr ); + IDispatch_Release( disp ); + + hr = CoCreateInstance( &CLSID_SpObjectToken, NULL, CLSCTX_INPROC_SERVER, + &IID_ISpeechObjectToken, (void **)&speech_token ); + ok( hr == S_OK, "got %08lx\n", hr ); + ISpeechObjectToken_Release( speech_token ); + + hr = CoCreateInstance( &CLSID_SpObjectToken, NULL, CLSCTX_INPROC_SERVER, &IID_ISpObjectToken, (void **)&token ); ok( hr == S_OK, "got %08lx\n", hr ); diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c index f599bdb6b14..fd4efb9a95a 100644 --- a/dlls/sapi/token.c +++ b/dlls/sapi/token.c @@ -51,6 +51,7 @@ static struct data_key *impl_from_ISpRegDataKey( ISpRegDataKey *iface ) struct object_token { ISpObjectToken ISpObjectToken_iface; + ISpeechObjectToken ISpeechObjectToken_iface; LONG ref; ISpRegDataKey *data_key; @@ -62,6 +63,11 @@ static struct object_token *impl_from_ISpObjectToken( ISpObjectToken *iface ) return CONTAINING_RECORD( iface, struct object_token, ISpObjectToken_iface ); } +static struct object_token *impl_from_ISpeechObjectToken( ISpeechObjectToken *iface ) +{ + return CONTAINING_RECORD( iface, struct object_token, ISpeechObjectToken_iface ); +} + static HRESULT WINAPI data_key_QueryInterface( ISpRegDataKey *iface, REFIID iid, void **obj ) { struct data_key *This = impl_from_ISpRegDataKey( iface ); @@ -1160,15 +1166,19 @@ static HRESULT WINAPI token_QueryInterface( ISpObjectToken *iface, if (IsEqualIID( iid, &IID_IUnknown ) || IsEqualIID( iid, &IID_ISpDataKey ) || IsEqualIID( iid, &IID_ISpObjectToken )) + *obj = &This->ISpObjectToken_iface; + else if (IsEqualIID( iid, &IID_IDispatch ) || + IsEqualIID( iid, &IID_ISpeechObjectToken )) + *obj = &This->ISpeechObjectToken_iface; + else { - ISpObjectToken_AddRef( iface ); - *obj = iface; - return S_OK; + *obj = NULL; + FIXME( "interface %s not implemented\n", debugstr_guid( iid ) ); + return E_NOINTERFACE; } - FIXME( "interface %s not implemented\n", debugstr_guid( iid ) ); - *obj = NULL; - return E_NOINTERFACE; + IUnknown_AddRef( (IUnknown *)*obj ); + return S_OK; } static ULONG WINAPI token_AddRef( ISpObjectToken *iface ) @@ -1495,6 +1505,208 @@ const struct ISpObjectTokenVtbl token_vtbl = token_MatchesAttributes }; +static HRESULT WINAPI speech_token_QueryInterface( ISpeechObjectToken *iface, + REFIID iid, void **obj ) +{ + struct object_token *This = impl_from_ISpeechObjectToken( iface ); + + TRACE( "(%p)->(%s %p)\n", This, debugstr_guid( iid ), obj ); + + return ISpObjectToken_QueryInterface( &This->ISpObjectToken_iface, iid, obj ); +} + +static ULONG WINAPI speech_token_AddRef( ISpeechObjectToken *iface ) +{ + struct object_token *This = impl_from_ISpeechObjectToken( iface ); + + TRACE( "(%p)\n", This ); + + return ISpObjectToken_AddRef( &This->ISpObjectToken_iface ); +} + +static ULONG WINAPI speech_token_Release( ISpeechObjectToken *iface ) +{ + struct object_token *This = impl_from_ISpeechObjectToken( iface ); + + TRACE( "(%p)\n", This ); + + return ISpObjectToken_Release( &This->ISpObjectToken_iface ); +} + +static HRESULT WINAPI speech_token_GetTypeInfoCount( ISpeechObjectToken *iface, + UINT *count ) +{ + + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_GetTypeInfo( ISpeechObjectToken *iface, + UINT index, + LCID lcid, + ITypeInfo **type_info ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_GetIDsOfNames( ISpeechObjectToken *iface, + REFIID iid, + LPOLESTR *names, + UINT count, + LCID lcid, + DISPID *dispids ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_Invoke( ISpeechObjectToken *iface, + DISPID dispid, + REFIID iid, + LCID lcid, + WORD flags, + DISPPARAMS *params, + VARIANT *result, + EXCEPINFO *excepinfo, + UINT *argerr ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_get_Id( ISpeechObjectToken *iface, + BSTR *id ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_get_DataKey( ISpeechObjectToken *iface, + ISpeechDataKey **key ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_get_Category( ISpeechObjectToken *iface, + ISpeechObjectTokenCategory **cat ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_GetDescription( ISpeechObjectToken *iface, + LONG locale, BSTR *desc ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_SetId( ISpeechObjectToken *iface, + BSTR id, BSTR category_id, + VARIANT_BOOL create ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_GetAttribute( ISpeechObjectToken *iface, + BSTR name, BSTR *value ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_CreateInstance( ISpeechObjectToken *iface, + IUnknown *outer, + SpeechTokenContext clsctx, + IUnknown **object ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_Remove( ISpeechObjectToken *iface, + BSTR clsid ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_GetStorageFileName( ISpeechObjectToken *iface, + BSTR clsid, + BSTR key, + BSTR name, + SpeechTokenShellFolder folder, + BSTR *path ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_RemoveStorageFileName( ISpeechObjectToken *iface, + BSTR clsid, + BSTR key, + VARIANT_BOOL remove ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_IsUISupported( ISpeechObjectToken *iface, + const BSTR type, + const VARIANT *data, + IUnknown *object, + VARIANT_BOOL *supported ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_DisplayUI( ISpeechObjectToken *iface, + LONG hwnd, + BSTR title, + const BSTR type, + const VARIANT *data, + IUnknown *object ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_MatchesAttributes( ISpeechObjectToken *iface, + const BSTR attributes, + VARIANT_BOOL *matches ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +const struct ISpeechObjectTokenVtbl speech_token_vtbl = +{ + speech_token_QueryInterface, + speech_token_AddRef, + speech_token_Release, + speech_token_GetTypeInfoCount, + speech_token_GetTypeInfo, + speech_token_GetIDsOfNames, + speech_token_Invoke, + speech_token_get_Id, + speech_token_get_DataKey, + speech_token_get_Category, + speech_token_GetDescription, + speech_token_SetId, + speech_token_GetAttribute, + speech_token_CreateInstance, + speech_token_Remove, + speech_token_GetStorageFileName, + speech_token_RemoveStorageFileName, + speech_token_IsUISupported, + speech_token_DisplayUI, + speech_token_MatchesAttributes +}; + HRESULT token_create( IUnknown *outer, REFIID iid, void **obj ) { struct object_token *This = malloc( sizeof(*This) ); @@ -1502,6 +1714,7 @@ HRESULT token_create( IUnknown *outer, REFIID iid, void **obj ) if (!This) return E_OUTOFMEMORY; This->ISpObjectToken_iface.lpVtbl = &token_vtbl; + This->ISpeechObjectToken_iface.lpVtbl = &speech_token_vtbl; This->ref = 1; This->data_key = NULL; diff --git a/include/sapi.idl b/include/sapi.idl index 16b8348d73b..6a593eb6b18 100644 --- a/include/sapi.idl +++ b/include/sapi.idl @@ -1293,7 +1293,7 @@ library SpeechLib coclass SpObjectToken { interface ISpObjectToken; - [default] interface ISpDataKey; + [default] interface ISpeechObjectToken; } [