https://git.reactos.org/?p=reactos.git;a=commitdiff;h=97847f20780a79e8148d5d...
commit 97847f20780a79e8148d5d44641b97b634876e69 Author: Katayama Hirofumi MZ katayama.hirofumi.mz@gmail.com AuthorDate: Sun Jul 25 11:56:17 2021 +0900 Commit: GitHub noreply@github.com CommitDate: Sun Jul 25 11:56:17 2021 +0900
[IMM32] Improve ImmGetImeInfoEx (#3833)
- Rewrite ImmGetImeInfoEx function. - Implement CtfImmIsTextFrameServiceDisabled function. - Modify imm32.spec. CORE-11700 --- dll/win32/imm32/imm.c | 57 ++++++++++++++++++++++++++++++++++++++-------- dll/win32/imm32/imm32.spec | 1 + win32ss/include/ntuser.h | 1 + 3 files changed, 50 insertions(+), 9 deletions(-)
diff --git a/dll/win32/imm32/imm.c b/dll/win32/imm32/imm.c index 904e0d25725..53c13d27d9f 100644 --- a/dll/win32/imm32/imm.c +++ b/dll/win32/imm32/imm.c @@ -39,6 +39,7 @@ #include <ndk/pstypes.h> #include <ndk/rtlfuncs.h> #include "../../../win32ss/include/ntuser.h" +#include "../../../win32ss/include/ntwin32.h" #include <imm32_undoc.h> #include <strsafe.h>
@@ -3608,29 +3609,67 @@ BOOL WINAPI ImmRegisterClient(PVOID ptr, /* FIXME: should point to SHAREDINFO st return TRUE; }
+/*********************************************************************** + * CtfImmIsTextFrameServiceDisabled(IMM32.@) + */ +BOOL WINAPI CtfImmIsTextFrameServiceDisabled(VOID) +{ + PTEB pTeb = NtCurrentTeb(); + if (((PW32CLIENTINFO)pTeb->Win32ClientInfo)->CI_flags & CI_TFSDISABLED) + return TRUE; + return FALSE; +} + /*********************************************************************** * ImmGetImeInfoEx (IMM32.@) */ + +static BOOL APIENTRY Imm32GetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType) +{ + return NtUserGetImeInfoEx(pImeInfoEx, SearchType); +} + BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey) { + BOOL bDisabled = FALSE; + HKL hKL; + PTEB pTeb; + switch (SearchType) { case ImeInfoExKeyboardLayout: - pImeInfoEx->hkl = *(LPHKL)pvSearchKey; - if (!IS_IME_HKL(pImeInfoEx->hkl)) - return FALSE; break;
- case ImeInfoExImeFileName: - lstrcpynW(pImeInfoEx->wszImeFile, (LPWSTR)pvSearchKey, - ARRAY_SIZE(pImeInfoEx->wszImeFile)); + case ImeInfoExImeWindow: + bDisabled = CtfImmIsTextFrameServiceDisabled(); + SearchType = ImeInfoExKeyboardLayout; break;
- default: - return FALSE; + case ImeInfoExImeFileName: + StringCchCopyW(pImeInfoEx->wszImeFile, _countof(pImeInfoEx->wszImeFile), + pvSearchKey); + goto Quit; } - return NtUserGetImeInfoEx(pImeInfoEx, SearchType); + + hKL = *(HKL*)pvSearchKey; + pImeInfoEx->hkl = hKL; + + if (!IS_IME_HKL(hKL)) + { + if (g_dwImm32Flags & IMM32_FLAG_CICERO_ENABLED) + { + pTeb = NtCurrentTeb(); + if (((PW32CLIENTINFO)pTeb->Win32ClientInfo)->W32ClientInfo[0] & 2) + return FALSE; + if (!bDisabled) + goto Quit; + } + return FALSE; + } + +Quit: + return Imm32GetImeInfoEx(pImeInfoEx, SearchType); } diff --git a/dll/win32/imm32/imm32.spec b/dll/win32/imm32/imm32.spec index 43107d4797a..3c950672c35 100644 --- a/dll/win32/imm32/imm32.spec +++ b/dll/win32/imm32/imm32.spec @@ -1,4 +1,5 @@ @ stdcall CtfImmIsCiceroEnabled() +@ stdcall CtfImmIsTextFrameServiceDisabled() @ stdcall -stub ImmActivateLayout(long) @ stdcall ImmAssociateContext(ptr ptr) @ stdcall ImmAssociateContextEx(ptr ptr long) diff --git a/win32ss/include/ntuser.h b/win32ss/include/ntuser.h index 54499388337..cc454ba1e2c 100644 --- a/win32ss/include/ntuser.h +++ b/win32ss/include/ntuser.h @@ -281,6 +281,7 @@ typedef struct _CALLBACKWND #define CI_CURTHPRHOOK 0x00000010 #define CI_CLASSESREGISTERED 0x00000020 #define CI_IMMACTIVATE 0x00000040 +#define CI_TFSDISABLED 0x00000400
typedef struct _CLIENTINFO {