ReactOS 0.4.15-dev-5666-gc548b97
ctf.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS IMM32
3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4 * PURPOSE: Implementing the IMM32 Cicero-aware Text Framework (CTF)
5 * COPYRIGHT: Copyright 2022 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6 */
7
8#include "precomp.h"
9
11
12/*
13 * NOTE: Microsoft CTF protocol has vulnerability.
14 * If insecure, we don't follow the dangerous design.
15 *
16 * https://www.zdnet.com/article/vulnerability-in-microsoft-ctf-protocol-goes-back-to-windows-xp/
17 * https://googleprojectzero.blogspot.com/2019/08/down-rabbit-hole.html
18 */
19
20// Win: LoadCtfIme
22{
23 return NULL;
24}
25
26// Win: Internal_CtfImeDestroyInputContext
28{
29 if (!Imm32LoadCtfIme())
30 return E_FAIL;
31
32#if 1
33 FIXME("(%p)\n", hIMC);
34 return E_NOTIMPL;
35#else
36 return g_pfnCtfImeDestroyInputContext(hIMC);
37#endif
38}
39
40// Win: CtfImmTIMDestroyInputContext
42{
43 if (!IS_CICERO_MODE() || (GetWin32ClientInfo()->dwCompatFlags2 & 2))
44 return E_NOINTERFACE;
45
47}
48
49// Win: CtfImmTIMCreateInputContext
51{
52 TRACE("(%p)\n", hIMC);
53 return E_NOTIMPL;
54}
55
56/***********************************************************************
57 * CtfImmIsCiceroEnabled (IMM32.@)
58 */
60{
61 return IS_CICERO_MODE();
62}
63
64/***********************************************************************
65 * CtfImmIsTextFrameServiceDisabled(IMM32.@)
66 */
68{
69 return !!(GetWin32ClientInfo()->CI_flags & CI_TFSDISABLED);
70}
71
72/***********************************************************************
73 * CtfImmTIMActivate(IMM32.@)
74 */
76{
77 FIXME("(%p)\n", hKL);
78 return E_NOTIMPL;
79}
80
81/***********************************************************************
82 * CtfImmRestoreToolbarWnd(IMM32.@)
83 */
85{
86 FIXME("(0x%lx)\n", dwStatus);
87}
88
89/***********************************************************************
90 * CtfImmHideToolbarWnd(IMM32.@)
91 */
93{
94 FIXME("()\n");
95 return 0;
96}
97
98/***********************************************************************
99 * CtfImmDispatchDefImeMessage(IMM32.@)
100 */
102{
103 /* FIXME("(%p, %u, %p, %p)\n", hWnd, uMsg, wParam, lParam); */
104 return 0;
105}
106
107/***********************************************************************
108 * CtfImmIsGuidMapEnable(IMM32.@)
109 */
111{
113 HKL hKL;
114 PIMEDPI pImeDpi;
115 BOOL ret = FALSE;
116
117 TRACE("(%p)\n", hIMC);
118
119 if (!IS_CICERO_MODE() || IS_16BIT_MODE())
120 return ret;
121
124
125 if (IS_IME_HKL(hKL))
126 return ret;
127
128 pImeDpi = Imm32FindOrLoadImeDpi(hKL);
129 if (IS_NULL_UNEXPECTEDLY(pImeDpi))
130 return ret;
131
132 ret = pImeDpi->CtfImeIsGuidMapEnable(hIMC);
133
134 ImmUnlockImeDpi(pImeDpi);
135 return ret;
136}
137
138/***********************************************************************
139 * CtfImmGetGuidAtom(IMM32.@)
140 */
141HRESULT WINAPI CtfImmGetGuidAtom(HIMC hIMC, DWORD dwUnknown, LPDWORD pdwGuidAtom)
142{
143 HRESULT hr = E_FAIL;
144 PIMEDPI pImeDpi;
146 HKL hKL;
147
148 TRACE("(%p, 0xlX, %p)\n", hIMC, dwUnknown, pdwGuidAtom);
149
150 *pdwGuidAtom = 0;
151
152 if (!IS_CICERO_MODE() || IS_16BIT_MODE())
153 return hr;
154
157 if (IS_IME_HKL(hKL))
158 return S_OK;
159
160 pImeDpi = Imm32FindOrLoadImeDpi(hKL);
161 if (IS_NULL_UNEXPECTEDLY(pImeDpi))
162 return hr;
163
164 hr = pImeDpi->CtfImeGetGuidAtom(hIMC, dwUnknown, pdwGuidAtom);
165
166 ImmUnlockImeDpi(pImeDpi);
167 return hr;
168}
HWND hWnd
Definition: settings.c:17
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define FIXME(fmt,...)
Definition: debug.h:111
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
VOID WINAPI CtfImmRestoreToolbarWnd(DWORD dwStatus)
Definition: ctf.c:84
LRESULT WINAPI CtfImmDispatchDefImeMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ctf.c:101
BOOL WINAPI CtfImmIsGuidMapEnable(HIMC hIMC)
Definition: ctf.c:110
HRESULT APIENTRY CtfImmTIMCreateInputContext(HIMC hIMC)
Definition: ctf.c:50
HRESULT WINAPI CtfImmGetGuidAtom(HIMC hIMC, DWORD dwUnknown, LPDWORD pdwGuidAtom)
Definition: ctf.c:141
HRESULT APIENTRY Imm32CtfImeDestroyInputContext(HIMC hIMC)
Definition: ctf.c:27
BOOL WINAPI CtfImmIsCiceroEnabled(VOID)
Definition: ctf.c:59
HMODULE APIENTRY Imm32LoadCtfIme(VOID)
Definition: ctf.c:21
DWORD WINAPI CtfImmHideToolbarWnd(VOID)
Definition: ctf.c:92
BOOL WINAPI CtfImmIsTextFrameServiceDisabled(VOID)
Definition: ctf.c:67
HRESULT APIENTRY CtfImmTIMDestroyInputContext(HIMC hIMC)
Definition: ctf.c:41
HRESULT WINAPI CtfImmTIMActivate(HKL hKL)
Definition: ctf.c:75
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
DWORD HIMC
Definition: dimm.idl:75
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define IS_IME_HKL(hKL)
Definition: input.h:88
#define APIENTRY
Definition: api.h:79
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:1016
PIMEDPI APIENTRY Imm32FindOrLoadImeDpi(HKL hKL)
Definition: ime.c:343
#define IS_NULL_UNEXPECTEDLY(p)
Definition: precomp.h:120
#define IS_16BIT_MODE()
Definition: precomp.h:146
DWORD dwThreadId
Definition: fdebug.c:31
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CI_TFSDISABLED
Definition: ntuser.h:306
DWORD_PTR NTAPI NtUserQueryInputContext(HIMC hIMC, DWORD dwType)
Definition: ime.c:1798
#define IS_CICERO_MODE()
Definition: ntuser.h:1233
#define GetWin32ClientInfo()
Definition: ntuser.h:347
#define S_OK
Definition: intsafe.h:52
PKEYBOARD_LAYOUT GetKeyboardLayout()
Definition: utils.c:194
UINT_PTR HKL
Definition: msctf.idl:104
unsigned int UINT
Definition: ndis.h:50
#define DWORD
Definition: nt_native.h:44
DWORD dwStatus
Definition: mediaobj.idl:95
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t * LPDWORD
Definition: typedefs.h:59
@ QIC_INPUTTHREADID
Definition: undocuser.h:393
int ret
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364