Commit f1d7cfa9 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

msctf: Implement ITfClientId.

parent f6f2f934
......@@ -648,6 +648,36 @@ static void test_TfGuidAtom(void)
todo_wine ok(!IsEqualGUID(&g1,&GUID_NULL),"guid should not be NULL\n");
}
static void test_ClientId(void)
{
ITfClientId *pcid;
TfClientId id1,id2;
HRESULT hr;
GUID g2;
hr = ITfThreadMgr_QueryInterface(g_tm, &IID_ITfClientId, (LPVOID*)&pcid);
ok(SUCCEEDED(hr),"Unable to aquire ITfClientId interface\n");
CoCreateGuid(&g2);
hr = ITfClientId_GetClientId(pcid,&GUID_NULL,&id1);
ok(SUCCEEDED(hr),"GetClientId failed\n");
hr = ITfClientId_GetClientId(pcid,&GUID_NULL,&id2);
ok(SUCCEEDED(hr),"GetClientId failed\n");
ok(id1==id2,"Id's for GUID_NULL do not match\n");
hr = ITfClientId_GetClientId(pcid,&CLSID_FakeService,&id2);
ok(SUCCEEDED(hr),"GetClientId failed\n");
ok(id2!=id1,"Id matches GUID_NULL\n");
todo_wine ok(id2==tid,"Id for CLSID_FakeService not matching tid\n");
ok(id2!=cid,"Id for CLSID_FakeService matching cid\n");
hr = ITfClientId_GetClientId(pcid,&g2,&id2);
ok(SUCCEEDED(hr),"GetClientId failed\n");
ok(id2!=id1,"Id matches GUID_NULL\n");
ok(id2!=tid,"Id for random guid matching tid\n");
ok(id2!=cid,"Id for random guid matching cid\n");
ITfClientId_Release(pcid);
}
START_TEST(inputprocessor)
{
if (SUCCEEDED(initialize()))
......@@ -660,6 +690,7 @@ START_TEST(inputprocessor)
test_Activate();
test_startSession();
test_TfGuidAtom();
test_ClientId();
test_KeystrokeMgr();
test_endSession();
test_EnumLanguageProfiles();
......
......@@ -61,6 +61,7 @@ typedef struct tagACLMulti {
const ITfSourceVtbl *SourceVtbl;
const ITfKeystrokeMgrVtbl *KeystrokeMgrVtbl;
const ITfMessagePumpVtbl *MessagePumpVtbl;
const ITfClientIdVtbl *ClientIdVtbl;
LONG refCount;
const ITfThreadMgrEventSinkVtbl *ThreadMgrEventSinkVtbl; /* internal */
......@@ -91,6 +92,11 @@ static inline ThreadMgr *impl_from_ITfMessagePumpVtbl(ITfMessagePump *iface)
return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,MessagePumpVtbl));
}
static inline ThreadMgr *impl_from_ITfClientIdVtbl(ITfClientId *iface)
{
return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,ClientIdVtbl));
}
static inline ThreadMgr *impl_from_ITfThreadMgrEventSink(ITfThreadMgrEventSink *iface)
{
return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,ThreadMgrEventSinkVtbl));
......@@ -173,6 +179,10 @@ static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgr *iface, REFIID iid,
{
*ppvOut = &This->MessagePumpVtbl;
}
else if (IsEqualIID(iid, &IID_ITfClientId))
{
*ppvOut = &This->ClientIdVtbl;
}
if (*ppvOut)
{
......@@ -660,6 +670,54 @@ static const ITfMessagePumpVtbl ThreadMgr_MessagePumpVtbl =
};
/*****************************************************
* ITfClientId functions
*****************************************************/
static HRESULT WINAPI ClientId_QueryInterface(ITfClientId *iface, REFIID iid, LPVOID *ppvOut)
{
ThreadMgr *This = impl_from_ITfClientIdVtbl(iface);
return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut);
}
static ULONG WINAPI ClientId_AddRef(ITfClientId *iface)
{
ThreadMgr *This = impl_from_ITfClientIdVtbl(iface);
return ThreadMgr_AddRef((ITfThreadMgr*)This);
}
static ULONG WINAPI ClientId_Release(ITfClientId *iface)
{
ThreadMgr *This = impl_from_ITfClientIdVtbl(iface);
return ThreadMgr_Release((ITfThreadMgr *)This);
}
static HRESULT WINAPI ClientId_GetClientId(ITfClientId *iface,
REFCLSID rclsid, TfClientId *ptid)
{
HRESULT hr;
ITfCategoryMgr *catmgr;
ThreadMgr *This = impl_from_ITfClientIdVtbl(iface);
TRACE("(%p) %s\n",This,debugstr_guid(rclsid));
CategoryMgr_Constructor(NULL,(IUnknown**)&catmgr);
hr = ITfCategoryMgr_RegisterGUID(catmgr,rclsid,ptid);
ITfCategoryMgr_Release(catmgr);
return hr;
}
static const ITfClientIdVtbl ThreadMgr_ClientIdVtbl =
{
ClientId_QueryInterface,
ClientId_AddRef,
ClientId_Release,
ClientId_GetClientId
};
/*****************************************************
* ITfThreadMgrEventSink functions (internal)
*****************************************************/
static HRESULT WINAPI ThreadMgrEventSink_QueryInterface(ITfThreadMgrEventSink *iface, REFIID iid, LPVOID *ppvOut)
......@@ -803,6 +861,7 @@ HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
This->SourceVtbl = &ThreadMgr_SourceVtbl;
This->KeystrokeMgrVtbl= &ThreadMgr_KeystrokeMgrVtbl;
This->MessagePumpVtbl= &ThreadMgr_MessagePumpVtbl;
This->ClientIdVtbl = &ThreadMgr_ClientIdVtbl;
This->ThreadMgrEventSinkVtbl = &ThreadMgr_ThreadMgrEventSinkVtbl;
This->refCount = 1;
TlsSetValue(tlsIndex,This);
......
......@@ -686,3 +686,16 @@ interface ITfMessagePump : IUnknown
[in] UINT wMsgFilterMax,
[out] BOOL *pfResult);
};
[
object,
local,
uuid(d60a7b49-1b9f-4be2-b702-47e9dc05dec3),
pointer_default(unique)
]
interface ITfClientId : IUnknown
{
HRESULT GetClientId(
[in] REFCLSID rclsid,
[out] TfClientId *ptid);
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment