https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d795021a750e92f320c3a…
commit d795021a750e92f320c3a07c73bfe3cbcc799567
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Dec 3 07:46:35 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Dec 3 07:46:35 2023 +0900
[IMM32][SDK] Implement GetKeyboardLayoutCP (#6068)
- Add IMM32!GetKeyboardLayoutCP function.
- Add it to <imm32_undoc.h>.
- Delete ImmDisableLegacyIME and
ImmSendMessageToActiveDefImeWndW functions
(2k3/xp IMM32 doesn't have such functions).
- Modify imm32.spec.
- Refer ntdll!RtlDllShutdownInProgress function (that is WinXP+).
CORE-19268
---
dll/win32/imm32/ctf.c | 21 ++++-----------------
dll/win32/imm32/ime.c | 9 ---------
dll/win32/imm32/imm.c | 32 +++++++++++++++++++++++++++-----
dll/win32/imm32/imm32.spec | 3 +--
dll/win32/imm32/keymsg.c | 18 ------------------
sdk/include/reactos/imm32_undoc.h | 2 ++
6 files changed, 34 insertions(+), 51 deletions(-)
diff --git a/dll/win32/imm32/ctf.c b/dll/win32/imm32/ctf.c
index be1853f02c3..23e4b41c3ed 100644
--- a/dll/win32/imm32/ctf.c
+++ b/dll/win32/imm32/ctf.c
@@ -1,7 +1,7 @@
/*
* PROJECT: ReactOS IMM32
* LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later)
- * PURPOSE: Implementing the IMM32 Cicero-aware Text Framework (CTF)
+ * PURPOSE: Implementing IMM CTF (Collaborative Translation Framework)
* COPYRIGHT: Copyright 2022-2023 Katayama Hirofumi MZ
<katayama.hirofumi.mz(a)gmail.com>
*/
@@ -11,11 +11,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(imm);
-/* FIXME: Use RTL */
-static BOOL WINAPI RtlDllShutdownInProgress(VOID)
-{
- return FALSE;
-}
+/* FIXME: Use proper header */
+BOOLEAN WINAPI RtlDllShutdownInProgress(VOID);
static BOOL Imm32InsideLoaderLock(VOID)
{
@@ -201,17 +198,7 @@ VOID Imm32TF_InvalidAssemblyListCacheIfExist(VOID)
}
/***********************************************************************
- * CTF IME support
- *
- * TSF stands for "Text Services Framework". "Cicero" is the code
name of TSF.
- * CTF stands for "Cicero-aware Text Framework".
- *
- * Comparing with old-style IMM IME, the combination of CTF IME and TSF provides
- * new-style and high-level input method.
- *
- * The CTF IME file is a DLL file that the software developer distributes.
- * The export functions of the CTF IME file are defined in <CtfImeTable.h> of
- * this folder.
+ * CTF (Collaborative Translation Framework) IME support
*/
/* "Active IMM" compatibility flags */
diff --git a/dll/win32/imm32/ime.c b/dll/win32/imm32/ime.c
index 9268b66a0a7..a30b86af31b 100644
--- a/dll/win32/imm32/ime.c
+++ b/dll/win32/imm32/ime.c
@@ -925,15 +925,6 @@ BOOL WINAPI ImmNotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex,
DWORD dwValue
return ret;
}
-/***********************************************************************
- * ImmDisableLegacyIME(IMM32.@)
- */
-BOOL WINAPI ImmDisableLegacyIME(void)
-{
- FIXME("stub\n");
- return TRUE;
-}
-
/***********************************************************************
* ImmGetImeInfoEx (IMM32.@)
*/
diff --git a/dll/win32/imm32/imm.c b/dll/win32/imm32/imm.c
index 5723fde1a59..3ea5bae50ea 100644
--- a/dll/win32/imm32/imm.c
+++ b/dll/win32/imm32/imm.c
@@ -14,13 +14,12 @@
WINE_DEFAULT_DEBUG_CHANNEL(imm);
-HMODULE ghImm32Inst = NULL; // Win: ghInst
-PSERVERINFO gpsi = NULL; // Win: gpsi
-SHAREDINFO gSharedInfo = { NULL }; // Win: gSharedInfo
-BYTE gfImmInitialized = FALSE; // Win: gfInitialized
+HMODULE ghImm32Inst = NULL; /* The IMM32 instance */
+PSERVERINFO gpsi = NULL;
+SHAREDINFO gSharedInfo = { NULL };
+BYTE gfImmInitialized = FALSE; /* Is IMM32 initialized? */
ULONG_PTR gHighestUserAddress = 0;
-// Win: ImmInitializeGlobals
static BOOL APIENTRY ImmInitializeGlobals(HMODULE hMod)
{
NTSTATUS status;
@@ -1257,6 +1256,29 @@ BOOL WINAPI ImmSetActiveContextConsoleIME(HWND hwnd, BOOL fFlag)
return ImmSetActiveContext(hwnd, hIMC, fFlag);
}
+/***********************************************************************
+ * GetKeyboardLayoutCP (IMM32.@)
+ */
+UINT WINAPI GetKeyboardLayoutCP(_In_ LANGID wLangId)
+{
+ WCHAR szText[8];
+ static LANGID s_wKeyboardLangIdCache = 0;
+ static UINT s_uKeyboardLayoutCPCache = 0;
+
+ TRACE("(%u)\n", wLangId);
+
+ if (wLangId == s_wKeyboardLangIdCache)
+ return s_uKeyboardLayoutCPCache;
+
+ if (!GetLocaleInfoW(wLangId, LOCALE_IDEFAULTANSICODEPAGE, szText, _countof(szText)))
+ return 0;
+
+ s_wKeyboardLangIdCache = wLangId;
+ szText[_countof(szText) - 1] = UNICODE_NULL; /* Avoid buffer overrun */
+ s_uKeyboardLayoutCPCache = wcstol(szText, NULL, 10);
+ return s_uKeyboardLayoutCPCache;
+}
+
#ifndef NDEBUG
VOID APIENTRY Imm32UnitTest(VOID)
{
diff --git a/dll/win32/imm32/imm32.spec b/dll/win32/imm32/imm32.spec
index 2e84d6a143c..3bd4c297f44 100644
--- a/dll/win32/imm32/imm32.spec
+++ b/dll/win32/imm32/imm32.spec
@@ -17,6 +17,7 @@
@ stdcall CtfImmSetAppCompatFlags(long)
@ stdcall CtfImmSetCiceroStartInThread(long)
@ stdcall CtfImmTIMActivate(ptr)
+@ stdcall GetKeyboardLayoutCP(long)
@ stdcall ImmActivateLayout(ptr)
@ stdcall ImmAssociateContext(ptr ptr)
@ stdcall ImmAssociateContextEx(ptr ptr long)
@@ -31,7 +32,6 @@
@ stdcall ImmDestroySoftKeyboard(ptr)
@ stdcall ImmDisableIME(long)
@ stdcall ImmDisableIme(long) ImmDisableIME
-@ stdcall ImmDisableLegacyIME()
@ stdcall ImmDisableTextFrameService(long)
@ stdcall ImmEnumInputContext(long ptr long)
@ stdcall ImmEnumRegisterWordA(long ptr str long str ptr)
@@ -105,7 +105,6 @@
@ stdcall ImmRequestMessageW(ptr ptr ptr)
@ stdcall ImmSendIMEMessageExA(ptr ptr)
@ stdcall ImmSendIMEMessageExW(ptr ptr)
-@ stdcall ImmSendMessageToActiveDefImeWndW(long ptr ptr)
@ stdcall ImmSetActiveContext(ptr ptr long)
@ stdcall ImmSetActiveContextConsoleIME(ptr long)
@ stdcall ImmSetCandidateWindow(ptr ptr)
diff --git a/dll/win32/imm32/keymsg.c b/dll/win32/imm32/keymsg.c
index 3f2fb48be31..4131b751071 100644
--- a/dll/win32/imm32/keymsg.c
+++ b/dll/win32/imm32/keymsg.c
@@ -1184,24 +1184,6 @@ LRESULT WINAPI ImmRequestMessageW(HIMC hIMC, WPARAM wParam, LPARAM
lParam)
return ImmRequestMessageAW(hIMC, wParam, lParam, FALSE);
}
-/***********************************************************************
- * ImmSendMessageToActiveDefImeWndW (IMM32.@)
- */
-LRESULT WINAPI
-ImmSendMessageToActiveDefImeWndW(UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- HWND hwndIME;
-
- if (uMsg != WM_COPYDATA)
- return 0;
-
- hwndIME = (HWND)NtUserQueryWindow((HWND)wParam, QUERY_WINDOW_DEFAULT_IME);
- if (IS_NULL_UNEXPECTEDLY(hwndIME))
- return 0;
-
- return SendMessageW(hwndIME, uMsg, wParam, lParam);
-}
-
/***********************************************************************
* ImmCallImeConsoleIME (IMM32.@)
*/
diff --git a/sdk/include/reactos/imm32_undoc.h b/sdk/include/reactos/imm32_undoc.h
index 08be32a2dcd..75eb48f5692 100644
--- a/sdk/include/reactos/imm32_undoc.h
+++ b/sdk/include/reactos/imm32_undoc.h
@@ -11,6 +11,8 @@
extern "C" {
#endif
+UINT WINAPI GetKeyboardLayoutCP(_In_ LANGID wLangId);
+
BOOL WINAPI
ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey);