https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6bc40d36f8b3151bbd705…
commit 6bc40d36f8b3151bbd7057d085a79fcc0bab5db7
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Tue Feb 20 14:36:24 2024 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Feb 20 14:36:24 2024 +0900
[CTFMON][MSCTFIME][MSCTF][MSUTB][CICERO] Fix TFUninitLib (#6504)
Supporting the Language bar...
JIRA issue: CORE-19363
- Delete TFInitLib and TFUninitLib
calls from ctfmon.exe.
- Delete TFUninitLib from Cicero
library.
- Implement InitDisplayAttrbuteLib
in msctfime.ime.
- Improve CIC_LIBTHREAD structure.
---
base/applications/ctfmon/ctfmon.cpp | 6 ---
dll/ime/msctfime/msctfime.cpp | 76 ++++++++++++++++++++++++++++++++++---
dll/win32/msctf/utils.cpp | 5 +++
dll/win32/msutb/msutb.cpp | 5 +++
sdk/lib/cicero/cicbase.cpp | 10 -----
sdk/lib/cicero/cicutb.h | 10 +++--
6 files changed, 87 insertions(+), 25 deletions(-)
diff --git a/base/applications/ctfmon/ctfmon.cpp b/base/applications/ctfmon/ctfmon.cpp
index 6c255f18b2e..331fd19cc37 100644
--- a/base/applications/ctfmon/ctfmon.cpp
+++ b/base/applications/ctfmon/ctfmon.cpp
@@ -194,9 +194,6 @@ InitApp(
g_bOnWow64 = cicIsWow64(); // Is the current process on WoW64?
cicGetOSInfo(&g_uACP, &g_dwOsInfo); // Get OS info
- // Initialize Cicero
- TFInitLib();
-
// Create a mutex for Cicero
g_hCicMutex = TF_CreateCicLoadMutex(&g_fWinLogon);
if (!g_hCicMutex)
@@ -251,9 +248,6 @@ UninitApp(VOID)
// Close Tipbar Popup
ClosePopupTipbar();
- // Release Cicero
- TFUninitLib();
-
// Close the mutex
::CloseHandle(g_hCicMutex);
g_hCicMutex = NULL;
diff --git a/dll/ime/msctfime/msctfime.cpp b/dll/ime/msctfime/msctfime.cpp
index c1353076be1..ccd442083ab 100644
--- a/dll/ime/msctfime/msctfime.cpp
+++ b/dll/ime/msctfime/msctfime.cpp
@@ -10,12 +10,15 @@
WINE_DEFAULT_DEBUG_CHANNEL(msctfime);
+typedef CicArray<GUID> CDispAttrPropCache;
+
HINSTANCE g_hInst = NULL; /* The instance of this module */
BOOL g_bWinLogon = FALSE;
UINT g_uACP = CP_ACP;
DWORD g_dwOSInfo = 0;
BOOL gfTFInitLib = FALSE;
CRITICAL_SECTION g_csLock;
+CDispAttrPropCache *g_pPropCache = NULL;
DEFINE_GUID(GUID_COMPARTMENT_CTFIME_DIMFLAGS, 0xA94C5FD2, 0xC471, 0x4031, 0x95,
0x46, 0x70, 0x9C, 0x17, 0x30, 0x0C, 0xB9);
DEFINE_GUID(GUID_COMPARTMENT_CTFIME_CICINPUTCONTEXT, 0x85A688F7, 0x6DC8, 0x4F17, 0xA8,
0x3A, 0xB1, 0x1C, 0x09, 0xCD, 0xD7, 0xBF);
@@ -124,6 +127,33 @@ IsInteractiveUserLogon(VOID)
return bOK && IsMember;
}
+/// @implemented
+ITfCategoryMgr *GetUIMCat(PCIC_LIBTHREAD pLibThread)
+{
+ if (!pLibThread)
+ return NULL;
+
+ if (pLibThread->m_pCategoryMgr)
+ return pLibThread->m_pCategoryMgr;
+
+ if (FAILED(cicCoCreateInstance(CLSID_TF_CategoryMgr, NULL, CLSCTX_INPROC_SERVER,
+ IID_ITfCategoryMgr, (void
**)&pLibThread->m_pCategoryMgr)))
+ {
+ return NULL;
+ }
+ return pLibThread->m_pCategoryMgr;
+}
+
+/// @implemented
+HRESULT LibEnumItemsInCategory(PCIC_LIBTHREAD pLibThread, REFGUID rguid, IEnumGUID
**ppEnum)
+{
+ ITfCategoryMgr *pCat = GetUIMCat(pLibThread);
+ if (!pCat)
+ return E_FAIL;
+ return pCat->EnumItemsInCategory(rguid, ppEnum);
+}
+
+/// @implemented
HRESULT InitDisplayAttrbuteLib(PCIC_LIBTHREAD pLibThread)
{
if (!pLibThread)
@@ -135,8 +165,37 @@ HRESULT InitDisplayAttrbuteLib(PCIC_LIBTHREAD pLibThread)
pLibThread->m_pDisplayAttrMgr = NULL;
}
- //FIXME
- return E_NOTIMPL;
+ if (FAILED(cicCoCreateInstance(CLSID_TF_DisplayAttributeMgr, NULL,
CLSCTX_INPROC_SERVER,
+ IID_ITfDisplayAttributeMgr,
+ (void **)&pLibThread->m_pDisplayAttrMgr)))
+ {
+ return E_FAIL;
+ }
+
+ IEnumGUID *pEnumGuid;
+ LibEnumItemsInCategory(pLibThread, GUID_TFCAT_DISPLAYATTRIBUTEPROPERTY,
&pEnumGuid);
+
+ HRESULT hr = E_OUTOFMEMORY;
+
+ ::EnterCriticalSection(&g_csLock);
+ if (pEnumGuid && !g_pPropCache)
+ {
+ g_pPropCache = new(cicNoThrow) CDispAttrPropCache();
+ if (g_pPropCache)
+ {
+ g_pPropCache->Add(GUID_PROP_ATTRIBUTE);
+ GUID guid;
+ while (pEnumGuid->Next(1, &guid, NULL) == S_OK)
+ {
+ if (!IsEqualGUID(guid, GUID_PROP_ATTRIBUTE))
+ g_pPropCache->Add(guid);
+ }
+ hr = S_OK;
+ }
+ }
+ ::LeaveCriticalSection(&g_csLock);
+
+ return hr;
}
HIMC GetActiveContext(VOID)
@@ -3646,6 +3705,15 @@ VOID DetachIME(VOID)
UnregisterImeClass();
}
+EXTERN_C VOID TFUninitLib(VOID)
+{
+ if (g_pPropCache)
+ {
+ delete g_pPropCache;
+ g_pPropCache = NULL;
+ }
+}
+
/// @implemented
BOOL ProcessAttach(HINSTANCE hinstDLL)
{
@@ -3667,11 +3735,9 @@ BOOL ProcessAttach(HINSTANCE hinstDLL)
return AttachIME();
}
-/// @unimplemented
+/// @implemented
VOID ProcessDetach(HINSTANCE hinstDLL)
{
- // FIXME
-
TF_DllDetachInOther();
if (gfTFInitLib)
diff --git a/dll/win32/msctf/utils.cpp b/dll/win32/msctf/utils.cpp
index 4fc57a5ac0d..ec469ceef28 100644
--- a/dll/win32/msctf/utils.cpp
+++ b/dll/win32/msctf/utils.cpp
@@ -519,6 +519,11 @@ VOID InitCUASFlag(VOID)
}
}
+EXTERN_C VOID TFUninitLib(VOID)
+{
+ // Do nothing
+}
+
/**
* @unimplemented
*/
diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp
index 74c537ede80..912edc45598 100644
--- a/dll/win32/msutb/msutb.cpp
+++ b/dll/win32/msutb/msutb.cpp
@@ -6207,6 +6207,11 @@ BEGIN_OBJECT_MAP(ObjectMap)
#endif
END_OBJECT_MAP()
+EXTERN_C VOID TFUninitLib(VOID)
+{
+ // Do nothing
+}
+
/// @implemented
BOOL ProcessAttach(HINSTANCE hinstDLL)
{
diff --git a/sdk/lib/cicero/cicbase.cpp b/sdk/lib/cicero/cicbase.cpp
index cf76100e1cd..5c93f858d54 100644
--- a/sdk/lib/cicero/cicbase.cpp
+++ b/sdk/lib/cicero/cicbase.cpp
@@ -254,13 +254,3 @@ TFInitLib(FN_CoCreateInstance fnCoCreateInstance)
_cicGetSetUserCoCreateInstance(fnCoCreateInstance);
return TRUE;
}
-
-/**
- * @unimplemented
- */
-EXTERN_C
-VOID
-TFUninitLib(VOID)
-{
- //FIXME
-}
diff --git a/sdk/lib/cicero/cicutb.h b/sdk/lib/cicero/cicutb.h
index b831ecc82bf..18bfbc874f0 100644
--- a/sdk/lib/cicero/cicutb.h
+++ b/sdk/lib/cicero/cicutb.h
@@ -17,10 +17,12 @@ DEFINE_GUID(IID_ITfLangBarMgr_P, 0xD72C0FA9, 0xADD5,
0x4AF0, 0x87,
DEFINE_GUID(IID_ITfLangBarEventSink_P, 0x7A460360, 0xDA21, 0x4B09, 0xA8, 0xA0,
0x8A, 0x69, 0xE7, 0x28, 0xD8, 0x93);
DEFINE_GUID(CLSID_MSUTBDeskBand, 0x540D8A8B, 0x1C3F, 0x4E32, 0x81, 0x32,
0x53, 0x0F, 0x6A, 0x50, 0x20, 0x90);
DEFINE_GUID(CATID_DeskBand, 0x00021492, 0x0000, 0x0000, 0xC0, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
+DEFINE_GUID(
+ GUID_TFCAT_DISPLAYATTRIBUTEPROPERTY, 0xB95F181B, 0xEA4C, 0x4AF1, 0x80, 0x56,
0x7C, 0x32, 0x1A, 0xBB, 0xB0, 0x91);
typedef struct CIC_LIBTHREAD
{
- IUnknown *m_pUnknown1;
+ ITfCategoryMgr *m_pCategoryMgr;
ITfDisplayAttributeMgr *m_pDisplayAttrMgr;
} CIC_LIBTHREAD, *PCIC_LIBTHREAD;
@@ -44,10 +46,10 @@ inline void TFUninitLib_Thread(PCIC_LIBTHREAD pLibThread)
if (!pLibThread)
return;
- if (pLibThread->m_pUnknown1)
+ if (pLibThread->m_pCategoryMgr)
{
- pLibThread->m_pUnknown1->Release();
- pLibThread->m_pUnknown1 = NULL;
+ pLibThread->m_pCategoryMgr->Release();
+ pLibThread->m_pCategoryMgr = NULL;
}
if (pLibThread->m_pDisplayAttrMgr)
{