msctf: Implement ITfCategoryMgr::RegisterGUID, ITfCategoryMgr::GetGUID and ITfCategoryMgr::IsEqualTfGuidAtom.
This commit is contained in:
parent
1fa15f3d2f
commit
19c2b7cbcb
|
@ -312,25 +312,77 @@ static HRESULT WINAPI CategoryMgr_RegisterGUID ( ITfCategoryMgr *iface,
|
|||
REFGUID rguid, TfGuidAtom *pguidatom
|
||||
)
|
||||
{
|
||||
DWORD index;
|
||||
GUID *checkguid;
|
||||
DWORD id;
|
||||
CategoryMgr *This = (CategoryMgr*)iface;
|
||||
FIXME("STUB:(%p)\n",This);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p) %s %p\n",This,debugstr_guid(rguid),pguidatom);
|
||||
|
||||
if (!pguidatom)
|
||||
return E_INVALIDARG;
|
||||
|
||||
index = 0;
|
||||
do {
|
||||
id = enumerate_Cookie(COOKIE_MAGIC_GUIDATOM,&index);
|
||||
if (id && IsEqualGUID(rguid,get_Cookie_data(id)))
|
||||
{
|
||||
*pguidatom = id;
|
||||
return S_OK;
|
||||
}
|
||||
} while(id);
|
||||
|
||||
checkguid = HeapAlloc(GetProcessHeap(),0,sizeof(GUID));
|
||||
*checkguid = *rguid;
|
||||
id = generate_Cookie(COOKIE_MAGIC_GUIDATOM,checkguid);
|
||||
|
||||
if (!id)
|
||||
{
|
||||
HeapFree(GetProcessHeap(),0,checkguid);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
*pguidatom = id;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI CategoryMgr_GetGUID ( ITfCategoryMgr *iface,
|
||||
TfGuidAtom guidatom, GUID *pguid)
|
||||
{
|
||||
CategoryMgr *This = (CategoryMgr*)iface;
|
||||
FIXME("STUB:(%p)\n",This);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p) %i\n",This,guidatom);
|
||||
|
||||
if (!pguid)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*pguid = GUID_NULL;
|
||||
|
||||
if (get_Cookie_magic(guidatom) == COOKIE_MAGIC_GUIDATOM)
|
||||
*pguid = *((REFGUID)get_Cookie_data(guidatom));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI CategoryMgr_IsEqualTfGuidAtom ( ITfCategoryMgr *iface,
|
||||
TfGuidAtom guidatom, REFGUID rguid, BOOL *pfEqual)
|
||||
{
|
||||
CategoryMgr *This = (CategoryMgr*)iface;
|
||||
FIXME("STUB:(%p)\n",This);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p) %i %s %p\n",This,guidatom,debugstr_guid(rguid),pfEqual);
|
||||
|
||||
if (!pfEqual)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*pfEqual = FALSE;
|
||||
if (get_Cookie_magic(guidatom) == COOKIE_MAGIC_GUIDATOM)
|
||||
{
|
||||
if (IsEqualGUID(rguid,get_Cookie_data(guidatom)))
|
||||
*pfEqual = TRUE;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -252,6 +252,18 @@ LPVOID remove_Cookie(DWORD id)
|
|||
return cookies[index].data;
|
||||
}
|
||||
|
||||
DWORD enumerate_Cookie(DWORD magic, DWORD *index)
|
||||
{
|
||||
int i;
|
||||
for (i = *index; i < id_last; i++)
|
||||
if (cookies[i].id != 0 && cookies[i].magic == magic)
|
||||
{
|
||||
*index = (i+1);
|
||||
return cookies[i].id;
|
||||
}
|
||||
return 0x0;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* MSCTF DllMain
|
||||
*/
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#define COOKIE_MAGIC_TMSINK 0x0010
|
||||
#define COOKIE_MAGIC_CONTEXTSINK 0x0020
|
||||
#define COOKIE_MAGIC_GUIDATOM 0x0030
|
||||
|
||||
extern DWORD tlsIndex;
|
||||
|
||||
|
@ -37,6 +38,7 @@ extern DWORD generate_Cookie(DWORD magic, LPVOID data);
|
|||
extern DWORD get_Cookie_magic(DWORD id);
|
||||
extern LPVOID get_Cookie_data(DWORD id);
|
||||
extern LPVOID remove_Cookie(DWORD id);
|
||||
extern DWORD enumerate_Cookie(DWORD magic, DWORD *index);
|
||||
|
||||
extern const WCHAR szwSystemTIPKey[];
|
||||
#endif /* __WINE_MSCTF_I_H */
|
||||
|
|
|
@ -609,6 +609,45 @@ static void test_endSession(void)
|
|||
test_OnSetFocus = SINK_UNEXPECTED;
|
||||
}
|
||||
|
||||
static void test_TfGuidAtom(void)
|
||||
{
|
||||
GUID gtest,g1;
|
||||
HRESULT hr;
|
||||
TfGuidAtom atom1,atom2;
|
||||
BOOL equal;
|
||||
|
||||
CoCreateGuid(>est);
|
||||
|
||||
/* msdn reports this should return E_INVALIDARG. However my test show it crashing (winxp)*/
|
||||
/*
|
||||
hr = ITfCategoryMgr_RegisterGUID(g_cm,>est,NULL);
|
||||
ok(hr==E_INVALIDARG,"ITfCategoryMgr_RegisterGUID should have failed\n");
|
||||
*/
|
||||
hr = ITfCategoryMgr_RegisterGUID(g_cm,>est,&atom1);
|
||||
ok(SUCCEEDED(hr),"ITfCategoryMgr_RegisterGUID failed\n");
|
||||
hr = ITfCategoryMgr_RegisterGUID(g_cm,>est,&atom2);
|
||||
ok(SUCCEEDED(hr),"ITfCategoryMgr_RegisterGUID failed\n");
|
||||
ok(atom1 == atom2,"atoms do not match\n");
|
||||
hr = ITfCategoryMgr_GetGUID(g_cm,atom2,NULL);
|
||||
ok(hr==E_INVALIDARG,"ITfCategoryMgr_GetGUID should have failed\n");
|
||||
hr = ITfCategoryMgr_GetGUID(g_cm,atom2,&g1);
|
||||
ok(SUCCEEDED(hr),"ITfCategoryMgr_GetGUID failed\n");
|
||||
ok(IsEqualGUID(&g1,>est),"guids do not match\n");
|
||||
hr = ITfCategoryMgr_IsEqualTfGuidAtom(g_cm,atom1,>est,NULL);
|
||||
ok(hr==E_INVALIDARG,"ITfCategoryMgr_IsEqualTfGuidAtom should have failed\n");
|
||||
hr = ITfCategoryMgr_IsEqualTfGuidAtom(g_cm,atom1,>est,&equal);
|
||||
ok(SUCCEEDED(hr),"ITfCategoryMgr_IsEqualTfGuidAtom failed\n");
|
||||
ok(equal == TRUE,"Equal value invalid\n");
|
||||
|
||||
/* show that cid and tid TfClientIds are also TfGuidAtoms */
|
||||
hr = ITfCategoryMgr_IsEqualTfGuidAtom(g_cm,tid,&CLSID_FakeService,&equal);
|
||||
ok(SUCCEEDED(hr),"ITfCategoryMgr_IsEqualTfGuidAtom failed\n");
|
||||
todo_wine ok(equal == TRUE,"Equal value invalid\n");
|
||||
hr = ITfCategoryMgr_GetGUID(g_cm,cid,&g1);
|
||||
ok(SUCCEEDED(hr),"ITfCategoryMgr_GetGUID failed\n");
|
||||
todo_wine ok(!IsEqualGUID(&g1,&GUID_NULL),"guid should not be NULL\n");
|
||||
}
|
||||
|
||||
START_TEST(inputprocessor)
|
||||
{
|
||||
if (SUCCEEDED(initialize()))
|
||||
|
@ -620,6 +659,7 @@ START_TEST(inputprocessor)
|
|||
test_ThreadMgrAdviseSinks();
|
||||
test_Activate();
|
||||
test_startSession();
|
||||
test_TfGuidAtom();
|
||||
test_KeystrokeMgr();
|
||||
test_endSession();
|
||||
test_EnumLanguageProfiles();
|
||||
|
|
Loading…
Reference in New Issue