https://git.reactos.org/?p=reactos.git;a=commitdiff;h=90e17817fed7be025617c…
commit 90e17817fed7be025617c296ee66ca0240b3f700
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Nov 26 09:20:07 2023 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Sun Nov 26 09:20:07 2023 +0900
[IMM32] Implement CtfImmTIMCreateInputContext
CORE-19268
---
dll/win32/imm32/ctf.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 45 insertions(+), 1 deletion(-)
diff --git a/dll/win32/imm32/ctf.c b/dll/win32/imm32/ctf.c
index a1768d2d659..dd325d472f7 100644
--- a/dll/win32/imm32/ctf.c
+++ b/dll/win32/imm32/ctf.c
@@ -410,8 +410,52 @@ HRESULT
CtfImmTIMCreateInputContext(
_In_ HIMC hIMC)
{
+ PCLIENTIMC pClientImc;
+ DWORD_PTR dwImeThreadId, dwCurrentThreadId;
+ HRESULT hr = S_FALSE;
+
TRACE("(%p)\n", hIMC);
- return E_NOTIMPL;
+
+ pClientImc = ImmLockClientImc(hIMC);
+ if (!pClientImc)
+ return E_FAIL;
+
+ if (GetWin32ClientInfo()->CI_flags & CI_AIMMACTIVATED)
+ {
+ if (!pClientImc->bUnknown4)
+ {
+ dwImeThreadId = NtUserQueryInputContext(hIMC, QIC_INPUTTHREADID);
+ dwCurrentThreadId = GetCurrentThreadId();
+ if (dwImeThreadId == dwCurrentThreadId)
+ {
+ pClientImc->bUnknown4 = 1;
+ hr = CtfImeCreateInputContext(hIMC);
+ if (FAILED(hr))
+ pClientImc->bUnknown4 = 0;
+ }
+ }
+ }
+ else
+ {
+ if (!(GetWin32ClientInfo()->CI_flags & 0x100))
+ return S_OK;
+
+ if (!pClientImc->bUnknown4)
+ {
+ dwImeThreadId = NtUserQueryInputContext(hIMC, QIC_INPUTTHREADID);
+ dwCurrentThreadId = GetCurrentThreadId();
+ if ((dwImeThreadId == dwCurrentThreadId) && IS_CICERO_MODE()
&& !IS_16BIT_MODE())
+ {
+ pClientImc->bUnknown4 = 1;
+ hr = CtfImeCreateInputContext(hIMC);
+ if (FAILED(hr))
+ pClientImc->bUnknown4 = 0;
+ }
+ }
+ }
+
+ ImmUnlockClientImc(pClientImc);
+ return hr;
}
/***********************************************************************