[IMM32] Improve ImmGetImeInfoEx (#3833)

- Rewrite ImmGetImeInfoEx function.
- Implement CtfImmIsTextFrameServiceDisabled function.
- Modify imm32.spec.
CORE-11700
This commit is contained in:
Katayama Hirofumi MZ 2021-07-25 11:56:17 +09:00 committed by GitHub
parent 5afc324359
commit 97847f2078
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 10 deletions

View file

@ -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 ImeInfoExImeWindow:
bDisabled = CtfImmIsTextFrameServiceDisabled();
SearchType = ImeInfoExKeyboardLayout;
break;
case ImeInfoExImeFileName:
lstrcpynW(pImeInfoEx->wszImeFile, (LPWSTR)pvSearchKey,
ARRAY_SIZE(pImeInfoEx->wszImeFile));
break;
default:
return FALSE;
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);
}

View file

@ -1,4 +1,5 @@
@ stdcall CtfImmIsCiceroEnabled()
@ stdcall CtfImmIsTextFrameServiceDisabled()
@ stdcall -stub ImmActivateLayout(long)
@ stdcall ImmAssociateContext(ptr ptr)
@ stdcall ImmAssociateContextEx(ptr ptr long)

View file

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