Skip to content

Commit c45bedb

Browse files
shaunrenjulliard
authored andcommitted
sapi: Add ISpeechObjectToken stub.
1 parent 4e54087 commit c45bedb

File tree

3 files changed

+247
-7
lines changed

3 files changed

+247
-7
lines changed

dlls/sapi/tests/token.c

+27
Original file line numberDiff line numberDiff line change
@@ -604,13 +604,40 @@ static void test_object_token(void)
604604
static const WCHAR test_token_id[] = L"HKEY_LOCAL_MACHINE\\Software\\Wine\\Winetest\\sapi\\TestToken";
605605

606606
ISpObjectToken *token;
607+
IDispatch *disp;
608+
ISpeechObjectToken *speech_token;
607609
ISpDataKey *sub_key;
608610
HRESULT hr;
609611
LPWSTR tempW, token_id;
610612
ISpObjectTokenCategory *cat;
611613
DWORD regid;
612614
IUnknown *obj;
613615

616+
hr = CoCreateInstance( &CLSID_SpObjectToken, NULL, CLSCTX_INPROC_SERVER,
617+
&IID_ISpObjectToken, (void **)&token );
618+
ok( hr == S_OK, "got %08lx\n", hr );
619+
620+
hr = ISpObjectToken_QueryInterface( token, &IID_IDispatch, (void **)&disp );
621+
ok( hr == S_OK, "got %08lx\n", hr );
622+
IDispatch_Release( disp );
623+
624+
hr = ISpObjectToken_QueryInterface( token, &IID_ISpeechObjectToken, (void **)&speech_token );
625+
ok( hr == S_OK, "got %08lx\n", hr );
626+
ISpeechObjectToken_Release( speech_token );
627+
628+
ISpObjectToken_Release( token );
629+
630+
hr = CoCreateInstance( &CLSID_SpObjectToken, NULL, CLSCTX_INPROC_SERVER,
631+
&IID_IDispatch, (void **)&disp );
632+
ok( hr == S_OK, "got %08lx\n", hr );
633+
IDispatch_Release( disp );
634+
635+
hr = CoCreateInstance( &CLSID_SpObjectToken, NULL, CLSCTX_INPROC_SERVER,
636+
&IID_ISpeechObjectToken, (void **)&speech_token );
637+
ok( hr == S_OK, "got %08lx\n", hr );
638+
ISpeechObjectToken_Release( speech_token );
639+
640+
614641
hr = CoCreateInstance( &CLSID_SpObjectToken, NULL, CLSCTX_INPROC_SERVER,
615642
&IID_ISpObjectToken, (void **)&token );
616643
ok( hr == S_OK, "got %08lx\n", hr );

dlls/sapi/token.c

+219-6
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ static struct data_key *impl_from_ISpRegDataKey( ISpRegDataKey *iface )
5151
struct object_token
5252
{
5353
ISpObjectToken ISpObjectToken_iface;
54+
ISpeechObjectToken ISpeechObjectToken_iface;
5455
LONG ref;
5556

5657
ISpRegDataKey *data_key;
@@ -62,6 +63,11 @@ static struct object_token *impl_from_ISpObjectToken( ISpObjectToken *iface )
6263
return CONTAINING_RECORD( iface, struct object_token, ISpObjectToken_iface );
6364
}
6465

66+
static struct object_token *impl_from_ISpeechObjectToken( ISpeechObjectToken *iface )
67+
{
68+
return CONTAINING_RECORD( iface, struct object_token, ISpeechObjectToken_iface );
69+
}
70+
6571
static HRESULT WINAPI data_key_QueryInterface( ISpRegDataKey *iface, REFIID iid, void **obj )
6672
{
6773
struct data_key *This = impl_from_ISpRegDataKey( iface );
@@ -1160,15 +1166,19 @@ static HRESULT WINAPI token_QueryInterface( ISpObjectToken *iface,
11601166
if (IsEqualIID( iid, &IID_IUnknown ) ||
11611167
IsEqualIID( iid, &IID_ISpDataKey ) ||
11621168
IsEqualIID( iid, &IID_ISpObjectToken ))
1169+
*obj = &This->ISpObjectToken_iface;
1170+
else if (IsEqualIID( iid, &IID_IDispatch ) ||
1171+
IsEqualIID( iid, &IID_ISpeechObjectToken ))
1172+
*obj = &This->ISpeechObjectToken_iface;
1173+
else
11631174
{
1164-
ISpObjectToken_AddRef( iface );
1165-
*obj = iface;
1166-
return S_OK;
1175+
*obj = NULL;
1176+
FIXME( "interface %s not implemented\n", debugstr_guid( iid ) );
1177+
return E_NOINTERFACE;
11671178
}
11681179

1169-
FIXME( "interface %s not implemented\n", debugstr_guid( iid ) );
1170-
*obj = NULL;
1171-
return E_NOINTERFACE;
1180+
IUnknown_AddRef( (IUnknown *)*obj );
1181+
return S_OK;
11721182
}
11731183

11741184
static ULONG WINAPI token_AddRef( ISpObjectToken *iface )
@@ -1495,13 +1505,216 @@ const struct ISpObjectTokenVtbl token_vtbl =
14951505
token_MatchesAttributes
14961506
};
14971507

1508+
static HRESULT WINAPI speech_token_QueryInterface( ISpeechObjectToken *iface,
1509+
REFIID iid, void **obj )
1510+
{
1511+
struct object_token *This = impl_from_ISpeechObjectToken( iface );
1512+
1513+
TRACE( "(%p)->(%s %p)\n", This, debugstr_guid( iid ), obj );
1514+
1515+
return ISpObjectToken_QueryInterface( &This->ISpObjectToken_iface, iid, obj );
1516+
}
1517+
1518+
static ULONG WINAPI speech_token_AddRef( ISpeechObjectToken *iface )
1519+
{
1520+
struct object_token *This = impl_from_ISpeechObjectToken( iface );
1521+
1522+
TRACE( "(%p)\n", This );
1523+
1524+
return ISpObjectToken_AddRef( &This->ISpObjectToken_iface );
1525+
}
1526+
1527+
static ULONG WINAPI speech_token_Release( ISpeechObjectToken *iface )
1528+
{
1529+
struct object_token *This = impl_from_ISpeechObjectToken( iface );
1530+
1531+
TRACE( "(%p)\n", This );
1532+
1533+
return ISpObjectToken_Release( &This->ISpObjectToken_iface );
1534+
}
1535+
1536+
static HRESULT WINAPI speech_token_GetTypeInfoCount( ISpeechObjectToken *iface,
1537+
UINT *count )
1538+
{
1539+
1540+
FIXME( "stub\n" );
1541+
return E_NOTIMPL;
1542+
}
1543+
1544+
static HRESULT WINAPI speech_token_GetTypeInfo( ISpeechObjectToken *iface,
1545+
UINT index,
1546+
LCID lcid,
1547+
ITypeInfo **type_info )
1548+
{
1549+
FIXME( "stub\n" );
1550+
return E_NOTIMPL;
1551+
}
1552+
1553+
static HRESULT WINAPI speech_token_GetIDsOfNames( ISpeechObjectToken *iface,
1554+
REFIID iid,
1555+
LPOLESTR *names,
1556+
UINT count,
1557+
LCID lcid,
1558+
DISPID *dispids )
1559+
{
1560+
FIXME( "stub\n" );
1561+
return E_NOTIMPL;
1562+
}
1563+
1564+
static HRESULT WINAPI speech_token_Invoke( ISpeechObjectToken *iface,
1565+
DISPID dispid,
1566+
REFIID iid,
1567+
LCID lcid,
1568+
WORD flags,
1569+
DISPPARAMS *params,
1570+
VARIANT *result,
1571+
EXCEPINFO *excepinfo,
1572+
UINT *argerr )
1573+
{
1574+
FIXME( "stub\n" );
1575+
return E_NOTIMPL;
1576+
}
1577+
1578+
static HRESULT WINAPI speech_token_get_Id( ISpeechObjectToken *iface,
1579+
BSTR *id )
1580+
{
1581+
FIXME( "stub\n" );
1582+
return E_NOTIMPL;
1583+
}
1584+
1585+
static HRESULT WINAPI speech_token_get_DataKey( ISpeechObjectToken *iface,
1586+
ISpeechDataKey **key )
1587+
{
1588+
FIXME( "stub\n" );
1589+
return E_NOTIMPL;
1590+
}
1591+
1592+
static HRESULT WINAPI speech_token_get_Category( ISpeechObjectToken *iface,
1593+
ISpeechObjectTokenCategory **cat )
1594+
{
1595+
FIXME( "stub\n" );
1596+
return E_NOTIMPL;
1597+
}
1598+
1599+
static HRESULT WINAPI speech_token_GetDescription( ISpeechObjectToken *iface,
1600+
LONG locale, BSTR *desc )
1601+
{
1602+
FIXME( "stub\n" );
1603+
return E_NOTIMPL;
1604+
}
1605+
1606+
static HRESULT WINAPI speech_token_SetId( ISpeechObjectToken *iface,
1607+
BSTR id, BSTR category_id,
1608+
VARIANT_BOOL create )
1609+
{
1610+
FIXME( "stub\n" );
1611+
return E_NOTIMPL;
1612+
}
1613+
1614+
static HRESULT WINAPI speech_token_GetAttribute( ISpeechObjectToken *iface,
1615+
BSTR name, BSTR *value )
1616+
{
1617+
FIXME( "stub\n" );
1618+
return E_NOTIMPL;
1619+
}
1620+
1621+
static HRESULT WINAPI speech_token_CreateInstance( ISpeechObjectToken *iface,
1622+
IUnknown *outer,
1623+
SpeechTokenContext clsctx,
1624+
IUnknown **object )
1625+
{
1626+
FIXME( "stub\n" );
1627+
return E_NOTIMPL;
1628+
}
1629+
1630+
static HRESULT WINAPI speech_token_Remove( ISpeechObjectToken *iface,
1631+
BSTR clsid )
1632+
{
1633+
FIXME( "stub\n" );
1634+
return E_NOTIMPL;
1635+
}
1636+
1637+
static HRESULT WINAPI speech_token_GetStorageFileName( ISpeechObjectToken *iface,
1638+
BSTR clsid,
1639+
BSTR key,
1640+
BSTR name,
1641+
SpeechTokenShellFolder folder,
1642+
BSTR *path )
1643+
{
1644+
FIXME( "stub\n" );
1645+
return E_NOTIMPL;
1646+
}
1647+
1648+
static HRESULT WINAPI speech_token_RemoveStorageFileName( ISpeechObjectToken *iface,
1649+
BSTR clsid,
1650+
BSTR key,
1651+
VARIANT_BOOL remove )
1652+
{
1653+
FIXME( "stub\n" );
1654+
return E_NOTIMPL;
1655+
}
1656+
1657+
static HRESULT WINAPI speech_token_IsUISupported( ISpeechObjectToken *iface,
1658+
const BSTR type,
1659+
const VARIANT *data,
1660+
IUnknown *object,
1661+
VARIANT_BOOL *supported )
1662+
{
1663+
FIXME( "stub\n" );
1664+
return E_NOTIMPL;
1665+
}
1666+
1667+
static HRESULT WINAPI speech_token_DisplayUI( ISpeechObjectToken *iface,
1668+
LONG hwnd,
1669+
BSTR title,
1670+
const BSTR type,
1671+
const VARIANT *data,
1672+
IUnknown *object )
1673+
{
1674+
FIXME( "stub\n" );
1675+
return E_NOTIMPL;
1676+
}
1677+
1678+
static HRESULT WINAPI speech_token_MatchesAttributes( ISpeechObjectToken *iface,
1679+
const BSTR attributes,
1680+
VARIANT_BOOL *matches )
1681+
{
1682+
FIXME( "stub\n" );
1683+
return E_NOTIMPL;
1684+
}
1685+
1686+
const struct ISpeechObjectTokenVtbl speech_token_vtbl =
1687+
{
1688+
speech_token_QueryInterface,
1689+
speech_token_AddRef,
1690+
speech_token_Release,
1691+
speech_token_GetTypeInfoCount,
1692+
speech_token_GetTypeInfo,
1693+
speech_token_GetIDsOfNames,
1694+
speech_token_Invoke,
1695+
speech_token_get_Id,
1696+
speech_token_get_DataKey,
1697+
speech_token_get_Category,
1698+
speech_token_GetDescription,
1699+
speech_token_SetId,
1700+
speech_token_GetAttribute,
1701+
speech_token_CreateInstance,
1702+
speech_token_Remove,
1703+
speech_token_GetStorageFileName,
1704+
speech_token_RemoveStorageFileName,
1705+
speech_token_IsUISupported,
1706+
speech_token_DisplayUI,
1707+
speech_token_MatchesAttributes
1708+
};
1709+
14981710
HRESULT token_create( IUnknown *outer, REFIID iid, void **obj )
14991711
{
15001712
struct object_token *This = malloc( sizeof(*This) );
15011713
HRESULT hr;
15021714

15031715
if (!This) return E_OUTOFMEMORY;
15041716
This->ISpObjectToken_iface.lpVtbl = &token_vtbl;
1717+
This->ISpeechObjectToken_iface.lpVtbl = &speech_token_vtbl;
15051718
This->ref = 1;
15061719

15071720
This->data_key = NULL;

include/sapi.idl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ library SpeechLib
12931293
coclass SpObjectToken
12941294
{
12951295
interface ISpObjectToken;
1296-
[default] interface ISpDataKey;
1296+
[default] interface ISpeechObjectToken;
12971297
}
12981298

12991299
[

0 commit comments

Comments
 (0)