https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dabb3f4d61da14bfb25c6…
commit dabb3f4d61da14bfb25c650a05f5943bea8ea4b4
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Thu Nov 2 08:16:12 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Nov 2 08:16:12 2023 +0900
[IMM32][SDK] Add CtfAImmIsIME, CtfImmSetAppCompatFlags etc. (#5862)
- Add CtfAImmIsIME, CtfImmIsCiceroStartedInThread and CtfImmSetAppCompatFlags
functions.
- Implement CtfImmDispatchDefImeMessage function.
- Modify imm32.spec.
- Add the prototypes of ImmGetAppCompatFlags, CtfAImmIsIME,
CtfImmIsCiceroStartedInThread,
CtfImmSetAppCompatFlags, and CtfImmDispatchDefImeMessage into
<imm32_undoc.h>.
CORE-19268
---
dll/win32/imm32/ctf.c | 62 +++++++++++++++++++++++++++++++++++++--
dll/win32/imm32/imm32.spec | 5 +++-
dll/win32/imm32/keymsg.c | 7 ++++-
dll/win32/imm32/precomp.h | 1 +
sdk/include/reactos/imm32_undoc.h | 11 +++++++
5 files changed, 82 insertions(+), 4 deletions(-)
diff --git a/dll/win32/imm32/ctf.c b/dll/win32/imm32/ctf.c
index eeeae62b588..b403cb3ad59 100644
--- a/dll/win32/imm32/ctf.c
+++ b/dll/win32/imm32/ctf.c
@@ -29,6 +29,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(imm);
* this folder.
*/
+/* "Active IMM" compatibility flags */
+DWORD g_aimm_compat_flags = 0;
+
/* The instance of the CTF IME file */
HINSTANCE g_hCtfIme = NULL;
@@ -192,6 +195,45 @@ CtfImeDestroyThreadMgr(VOID)
return CTF_IME_FN(CtfImeDestroyThreadMgr)();
}
+/***********************************************************************
+ * CtfAImmIsIME (IMM32.@)
+ *
+ * @return TRUE if CTF IME or IMM IME is enabled.
+ */
+BOOL WINAPI
+CtfAImmIsIME(_In_ HKL hKL)
+{
+ TRACE("(%p)\n", hKL);
+ if (!Imm32LoadCtfIme())
+ return ImmIsIME(hKL);
+ return CTF_IME_FN(CtfImeIsIME)(hKL);
+}
+
+/***********************************************************************
+ * CtfImmIsCiceroStartedInThread (IMM32.@)
+ *
+ * @return TRUE if Cicero is started in the current thread.
+ */
+BOOL WINAPI
+CtfImmIsCiceroStartedInThread(VOID)
+{
+ TRACE("()\n");
+ return !!(GetWin32ClientInfo()->CI_flags & 0x200);
+}
+
+/***********************************************************************
+ * CtfImmSetAppCompatFlags (IMM32.@)
+ *
+ * Sets the application compatibility flags.
+ */
+VOID WINAPI
+CtfImmSetAppCompatFlags(_In_ DWORD dwFlags)
+{
+ TRACE("(0x%08X)\n", dwFlags);
+ if (!(dwFlags & 0xF0FFFFFF))
+ g_aimm_compat_flags = dwFlags;
+}
+
/***********************************************************************
* This function calls the same name function of the CTF IME side.
*/
@@ -361,6 +403,18 @@ CtfImmHideToolbarWnd(VOID)
return 0;
}
+BOOL Imm32InsideLoaderLock(VOID)
+{
+ return (NtCurrentTeb()->ProcessEnvironmentBlock->LoaderLock->OwningThread
==
+ NtCurrentTeb()->ClientId.UniqueThread);
+}
+
+/* FIXME: Use RTL */
+BOOL WINAPI RtlDllShutdownInProgress(VOID)
+{
+ return FALSE;
+}
+
/***********************************************************************
* CtfImmDispatchDefImeMessage(IMM32.@)
*/
@@ -371,8 +425,12 @@ CtfImmDispatchDefImeMessage(
_In_ WPARAM wParam,
_In_ LPARAM lParam)
{
- /* FIXME("(%p, %u, %p, %p)\n", hWnd, uMsg, wParam, lParam); */
- return 0;
+ TRACE("(%p, %u, %p, %p)\n", hWnd, uMsg, wParam, lParam);
+
+ if (RtlDllShutdownInProgress() || Imm32InsideLoaderLock() || !Imm32LoadCtfIme())
+ return 0;
+
+ return CTF_IME_FN(CtfImeDispatchDefImeMessage)(hWnd, uMsg, wParam, lParam);
}
/***********************************************************************
diff --git a/dll/win32/imm32/imm32.spec b/dll/win32/imm32/imm32.spec
index eec7202482a..89293195098 100644
--- a/dll/win32/imm32/imm32.spec
+++ b/dll/win32/imm32/imm32.spec
@@ -1,6 +1,8 @@
@ stdcall CtfAImmActivate(ptr)
@ stdcall CtfAImmDeactivate(long)
+@ stdcall CtfAImmIsIME(ptr)
@ stdcall CtfImmIsCiceroEnabled()
+@ stdcall CtfImmIsCiceroStartedInThread()
@ stdcall CtfImmIsTextFrameServiceDisabled()
@ stdcall CtfImmTIMActivate(ptr)
@ stdcall CtfImmRestoreToolbarWnd(long)
@@ -8,6 +10,7 @@
@ stdcall CtfImmDispatchDefImeMessage(ptr long ptr ptr)
@ stdcall CtfImmIsGuidMapEnable(ptr)
@ stdcall CtfImmGetGuidAtom(ptr long ptr)
+@ stdcall CtfImmSetAppCompatFlags(long)
@ stdcall ImmActivateLayout(ptr)
@ stdcall ImmAssociateContext(ptr ptr)
@ stdcall ImmAssociateContextEx(ptr ptr long)
@@ -31,6 +34,7 @@
@ stdcall ImmEscapeW(long ptr long ptr)
@ stdcall ImmFreeLayout(long)
@ stdcall ImmGenerateMessage(ptr)
+@ stdcall ImmGetAppCompatFlags(ptr)
@ stdcall ImmGetCandidateListA(long long ptr long)
@ stdcall ImmGetCandidateListCountA(long ptr)
@ stdcall ImmGetCandidateListCountW(long ptr)
@@ -84,7 +88,6 @@
@ stdcall ImmLockIMCC(ptr)
@ stdcall ImmLockImeDpi(ptr)
@ stdcall ImmNotifyIME(ptr long long long)
-@ stub ImmPenAuxInput
@ stdcall ImmProcessKey(ptr long long long long)
@ stdcall ImmPutImeMenuItemsIntoMappedFile(ptr)
@ stdcall ImmReSizeIMCC(ptr long)
diff --git a/dll/win32/imm32/keymsg.c b/dll/win32/imm32/keymsg.c
index 3e05fe416b9..3f2fb48be31 100644
--- a/dll/win32/imm32/keymsg.c
+++ b/dll/win32/imm32/keymsg.c
@@ -752,18 +752,23 @@ UINT WINAPI ImmGetVirtualKey(HWND hWnd)
return ret;
}
+/***********************************************************************
+ * ImmGetAppCompatFlags (IMM32.@)
+ */
DWORD WINAPI ImmGetAppCompatFlags(HIMC hIMC)
{
PCLIENTIMC pClientIMC;
DWORD dwFlags;
+ TRACE("(%p)\n", hIMC);
+
pClientIMC = ImmLockClientImc(hIMC);
if (IS_NULL_UNEXPECTEDLY(pClientIMC))
return 0;
dwFlags = pClientIMC->dwCompatFlags;
ImmUnlockClientImc(pClientIMC);
- return dwFlags;
+ return (dwFlags | g_aimm_compat_flags);
}
/***********************************************************************
diff --git a/dll/win32/imm32/precomp.h b/dll/win32/imm32/precomp.h
index 6e0512af409..8fc4b27d4b7 100644
--- a/dll/win32/imm32/precomp.h
+++ b/dll/win32/imm32/precomp.h
@@ -75,6 +75,7 @@ extern PIMEDPI gpImeDpiList;
extern PSERVERINFO gpsi;
extern SHAREDINFO gSharedInfo;
extern HANDLE ghImmHeap;
+extern DWORD g_aimm_compat_flags;
BOOL Imm32GetSystemLibraryPath(LPWSTR pszPath, DWORD cchPath, LPCWSTR pszFileName);
VOID APIENTRY LogFontAnsiToWide(const LOGFONTA *plfA, LPLOGFONTW plfW);
diff --git a/sdk/include/reactos/imm32_undoc.h b/sdk/include/reactos/imm32_undoc.h
index 49cb047182a..d2622dd8423 100644
--- a/sdk/include/reactos/imm32_undoc.h
+++ b/sdk/include/reactos/imm32_undoc.h
@@ -20,9 +20,20 @@ VOID WINAPI ImmUnlockClientImc(PCLIENTIMC pClientImc);
PIMEDPI WINAPI ImmLockImeDpi(HKL hKL);
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi);
HRESULT WINAPI CtfImmTIMActivate(HKL hKL);
+DWORD WINAPI ImmGetAppCompatFlags(HIMC hIMC);
HRESULT WINAPI CtfAImmActivate(_Out_opt_ HINSTANCE *phinstCtfIme);
HRESULT WINAPI CtfAImmDeactivate(_In_ BOOL bDestroy);
+BOOL WINAPI CtfAImmIsIME(_In_ HKL hKL);
+BOOL WINAPI CtfImmIsCiceroStartedInThread(VOID);
+VOID WINAPI CtfImmSetAppCompatFlags(_In_ DWORD dwFlags);
+
+LRESULT WINAPI
+CtfImmDispatchDefImeMessage(
+ _In_ HWND hWnd,
+ _In_ UINT uMsg,
+ _In_ WPARAM wParam,
+ _In_ LPARAM lParam);
#ifdef __cplusplus
} // extern "C"