Skip to content

Commit

Permalink
sapi: Add ISpeechObjectToken stub.
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunren authored and julliard committed Feb 9, 2024
1 parent 4e54087 commit c45bedb
Show file tree
Hide file tree
Showing 3 changed files with 247 additions and 7 deletions.
27 changes: 27 additions & 0 deletions dlls/sapi/tests/token.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,13 +604,40 @@ 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;
ISpObjectTokenCategory *cat;
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 );
Expand Down
225 changes: 219 additions & 6 deletions dlls/sapi/token.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 );
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -1495,13 +1505,216 @@ 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) );
HRESULT hr;

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;
Expand Down
2 changes: 1 addition & 1 deletion include/sapi.idl
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ library SpeechLib
coclass SpObjectToken
{
interface ISpObjectToken;
[default] interface ISpDataKey;
[default] interface ISpeechObjectToken;
}

[
Expand Down

0 comments on commit c45bedb

Please sign in to comment.