2022-04-07 13:55:33 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS IMM32
|
|
|
|
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
|
2022-08-23 12:57:45 +00:00
|
|
|
* PURPOSE: Implementing the IMM32 Cicero-aware Text Framework (CTF)
|
2022-04-07 13:55:33 +00:00
|
|
|
* COPYRIGHT: Copyright 2022 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "precomp.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(imm);
|
|
|
|
|
2022-08-23 12:57:45 +00:00
|
|
|
/*
|
|
|
|
* NOTE: Microsoft CTF protocol has vulnerability.
|
|
|
|
* If insecure, we don't follow the dangerous design.
|
|
|
|
*
|
|
|
|
* https://www.zdnet.com/article/vulnerability-in-microsoft-ctf-protocol-goes-back-to-windows-xp/
|
|
|
|
* https://googleprojectzero.blogspot.com/2019/08/down-rabbit-hole.html
|
|
|
|
*/
|
|
|
|
|
2022-04-07 13:55:33 +00:00
|
|
|
// Win: LoadCtfIme
|
|
|
|
HMODULE APIENTRY Imm32LoadCtfIme(VOID)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Win: Internal_CtfImeDestroyInputContext
|
|
|
|
HRESULT APIENTRY Imm32CtfImeDestroyInputContext(HIMC hIMC)
|
|
|
|
{
|
|
|
|
if (!Imm32LoadCtfIme())
|
|
|
|
return E_FAIL;
|
2022-10-23 00:51:24 +00:00
|
|
|
|
2022-04-07 13:55:33 +00:00
|
|
|
#if 1
|
|
|
|
FIXME("(%p)\n", hIMC);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
#else
|
|
|
|
return g_pfnCtfImeDestroyInputContext(hIMC);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
// Win: CtfImmTIMDestroyInputContext
|
|
|
|
HRESULT APIENTRY CtfImmTIMDestroyInputContext(HIMC hIMC)
|
|
|
|
{
|
2022-09-08 00:40:50 +00:00
|
|
|
if (!IS_CICERO_MODE() || (GetWin32ClientInfo()->dwCompatFlags2 & 2))
|
2022-04-07 13:55:33 +00:00
|
|
|
return E_NOINTERFACE;
|
|
|
|
|
|
|
|
return Imm32CtfImeDestroyInputContext(hIMC);
|
|
|
|
}
|
|
|
|
|
2022-04-08 13:23:30 +00:00
|
|
|
// Win: CtfImmTIMCreateInputContext
|
|
|
|
HRESULT APIENTRY CtfImmTIMCreateInputContext(HIMC hIMC)
|
|
|
|
{
|
2022-05-08 19:49:14 +00:00
|
|
|
TRACE("(%p)\n", hIMC);
|
2022-04-08 13:23:30 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2022-04-07 13:55:33 +00:00
|
|
|
/***********************************************************************
|
|
|
|
* CtfImmIsCiceroEnabled (IMM32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI CtfImmIsCiceroEnabled(VOID)
|
|
|
|
{
|
2022-09-08 00:40:50 +00:00
|
|
|
return IS_CICERO_MODE();
|
2022-04-07 13:55:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CtfImmIsTextFrameServiceDisabled(IMM32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI CtfImmIsTextFrameServiceDisabled(VOID)
|
|
|
|
{
|
|
|
|
return !!(GetWin32ClientInfo()->CI_flags & CI_TFSDISABLED);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CtfImmTIMActivate(IMM32.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CtfImmTIMActivate(HKL hKL)
|
|
|
|
{
|
|
|
|
FIXME("(%p)\n", hKL);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CtfImmRestoreToolbarWnd(IMM32.@)
|
|
|
|
*/
|
|
|
|
VOID WINAPI CtfImmRestoreToolbarWnd(DWORD dwStatus)
|
|
|
|
{
|
|
|
|
FIXME("(0x%lx)\n", dwStatus);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CtfImmHideToolbarWnd(IMM32.@)
|
|
|
|
*/
|
|
|
|
DWORD WINAPI CtfImmHideToolbarWnd(VOID)
|
|
|
|
{
|
|
|
|
FIXME("()\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CtfImmDispatchDefImeMessage(IMM32.@)
|
|
|
|
*/
|
|
|
|
LRESULT WINAPI CtfImmDispatchDefImeMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2022-10-13 03:08:02 +00:00
|
|
|
/* FIXME("(%p, %u, %p, %p)\n", hWnd, uMsg, wParam, lParam); */
|
2022-04-07 13:55:33 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2022-08-23 12:57:45 +00:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CtfImmIsGuidMapEnable(IMM32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI CtfImmIsGuidMapEnable(HIMC hIMC)
|
|
|
|
{
|
|
|
|
DWORD dwThreadId;
|
|
|
|
HKL hKL;
|
|
|
|
PIMEDPI pImeDpi;
|
|
|
|
BOOL ret = FALSE;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", hIMC);
|
|
|
|
|
2022-09-08 00:43:43 +00:00
|
|
|
if (!IS_CICERO_MODE() || IS_16BIT_MODE())
|
2022-08-23 12:57:45 +00:00
|
|
|
return ret;
|
|
|
|
|
|
|
|
dwThreadId = (DWORD)NtUserQueryInputContext(hIMC, QIC_INPUTTHREADID);
|
|
|
|
hKL = GetKeyboardLayout(dwThreadId);
|
|
|
|
|
|
|
|
if (IS_IME_HKL(hKL))
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
pImeDpi = Imm32FindOrLoadImeDpi(hKL);
|
2022-10-23 00:51:24 +00:00
|
|
|
if (IS_NULL_UNEXPECTEDLY(pImeDpi))
|
2022-08-23 12:57:45 +00:00
|
|
|
return ret;
|
|
|
|
|
2022-09-08 00:57:17 +00:00
|
|
|
ret = pImeDpi->CtfImeIsGuidMapEnable(hIMC);
|
2022-08-23 12:57:45 +00:00
|
|
|
|
|
|
|
ImmUnlockImeDpi(pImeDpi);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* CtfImmGetGuidAtom(IMM32.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CtfImmGetGuidAtom(HIMC hIMC, DWORD dwUnknown, LPDWORD pdwGuidAtom)
|
|
|
|
{
|
|
|
|
HRESULT hr = E_FAIL;
|
|
|
|
PIMEDPI pImeDpi;
|
|
|
|
DWORD dwThreadId;
|
|
|
|
HKL hKL;
|
|
|
|
|
|
|
|
TRACE("(%p, 0xlX, %p)\n", hIMC, dwUnknown, pdwGuidAtom);
|
|
|
|
|
|
|
|
*pdwGuidAtom = 0;
|
|
|
|
|
2022-09-08 00:43:43 +00:00
|
|
|
if (!IS_CICERO_MODE() || IS_16BIT_MODE())
|
2022-08-23 12:57:45 +00:00
|
|
|
return hr;
|
|
|
|
|
|
|
|
dwThreadId = (DWORD)NtUserQueryInputContext(hIMC, QIC_INPUTTHREADID);
|
|
|
|
hKL = GetKeyboardLayout(dwThreadId);
|
|
|
|
if (IS_IME_HKL(hKL))
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
pImeDpi = Imm32FindOrLoadImeDpi(hKL);
|
2022-10-23 00:51:24 +00:00
|
|
|
if (IS_NULL_UNEXPECTEDLY(pImeDpi))
|
2022-08-23 12:57:45 +00:00
|
|
|
return hr;
|
|
|
|
|
2022-09-08 00:57:17 +00:00
|
|
|
hr = pImeDpi->CtfImeGetGuidAtom(hIMC, dwUnknown, pdwGuidAtom);
|
2022-08-23 12:57:45 +00:00
|
|
|
|
|
|
|
ImmUnlockImeDpi(pImeDpi);
|
|
|
|
return hr;
|
|
|
|
}
|