mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[MSCTFIME][MSCTF][SDK] Add compartment helper functions (#6202)
- Implement GetCompartment, SetCompartmentDWORD, GetCompartmentDWORD, SetCompartmentUnknown, and ClearCompartment helper functions. - Add TF_DllDetachInOther prototype to "msctf.idl". CORE-19360
This commit is contained in:
parent
0d8e6e781c
commit
9d495475f0
3 changed files with 144 additions and 3 deletions
|
@ -164,6 +164,146 @@ void TFUninitLib_Thread(PLIBTHREAD pLibThread)
|
|||
}
|
||||
}
|
||||
|
||||
HRESULT
|
||||
GetCompartment(
|
||||
IUnknown *pUnknown,
|
||||
REFGUID rguid,
|
||||
ITfCompartment **ppComp,
|
||||
BOOL bThread)
|
||||
{
|
||||
ITfThreadMgr *pThreadMgr = NULL;
|
||||
ITfCompartmentMgr *pCompMgr = NULL;
|
||||
|
||||
*ppComp = NULL;
|
||||
HRESULT hr;
|
||||
if (bThread)
|
||||
{
|
||||
hr = pUnknown->QueryInterface(IID_ITfThreadMgr, (void **)&pThreadMgr);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pThreadMgr->GetGlobalCompartment(&pCompMgr);
|
||||
}
|
||||
else
|
||||
{
|
||||
hr = pUnknown->QueryInterface(IID_ITfCompartmentMgr, (void **)&pCompMgr);
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if (pCompMgr)
|
||||
hr = pCompMgr->GetCompartment(rguid, ppComp);
|
||||
else
|
||||
hr = E_FAIL;
|
||||
}
|
||||
|
||||
if (pThreadMgr)
|
||||
pThreadMgr->Release();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
SetCompartmentDWORD(
|
||||
TfEditCookie cookie,
|
||||
IUnknown *pUnknown,
|
||||
REFGUID rguid,
|
||||
VARTYPE type,
|
||||
BOOL bThread)
|
||||
{
|
||||
ITfCompartment *pComp = NULL;
|
||||
HRESULT hr = GetCompartment(pUnknown, rguid, &pComp, bThread);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
VARIANT vari;
|
||||
V_I4(&vari) = type;
|
||||
V_VT(&vari) = VT_I4;
|
||||
hr = pComp->SetValue(cookie, &vari);
|
||||
pComp->Release();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
GetCompartmentDWORD(
|
||||
IUnknown *pUnknown,
|
||||
REFGUID rguid,
|
||||
ITfCompartment *pComp,
|
||||
BOOL bThread)
|
||||
{
|
||||
HRESULT hr = GetCompartment(pUnknown, rguid, &pComp, bThread);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
VARIANT vari;
|
||||
hr = pComp->GetValue(&vari);
|
||||
pComp->Release();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
SetCompartmentUnknown(
|
||||
TfEditCookie cookie,
|
||||
IUnknown *pUnknown,
|
||||
REFGUID rguid,
|
||||
IUnknown *pUnknown2)
|
||||
{
|
||||
ITfCompartment *pComp = NULL;
|
||||
HRESULT hr = GetCompartment(pUnknown, rguid, &pComp, FALSE);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
VARIANT vari;
|
||||
V_UNKNOWN(&vari) = pUnknown2;
|
||||
V_VT(&vari) = VT_UNKNOWN;
|
||||
hr = pComp->SetValue(cookie, &vari);
|
||||
pComp->Release();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
ClearCompartment(
|
||||
TfClientId tid,
|
||||
IUnknown *pUnknown,
|
||||
REFGUID rguid,
|
||||
BOOL bThread)
|
||||
{
|
||||
ITfCompartmentMgr *pCompMgr = NULL;
|
||||
ITfThreadMgr *pThreadMgr = NULL;
|
||||
|
||||
HRESULT hr;
|
||||
if (bThread)
|
||||
{
|
||||
hr = pUnknown->QueryInterface(IID_ITfThreadMgr, (void **)&pThreadMgr);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = pThreadMgr->GetGlobalCompartment(&pCompMgr);
|
||||
}
|
||||
else
|
||||
{
|
||||
hr = pUnknown->QueryInterface(IID_ITfCompartmentMgr, (void **)&pCompMgr);
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = E_FAIL;
|
||||
if (pCompMgr)
|
||||
{
|
||||
hr = pCompMgr->ClearCompartment(tid, rguid);
|
||||
pCompMgr->Release();
|
||||
}
|
||||
}
|
||||
|
||||
if (pThreadMgr)
|
||||
pThreadMgr->Release();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
/* FIXME */
|
||||
class CicInputContext : public ITfContextOwnerCompositionSink
|
||||
{
|
||||
|
@ -2155,7 +2295,7 @@ VOID ProcessDetach(HINSTANCE hinstDLL)
|
|||
}
|
||||
|
||||
/**
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
EXTERN_C BOOL WINAPI
|
||||
DllMain(
|
||||
|
@ -2182,7 +2322,7 @@ DllMain(
|
|||
}
|
||||
case DLL_THREAD_DETACH:
|
||||
{
|
||||
// FIXME
|
||||
TF_DllDetachInOther();
|
||||
CtfImeThreadDetach();
|
||||
TLS::InternalDestroyTLS();
|
||||
break;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
@ stdcall TF_CreateLangBarItemMgr(ptr)
|
||||
@ stdcall TF_CreateLangBarMgr(ptr)
|
||||
@ stdcall TF_CreateThreadMgr(ptr)
|
||||
@ stub TF_DllDetachInOther
|
||||
@ stdcall -stub TF_DllDetachInOther()
|
||||
@ stdcall -stub TF_GetGlobalCompartment(ptr)
|
||||
@ stub TF_GetInputScope
|
||||
@ stub TF_GetLangIcon
|
||||
|
|
|
@ -40,6 +40,7 @@ cpp_quote("EXTERN_C HRESULT WINAPI TF_CreateLangBarItemMgr(_Out_ ITfLangBarItemM
|
|||
cpp_quote("EXTERN_C HANDLE WINAPI TF_CreateCicLoadMutex(_Out_ LPBOOL pfWinLogon);")
|
||||
cpp_quote("EXTERN_C HRESULT WINAPI TF_InvalidAssemblyListCache(VOID);")
|
||||
cpp_quote("EXTERN_C HRESULT WINAPI TF_InvalidAssemblyListCacheIfExist(VOID);")
|
||||
cpp_quote("EXTERN_C HRESULT WINAPI TF_DllDetachInOther(VOID);")
|
||||
|
||||
cpp_quote("EXTERN_C const GUID GUID_PROP_TEXTOWNER;")
|
||||
cpp_quote("EXTERN_C const GUID GUID_PROP_ATTRIBUTE;")
|
||||
|
|
Loading…
Reference in a new issue