-
Notifications
You must be signed in to change notification settings - Fork 430
Description
Description
Mozc does specify GUID_TFCAT_TIPCAP_COMLESS.
mozc/src/win32/base/tsf_registrar.cc
Lines 51 to 61 in 51e0d20
| // The categories this text service is registered under. | |
| // This needs to be const as the included constants are defined as const. | |
| const GUID kCategories[] = { | |
| GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER, // It supports inline input. | |
| GUID_TFCAT_TIPCAP_COMLESS, // It's a COM-Less module. | |
| GUID_TFCAT_TIPCAP_INPUTMODECOMPARTMENT, // It supports input mode. | |
| GUID_TFCAT_TIPCAP_UIELEMENTENABLED, // It supports UI less mode. | |
| GUID_TFCAT_TIP_KEYBOARD, // It's a keyboard input method. | |
| GUID_TFCAT_TIPCAP_IMMERSIVESUPPORT, // It supports Metro mode. | |
| GUID_TFCAT_TIPCAP_SYSTRAYSUPPORT, // It supports Win8 systray. | |
| }; |
Thus mozc_tip32.dll and mozc_tip64.dll should not call any COM-based APIs such as CoCreateInpustance.
mozc/src/win32/tip/tip_lang_bar.cc
Lines 144 to 145 in 51e0d20
| lang_bar_item_mgr_ = | |
| ComCreateInstance<ITfLangBarItemMgr>(CLSID_TF_LangBarItemMgr); |
The solution is to use nano-COM style APIs provided by msctf.dll.
For instance, GetCategoryMgr() in tip_text_service.cc does this already.
mozc/src/win32/tip/tip_text_service.cc
Lines 241 to 255 in 51e0d20
| // A COM-independent way to instantiate Category Manager object. | |
| wil::com_ptr_nothrow<ITfCategoryMgr> GetCategoryMgr() { | |
| const HMODULE module = WinUtil::GetSystemModuleHandle(L"msctf.dll"); | |
| if (module == nullptr) { | |
| return nullptr; | |
| } | |
| const auto tf_create_tegory_mgr = | |
| reinterpret_cast<decltype(&TF_CreateCategoryMgr)>( | |
| GetProcAddress(module, "TF_CreateCategoryMgr")); | |
| if (tf_create_tegory_mgr == nullptr) { | |
| return nullptr; | |
| } | |
| wil::com_ptr_nothrow<ITfCategoryMgr> ptr; | |
| return SUCCEEDED(tf_create_tegory_mgr(&ptr)) ? ptr : nullptr; | |
| } |
To avoid loader-lock problem, it'd be safer to let mozc_tip32.dll and mozc_tip64.dll implicitly link to msctf.dll by creating a fake import library, like we did so for input.dll at f470414, rather than relying on GetProcAddress.
Version or commit-id
Environment
- OS: Windows 11 22H2