[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
This commit is contained in:
Katayama Hirofumi MZ 2023-12-03 07:46:35 +09:00 committed by GitHub
parent 40b6b1dab3
commit d795021a75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 51 deletions

View file

@ -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@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 */

View file

@ -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.@)
*/

View file

@ -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)
{

View file

@ -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)

View file

@ -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.@)
*/

View file

@ -11,6 +11,8 @@
extern "C" {
#endif
UINT WINAPI GetKeyboardLayoutCP(_In_ LANGID wLangId);
BOOL WINAPI
ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey);