[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
This commit is contained in:
Katayama Hirofumi MZ 2023-11-02 08:16:12 +09:00 committed by GitHub
parent 64997887eb
commit dabb3f4d61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 82 additions and 4 deletions

View file

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

View file

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

View file

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

View file

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

View file

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