xref: /reactos/dll/win32/msimtf/activeimmapp.c (revision 38a119a7)
1 /*
2  *  ActiveIMMApp Interface
3  *
4  *  Copyright 2008  CodeWeavers, Aric Stewart
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 #include <stdarg.h>
22 
23 #define COBJMACROS
24 
25 #include "windef.h"
26 #include "winbase.h"
27 #include "wingdi.h"
28 #include "winreg.h"
29 #include "winuser.h"
30 #include "winerror.h"
31 #include "objbase.h"
32 #include "dimm.h"
33 #include "imm.h"
34 
35 #include "wine/debug.h"
36 
37 WINE_DEFAULT_DEBUG_CHANNEL(msimtf);
38 
39 typedef struct tagActiveIMMApp {
40     IActiveIMMApp IActiveIMMApp_iface;
41     IActiveIMMMessagePumpOwner IActiveIMMMessagePumpOwner_iface;
42     LONG refCount;
43 } ActiveIMMApp;
44 
impl_from_IActiveIMMApp(IActiveIMMApp * iface)45 static inline ActiveIMMApp *impl_from_IActiveIMMApp(IActiveIMMApp *iface)
46 {
47     return CONTAINING_RECORD(iface, ActiveIMMApp, IActiveIMMApp_iface);
48 }
49 
ActiveIMMApp_Destructor(ActiveIMMApp * This)50 static void ActiveIMMApp_Destructor(ActiveIMMApp* This)
51 {
52     TRACE("\n");
53     HeapFree(GetProcessHeap(),0,This);
54 }
55 
ActiveIMMApp_QueryInterface(IActiveIMMApp * iface,REFIID iid,LPVOID * ppvOut)56 static HRESULT WINAPI ActiveIMMApp_QueryInterface (IActiveIMMApp* iface,
57         REFIID iid, LPVOID *ppvOut)
58 {
59     ActiveIMMApp *This = impl_from_IActiveIMMApp(iface);
60     *ppvOut = NULL;
61 
62     if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IActiveIMMApp))
63     {
64         *ppvOut = &This->IActiveIMMApp_iface;
65     }
66     else if (IsEqualIID(iid, &IID_IActiveIMMMessagePumpOwner))
67     {
68         *ppvOut = &This->IActiveIMMMessagePumpOwner_iface;
69     }
70 
71     if (*ppvOut)
72     {
73         IUnknown_AddRef(iface);
74         return S_OK;
75     }
76 
77     WARN("unsupported interface: %s\n", debugstr_guid(iid));
78     return E_NOINTERFACE;
79 }
80 
ActiveIMMApp_AddRef(IActiveIMMApp * iface)81 static ULONG WINAPI ActiveIMMApp_AddRef(IActiveIMMApp* iface)
82 {
83     ActiveIMMApp *This = impl_from_IActiveIMMApp(iface);
84     return InterlockedIncrement(&This->refCount);
85 }
86 
ActiveIMMApp_Release(IActiveIMMApp * iface)87 static ULONG WINAPI ActiveIMMApp_Release(IActiveIMMApp* iface)
88 {
89     ActiveIMMApp *This = impl_from_IActiveIMMApp(iface);
90     ULONG ret;
91 
92     ret = InterlockedDecrement(&This->refCount);
93     if (ret == 0)
94         ActiveIMMApp_Destructor(This);
95     return ret;
96 }
97 
ActiveIMMApp_AssociateContext(IActiveIMMApp * iface,HWND hWnd,HIMC hIME,HIMC * phPrev)98 static HRESULT WINAPI ActiveIMMApp_AssociateContext(IActiveIMMApp* iface,
99         HWND hWnd, HIMC hIME, HIMC *phPrev)
100 {
101     *phPrev = ImmAssociateContext(hWnd,hIME);
102     return S_OK;
103 }
104 
ActiveIMMApp_ConfigureIMEA(IActiveIMMApp * This,HKL hKL,HWND hwnd,DWORD dwMode,REGISTERWORDA * pData)105 static HRESULT WINAPI ActiveIMMApp_ConfigureIMEA(IActiveIMMApp* This,
106         HKL hKL, HWND hwnd, DWORD dwMode, REGISTERWORDA *pData)
107 {
108     BOOL rc;
109 
110     rc = ImmConfigureIMEA(hKL, hwnd, dwMode, pData);
111     if (rc)
112         return E_FAIL;
113     else
114         return S_OK;
115 }
116 
ActiveIMMApp_ConfigureIMEW(IActiveIMMApp * This,HKL hKL,HWND hWnd,DWORD dwMode,REGISTERWORDW * pData)117 static HRESULT WINAPI ActiveIMMApp_ConfigureIMEW(IActiveIMMApp* This,
118         HKL hKL, HWND hWnd, DWORD dwMode, REGISTERWORDW *pData)
119 {
120     BOOL rc;
121 
122     rc = ImmConfigureIMEW(hKL, hWnd, dwMode, pData);
123     if (rc)
124         return E_FAIL;
125     else
126         return S_OK;
127 }
128 
ActiveIMMApp_CreateContext(IActiveIMMApp * This,HIMC * phIMC)129 static HRESULT WINAPI ActiveIMMApp_CreateContext(IActiveIMMApp* This,
130         HIMC *phIMC)
131 {
132     *phIMC = ImmCreateContext();
133     if (*phIMC)
134         return S_OK;
135     else
136         return E_FAIL;
137 }
138 
ActiveIMMApp_DestroyContext(IActiveIMMApp * This,HIMC hIME)139 static HRESULT WINAPI ActiveIMMApp_DestroyContext(IActiveIMMApp* This,
140         HIMC hIME)
141 {
142     BOOL rc;
143 
144     rc = ImmDestroyContext(hIME);
145     if (rc)
146         return S_OK;
147     else
148         return E_FAIL;
149 }
150 
ActiveIMMApp_EnumRegisterWordA(IActiveIMMApp * This,HKL hKL,LPSTR szReading,DWORD dwStyle,LPSTR szRegister,LPVOID pData,IEnumRegisterWordA ** pEnum)151 static HRESULT WINAPI ActiveIMMApp_EnumRegisterWordA(IActiveIMMApp* This,
152         HKL hKL, LPSTR szReading, DWORD dwStyle, LPSTR szRegister,
153         LPVOID pData, IEnumRegisterWordA **pEnum)
154 {
155     FIXME("Stub\n");
156     return E_NOTIMPL;
157 }
158 
ActiveIMMApp_EnumRegisterWordW(IActiveIMMApp * This,HKL hKL,LPWSTR szReading,DWORD dwStyle,LPWSTR szRegister,LPVOID pData,IEnumRegisterWordW ** pEnum)159 static HRESULT WINAPI ActiveIMMApp_EnumRegisterWordW(IActiveIMMApp* This,
160         HKL hKL, LPWSTR szReading, DWORD dwStyle, LPWSTR szRegister,
161         LPVOID pData, IEnumRegisterWordW **pEnum)
162 {
163     FIXME("Stub\n");
164     return E_NOTIMPL;
165 }
166 
ActiveIMMApp_EscapeA(IActiveIMMApp * This,HKL hKL,HIMC hIMC,UINT uEscape,LPVOID pData,LRESULT * plResult)167 static HRESULT WINAPI ActiveIMMApp_EscapeA(IActiveIMMApp* This,
168         HKL hKL, HIMC hIMC, UINT uEscape, LPVOID pData, LRESULT *plResult)
169 {
170     *plResult = ImmEscapeA(hKL, hIMC, uEscape, pData);
171     return S_OK;
172 }
173 
ActiveIMMApp_EscapeW(IActiveIMMApp * This,HKL hKL,HIMC hIMC,UINT uEscape,LPVOID pData,LRESULT * plResult)174 static HRESULT WINAPI ActiveIMMApp_EscapeW(IActiveIMMApp* This,
175         HKL hKL, HIMC hIMC, UINT uEscape, LPVOID pData, LRESULT *plResult)
176 {
177     *plResult = ImmEscapeW(hKL, hIMC, uEscape, pData);
178     return S_OK;
179 }
180 
ActiveIMMApp_GetCandidateListA(IActiveIMMApp * This,HIMC hIMC,DWORD dwIndex,UINT uBufLen,CANDIDATELIST * pCandList,UINT * puCopied)181 static HRESULT WINAPI ActiveIMMApp_GetCandidateListA(IActiveIMMApp* This,
182         HIMC hIMC, DWORD dwIndex, UINT uBufLen, CANDIDATELIST *pCandList,
183         UINT *puCopied)
184 {
185     *puCopied = ImmGetCandidateListA(hIMC, dwIndex, pCandList, uBufLen);
186     return S_OK;
187 }
188 
ActiveIMMApp_GetCandidateListW(IActiveIMMApp * This,HIMC hIMC,DWORD dwIndex,UINT uBufLen,CANDIDATELIST * pCandList,UINT * puCopied)189 static HRESULT WINAPI ActiveIMMApp_GetCandidateListW(IActiveIMMApp* This,
190         HIMC hIMC, DWORD dwIndex, UINT uBufLen, CANDIDATELIST *pCandList,
191         UINT *puCopied)
192 {
193     *puCopied = ImmGetCandidateListW(hIMC, dwIndex, pCandList, uBufLen);
194     return S_OK;
195 }
196 
ActiveIMMApp_GetCandidateListCountA(IActiveIMMApp * This,HIMC hIMC,DWORD * pdwListSize,DWORD * pdwBufLen)197 static HRESULT WINAPI ActiveIMMApp_GetCandidateListCountA(IActiveIMMApp* This,
198         HIMC hIMC, DWORD *pdwListSize, DWORD *pdwBufLen)
199 {
200    *pdwBufLen = ImmGetCandidateListCountA(hIMC, pdwListSize);
201     return S_OK;
202 }
203 
ActiveIMMApp_GetCandidateListCountW(IActiveIMMApp * This,HIMC hIMC,DWORD * pdwListSize,DWORD * pdwBufLen)204 static HRESULT WINAPI ActiveIMMApp_GetCandidateListCountW(IActiveIMMApp* This,
205         HIMC hIMC, DWORD *pdwListSize, DWORD *pdwBufLen)
206 {
207    *pdwBufLen = ImmGetCandidateListCountA(hIMC, pdwListSize);
208     return S_OK;
209 }
210 
ActiveIMMApp_GetCandidateWindow(IActiveIMMApp * This,HIMC hIMC,DWORD dwIndex,CANDIDATEFORM * pCandidate)211 static HRESULT WINAPI ActiveIMMApp_GetCandidateWindow(IActiveIMMApp* This,
212         HIMC hIMC, DWORD dwIndex, CANDIDATEFORM *pCandidate)
213 {
214     BOOL rc;
215     rc = ImmGetCandidateWindow(hIMC,dwIndex,pCandidate);
216     if (rc)
217         return S_OK;
218     else
219         return E_FAIL;
220 }
221 
ActiveIMMApp_GetCompositionFontA(IActiveIMMApp * This,HIMC hIMC,LOGFONTA * plf)222 static HRESULT WINAPI ActiveIMMApp_GetCompositionFontA(IActiveIMMApp* This,
223         HIMC hIMC, LOGFONTA *plf)
224 {
225     BOOL rc;
226     rc = ImmGetCompositionFontA(hIMC,plf);
227     if (rc)
228         return S_OK;
229     else
230         return E_FAIL;
231 }
232 
ActiveIMMApp_GetCompositionFontW(IActiveIMMApp * This,HIMC hIMC,LOGFONTW * plf)233 static HRESULT WINAPI ActiveIMMApp_GetCompositionFontW(IActiveIMMApp* This,
234         HIMC hIMC, LOGFONTW *plf)
235 {
236     BOOL rc;
237     rc = ImmGetCompositionFontW(hIMC,plf);
238     if (rc)
239         return S_OK;
240     else
241         return E_FAIL;
242 }
243 
ActiveIMMApp_GetCompositionStringA(IActiveIMMApp * This,HIMC hIMC,DWORD dwIndex,DWORD dwBufLen,LONG * plCopied,LPVOID pBuf)244 static HRESULT WINAPI ActiveIMMApp_GetCompositionStringA(IActiveIMMApp* This,
245         HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LONG *plCopied, LPVOID pBuf)
246 {
247     *plCopied = ImmGetCompositionStringA(hIMC, dwIndex, pBuf, dwBufLen);
248     return S_OK;
249 }
250 
ActiveIMMApp_GetCompositionStringW(IActiveIMMApp * This,HIMC hIMC,DWORD dwIndex,DWORD dwBufLen,LONG * plCopied,LPVOID pBuf)251 static HRESULT WINAPI ActiveIMMApp_GetCompositionStringW(IActiveIMMApp* This,
252         HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LONG *plCopied, LPVOID pBuf)
253 {
254     *plCopied = ImmGetCompositionStringW(hIMC, dwIndex, pBuf, dwBufLen);
255     return S_OK;
256 }
257 
ActiveIMMApp_GetCompositionWindow(IActiveIMMApp * This,HIMC hIMC,COMPOSITIONFORM * pCompForm)258 static HRESULT WINAPI ActiveIMMApp_GetCompositionWindow(IActiveIMMApp* This,
259         HIMC hIMC, COMPOSITIONFORM *pCompForm)
260 {
261     BOOL rc;
262 
263     rc = ImmGetCompositionWindow(hIMC,pCompForm);
264 
265     if (rc)
266         return S_OK;
267     else
268         return E_FAIL;
269 }
270 
ActiveIMMApp_GetContext(IActiveIMMApp * This,HWND hwnd,HIMC * phIMC)271 static HRESULT WINAPI ActiveIMMApp_GetContext(IActiveIMMApp* This,
272         HWND hwnd, HIMC *phIMC)
273 {
274     *phIMC = ImmGetContext(hwnd);
275     return S_OK;
276 }
277 
ActiveIMMApp_GetConversionListA(IActiveIMMApp * This,HKL hKL,HIMC hIMC,LPSTR pSrc,UINT uBufLen,UINT uFlag,CANDIDATELIST * pDst,UINT * puCopied)278 static HRESULT WINAPI ActiveIMMApp_GetConversionListA(IActiveIMMApp* This,
279         HKL hKL, HIMC hIMC, LPSTR pSrc, UINT uBufLen, UINT uFlag,
280         CANDIDATELIST *pDst, UINT *puCopied)
281 {
282     *puCopied = ImmGetConversionListA(hKL, hIMC, pSrc, pDst, uBufLen, uFlag);
283     return S_OK;
284 }
285 
ActiveIMMApp_GetConversionListW(IActiveIMMApp * This,HKL hKL,HIMC hIMC,LPWSTR pSrc,UINT uBufLen,UINT uFlag,CANDIDATELIST * pDst,UINT * puCopied)286 static HRESULT WINAPI ActiveIMMApp_GetConversionListW(IActiveIMMApp* This,
287         HKL hKL, HIMC hIMC, LPWSTR pSrc, UINT uBufLen, UINT uFlag,
288         CANDIDATELIST *pDst, UINT *puCopied)
289 {
290     *puCopied = ImmGetConversionListW(hKL, hIMC, pSrc, pDst, uBufLen, uFlag);
291     return S_OK;
292 }
293 
ActiveIMMApp_GetConversionStatus(IActiveIMMApp * This,HIMC hIMC,DWORD * pfdwConversion,DWORD * pfdwSentence)294 static HRESULT WINAPI ActiveIMMApp_GetConversionStatus(IActiveIMMApp* This,
295         HIMC hIMC, DWORD *pfdwConversion, DWORD *pfdwSentence)
296 {
297     BOOL rc;
298 
299     rc = ImmGetConversionStatus(hIMC, pfdwConversion, pfdwSentence);
300 
301     if (rc)
302         return S_OK;
303     else
304         return E_FAIL;
305 }
306 
ActiveIMMApp_GetDefaultIMEWnd(IActiveIMMApp * This,HWND hWnd,HWND * phDefWnd)307 static HRESULT WINAPI ActiveIMMApp_GetDefaultIMEWnd(IActiveIMMApp* This,
308         HWND hWnd, HWND *phDefWnd)
309 {
310     *phDefWnd = ImmGetDefaultIMEWnd(hWnd);
311     return S_OK;
312 }
313 
ActiveIMMApp_GetDescriptionA(IActiveIMMApp * This,HKL hKL,UINT uBufLen,LPSTR szDescription,UINT * puCopied)314 static HRESULT WINAPI ActiveIMMApp_GetDescriptionA(IActiveIMMApp* This,
315         HKL hKL, UINT uBufLen, LPSTR szDescription, UINT *puCopied)
316 {
317     *puCopied = ImmGetDescriptionA(hKL, szDescription, uBufLen);
318     return S_OK;
319 }
320 
ActiveIMMApp_GetDescriptionW(IActiveIMMApp * This,HKL hKL,UINT uBufLen,LPWSTR szDescription,UINT * puCopied)321 static HRESULT WINAPI ActiveIMMApp_GetDescriptionW(IActiveIMMApp* This,
322         HKL hKL, UINT uBufLen, LPWSTR szDescription, UINT *puCopied)
323 {
324     *puCopied = ImmGetDescriptionW(hKL, szDescription, uBufLen);
325     return S_OK;
326 }
327 
ActiveIMMApp_GetGuideLineA(IActiveIMMApp * This,HIMC hIMC,DWORD dwIndex,DWORD dwBufLen,LPSTR pBuf,DWORD * pdwResult)328 static HRESULT WINAPI ActiveIMMApp_GetGuideLineA(IActiveIMMApp* This,
329         HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LPSTR pBuf,
330         DWORD *pdwResult)
331 {
332     *pdwResult = ImmGetGuideLineA(hIMC, dwIndex, pBuf, dwBufLen);
333     return S_OK;
334 }
335 
ActiveIMMApp_GetGuideLineW(IActiveIMMApp * This,HIMC hIMC,DWORD dwIndex,DWORD dwBufLen,LPWSTR pBuf,DWORD * pdwResult)336 static HRESULT WINAPI ActiveIMMApp_GetGuideLineW(IActiveIMMApp* This,
337         HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LPWSTR pBuf,
338         DWORD *pdwResult)
339 {
340     *pdwResult = ImmGetGuideLineW(hIMC, dwIndex, pBuf, dwBufLen);
341     return S_OK;
342 }
343 
ActiveIMMApp_GetIMEFileNameA(IActiveIMMApp * This,HKL hKL,UINT uBufLen,LPSTR szFileName,UINT * puCopied)344 static HRESULT WINAPI ActiveIMMApp_GetIMEFileNameA(IActiveIMMApp* This,
345         HKL hKL, UINT uBufLen, LPSTR szFileName, UINT *puCopied)
346 {
347     *puCopied = ImmGetIMEFileNameA(hKL, szFileName, uBufLen);
348     return S_OK;
349 }
350 
ActiveIMMApp_GetIMEFileNameW(IActiveIMMApp * This,HKL hKL,UINT uBufLen,LPWSTR szFileName,UINT * puCopied)351 static HRESULT WINAPI ActiveIMMApp_GetIMEFileNameW(IActiveIMMApp* This,
352         HKL hKL, UINT uBufLen, LPWSTR szFileName, UINT *puCopied)
353 {
354     *puCopied = ImmGetIMEFileNameW(hKL, szFileName, uBufLen);
355     return S_OK;
356 }
357 
ActiveIMMApp_GetOpenStatus(IActiveIMMApp * This,HIMC hIMC)358 static HRESULT WINAPI ActiveIMMApp_GetOpenStatus(IActiveIMMApp* This,
359         HIMC hIMC)
360 {
361     return ImmGetOpenStatus(hIMC);
362 }
363 
ActiveIMMApp_GetProperty(IActiveIMMApp * This,HKL hKL,DWORD fdwIndex,DWORD * pdwProperty)364 static HRESULT WINAPI ActiveIMMApp_GetProperty(IActiveIMMApp* This,
365         HKL hKL, DWORD fdwIndex, DWORD *pdwProperty)
366 {
367     *pdwProperty = ImmGetProperty(hKL, fdwIndex);
368     return S_OK;
369 }
370 
ActiveIMMApp_GetRegisterWordStyleA(IActiveIMMApp * This,HKL hKL,UINT nItem,STYLEBUFA * pStyleBuf,UINT * puCopied)371 static HRESULT WINAPI ActiveIMMApp_GetRegisterWordStyleA(IActiveIMMApp* This,
372         HKL hKL, UINT nItem, STYLEBUFA *pStyleBuf, UINT *puCopied)
373 {
374     *puCopied = ImmGetRegisterWordStyleA(hKL, nItem, pStyleBuf);
375     return S_OK;
376 }
377 
ActiveIMMApp_GetRegisterWordStyleW(IActiveIMMApp * This,HKL hKL,UINT nItem,STYLEBUFW * pStyleBuf,UINT * puCopied)378 static HRESULT WINAPI ActiveIMMApp_GetRegisterWordStyleW(IActiveIMMApp* This,
379         HKL hKL, UINT nItem, STYLEBUFW *pStyleBuf, UINT *puCopied)
380 {
381     *puCopied = ImmGetRegisterWordStyleW(hKL, nItem, pStyleBuf);
382     return S_OK;
383 }
384 
ActiveIMMApp_GetStatusWindowPos(IActiveIMMApp * This,HIMC hIMC,POINT * pptPos)385 static HRESULT WINAPI ActiveIMMApp_GetStatusWindowPos(IActiveIMMApp* This,
386         HIMC hIMC, POINT *pptPos)
387 {
388     BOOL rc;
389     rc = ImmGetStatusWindowPos(hIMC, pptPos);
390 
391     if (rc)
392         return S_OK;
393     else
394         return E_FAIL;
395 }
396 
ActiveIMMApp_GetVirtualKey(IActiveIMMApp * This,HWND hWnd,UINT * puVirtualKey)397 static HRESULT WINAPI ActiveIMMApp_GetVirtualKey(IActiveIMMApp* This,
398         HWND hWnd, UINT *puVirtualKey)
399 {
400     *puVirtualKey = ImmGetVirtualKey(hWnd);
401     return S_OK;
402 }
403 
ActiveIMMApp_InstallIMEA(IActiveIMMApp * This,LPSTR szIMEFileName,LPSTR szLayoutText,HKL * phKL)404 static HRESULT WINAPI ActiveIMMApp_InstallIMEA(IActiveIMMApp* This,
405         LPSTR szIMEFileName, LPSTR szLayoutText, HKL *phKL)
406 {
407     *phKL = ImmInstallIMEA(szIMEFileName,szLayoutText);
408     return S_OK;
409 }
410 
ActiveIMMApp_InstallIMEW(IActiveIMMApp * This,LPWSTR szIMEFileName,LPWSTR szLayoutText,HKL * phKL)411 static HRESULT WINAPI ActiveIMMApp_InstallIMEW(IActiveIMMApp* This,
412         LPWSTR szIMEFileName, LPWSTR szLayoutText, HKL *phKL)
413 {
414     *phKL = ImmInstallIMEW(szIMEFileName,szLayoutText);
415     return S_OK;
416 }
417 
ActiveIMMApp_IsIME(IActiveIMMApp * This,HKL hKL)418 static HRESULT WINAPI ActiveIMMApp_IsIME(IActiveIMMApp* This,
419         HKL hKL)
420 {
421     return ImmIsIME(hKL);
422 }
423 
ActiveIMMApp_IsUIMessageA(IActiveIMMApp * This,HWND hWndIME,UINT msg,WPARAM wParam,LPARAM lParam)424 static HRESULT WINAPI ActiveIMMApp_IsUIMessageA(IActiveIMMApp* This,
425         HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
426 {
427     return ImmIsUIMessageA(hWndIME,msg,wParam,lParam);
428 }
429 
ActiveIMMApp_IsUIMessageW(IActiveIMMApp * This,HWND hWndIME,UINT msg,WPARAM wParam,LPARAM lParam)430 static HRESULT WINAPI ActiveIMMApp_IsUIMessageW(IActiveIMMApp* This,
431         HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
432 {
433     return ImmIsUIMessageW(hWndIME,msg,wParam,lParam);
434 }
435 
ActiveIMMApp_NotifyIME(IActiveIMMApp * This,HIMC hIMC,DWORD dwAction,DWORD dwIndex,DWORD dwValue)436 static HRESULT WINAPI ActiveIMMApp_NotifyIME(IActiveIMMApp* This,
437         HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
438 {
439     BOOL rc;
440 
441     rc = ImmNotifyIME(hIMC,dwAction,dwIndex,dwValue);
442 
443     if (rc)
444         return S_OK;
445     else
446         return E_FAIL;
447 }
448 
ActiveIMMApp_RegisterWordA(IActiveIMMApp * This,HKL hKL,LPSTR szReading,DWORD dwStyle,LPSTR szRegister)449 static HRESULT WINAPI ActiveIMMApp_RegisterWordA(IActiveIMMApp* This,
450         HKL hKL, LPSTR szReading, DWORD dwStyle, LPSTR szRegister)
451 {
452     BOOL rc;
453 
454     rc = ImmRegisterWordA(hKL,szReading,dwStyle,szRegister);
455 
456     if (rc)
457         return S_OK;
458     else
459         return E_FAIL;
460 }
461 
ActiveIMMApp_RegisterWordW(IActiveIMMApp * This,HKL hKL,LPWSTR szReading,DWORD dwStyle,LPWSTR szRegister)462 static HRESULT WINAPI ActiveIMMApp_RegisterWordW(IActiveIMMApp* This,
463         HKL hKL, LPWSTR szReading, DWORD dwStyle, LPWSTR szRegister)
464 {
465     BOOL rc;
466 
467     rc = ImmRegisterWordW(hKL,szReading,dwStyle,szRegister);
468 
469     if (rc)
470         return S_OK;
471     else
472         return E_FAIL;
473 }
474 
ActiveIMMApp_ReleaseContext(IActiveIMMApp * This,HWND hWnd,HIMC hIMC)475 static HRESULT WINAPI ActiveIMMApp_ReleaseContext(IActiveIMMApp* This,
476         HWND hWnd, HIMC hIMC)
477 {
478     BOOL rc;
479 
480     rc = ImmReleaseContext(hWnd,hIMC);
481 
482     if (rc)
483         return S_OK;
484     else
485         return E_FAIL;
486 }
487 
ActiveIMMApp_SetCandidateWindow(IActiveIMMApp * This,HIMC hIMC,CANDIDATEFORM * pCandidate)488 static HRESULT WINAPI ActiveIMMApp_SetCandidateWindow(IActiveIMMApp* This,
489         HIMC hIMC, CANDIDATEFORM *pCandidate)
490 {
491     BOOL rc;
492 
493     rc = ImmSetCandidateWindow(hIMC,pCandidate);
494 
495     if (rc)
496         return S_OK;
497     else
498         return E_FAIL;
499 }
500 
ActiveIMMApp_SetCompositionFontA(IActiveIMMApp * This,HIMC hIMC,LOGFONTA * plf)501 static HRESULT WINAPI ActiveIMMApp_SetCompositionFontA(IActiveIMMApp* This,
502         HIMC hIMC, LOGFONTA *plf)
503 {
504     BOOL rc;
505 
506     rc = ImmSetCompositionFontA(hIMC,plf);
507 
508     if (rc)
509         return S_OK;
510     else
511         return E_FAIL;
512 }
513 
ActiveIMMApp_SetCompositionFontW(IActiveIMMApp * This,HIMC hIMC,LOGFONTW * plf)514 static HRESULT WINAPI ActiveIMMApp_SetCompositionFontW(IActiveIMMApp* This,
515         HIMC hIMC, LOGFONTW *plf)
516 {
517     BOOL rc;
518 
519     rc = ImmSetCompositionFontW(hIMC,plf);
520 
521     if (rc)
522         return S_OK;
523     else
524         return E_FAIL;
525 }
526 
ActiveIMMApp_SetCompositionStringA(IActiveIMMApp * This,HIMC hIMC,DWORD dwIndex,LPVOID pComp,DWORD dwCompLen,LPVOID pRead,DWORD dwReadLen)527 static HRESULT WINAPI ActiveIMMApp_SetCompositionStringA(IActiveIMMApp* This,
528         HIMC hIMC, DWORD dwIndex, LPVOID pComp, DWORD dwCompLen,
529         LPVOID pRead, DWORD dwReadLen)
530 {
531     BOOL rc;
532 
533     rc = ImmSetCompositionStringA(hIMC,dwIndex,pComp,dwCompLen,pRead,dwReadLen);
534 
535     if (rc)
536         return S_OK;
537     else
538         return E_FAIL;
539 }
540 
ActiveIMMApp_SetCompositionStringW(IActiveIMMApp * This,HIMC hIMC,DWORD dwIndex,LPVOID pComp,DWORD dwCompLen,LPVOID pRead,DWORD dwReadLen)541 static HRESULT WINAPI ActiveIMMApp_SetCompositionStringW(IActiveIMMApp* This,
542         HIMC hIMC, DWORD dwIndex, LPVOID pComp, DWORD dwCompLen,
543         LPVOID pRead, DWORD dwReadLen)
544 {
545     BOOL rc;
546 
547     rc = ImmSetCompositionStringW(hIMC,dwIndex,pComp,dwCompLen,pRead,dwReadLen);
548 
549     if (rc)
550         return S_OK;
551     else
552         return E_FAIL;
553 }
554 
ActiveIMMApp_SetCompositionWindow(IActiveIMMApp * This,HIMC hIMC,COMPOSITIONFORM * pCompForm)555 static HRESULT WINAPI ActiveIMMApp_SetCompositionWindow(IActiveIMMApp* This,
556         HIMC hIMC, COMPOSITIONFORM *pCompForm)
557 {
558     BOOL rc;
559 
560     rc = ImmSetCompositionWindow(hIMC,pCompForm);
561 
562     if (rc)
563         return S_OK;
564     else
565         return E_FAIL;
566 }
567 
ActiveIMMApp_SetConversionStatus(IActiveIMMApp * This,HIMC hIMC,DWORD fdwConversion,DWORD fdwSentence)568 static HRESULT WINAPI ActiveIMMApp_SetConversionStatus(IActiveIMMApp* This,
569         HIMC hIMC, DWORD fdwConversion, DWORD fdwSentence)
570 {
571     BOOL rc;
572 
573     rc = ImmSetConversionStatus(hIMC,fdwConversion,fdwSentence);
574 
575     if (rc)
576         return S_OK;
577     else
578         return E_FAIL;
579 }
580 
ActiveIMMApp_SetOpenStatus(IActiveIMMApp * This,HIMC hIMC,BOOL fOpen)581 static HRESULT WINAPI ActiveIMMApp_SetOpenStatus(IActiveIMMApp* This,
582         HIMC hIMC, BOOL fOpen)
583 {
584     BOOL rc;
585 
586     rc = ImmSetOpenStatus(hIMC,fOpen);
587 
588     if (rc)
589         return S_OK;
590     else
591         return E_FAIL;
592 }
593 
ActiveIMMApp_SetStatusWindowPos(IActiveIMMApp * This,HIMC hIMC,POINT * pptPos)594 static HRESULT WINAPI ActiveIMMApp_SetStatusWindowPos(IActiveIMMApp* This,
595         HIMC hIMC, POINT *pptPos)
596 {
597     BOOL rc;
598 
599     rc = ImmSetStatusWindowPos(hIMC,pptPos);
600 
601     if (rc)
602         return S_OK;
603     else
604         return E_FAIL;
605 }
606 
ActiveIMMApp_SimulateHotKey(IActiveIMMApp * This,HWND hwnd,DWORD dwHotKeyID)607 static HRESULT WINAPI ActiveIMMApp_SimulateHotKey(IActiveIMMApp* This,
608         HWND hwnd, DWORD dwHotKeyID)
609 {
610     BOOL rc;
611 
612     rc = ImmSimulateHotKey(hwnd,dwHotKeyID);
613 
614     if (rc)
615         return S_OK;
616     else
617         return E_FAIL;
618 }
619 
ActiveIMMApp_UnregisterWordA(IActiveIMMApp * This,HKL hKL,LPSTR szReading,DWORD dwStyle,LPSTR szUnregister)620 static HRESULT WINAPI ActiveIMMApp_UnregisterWordA(IActiveIMMApp* This,
621         HKL hKL, LPSTR szReading, DWORD dwStyle, LPSTR szUnregister)
622 {
623     BOOL rc;
624 
625     rc = ImmUnregisterWordA(hKL,szReading,dwStyle,szUnregister);
626 
627     if (rc)
628         return S_OK;
629     else
630         return E_FAIL;
631 
632 }
633 
ActiveIMMApp_UnregisterWordW(IActiveIMMApp * This,HKL hKL,LPWSTR szReading,DWORD dwStyle,LPWSTR szUnregister)634 static HRESULT WINAPI ActiveIMMApp_UnregisterWordW(IActiveIMMApp* This,
635         HKL hKL, LPWSTR szReading, DWORD dwStyle, LPWSTR szUnregister)
636 {
637     BOOL rc;
638 
639     rc = ImmUnregisterWordW(hKL,szReading,dwStyle,szUnregister);
640 
641     if (rc)
642         return S_OK;
643     else
644         return E_FAIL;
645 }
646 
ActiveIMMApp_Activate(IActiveIMMApp * This,BOOL fRestoreLayout)647 static HRESULT WINAPI ActiveIMMApp_Activate(IActiveIMMApp* This,
648         BOOL fRestoreLayout)
649 {
650     FIXME("Stub\n");
651     return S_OK;
652 }
653 
ActiveIMMApp_Deactivate(IActiveIMMApp * This)654 static HRESULT WINAPI ActiveIMMApp_Deactivate(IActiveIMMApp* This)
655 {
656     FIXME("Stub\n");
657     return S_OK;
658 }
659 
ActiveIMMApp_OnDefWindowProc(IActiveIMMApp * This,HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam,LRESULT * plResult)660 static HRESULT WINAPI ActiveIMMApp_OnDefWindowProc(IActiveIMMApp* This,
661         HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT *plResult)
662 {
663 #ifndef __REACTOS__
664     FIXME("Stub (%p %x %lx %lx)\n",hWnd,Msg,wParam,lParam);
665 #endif
666     return E_FAIL;
667 }
668 
ActiveIMMApp_FilterClientWindows(IActiveIMMApp * This,ATOM * aaClassList,UINT uSize)669 static HRESULT WINAPI ActiveIMMApp_FilterClientWindows(IActiveIMMApp* This,
670         ATOM *aaClassList, UINT uSize)
671 {
672     FIXME("Stub\n");
673     return S_OK;
674 }
675 
ActiveIMMApp_GetCodePageA(IActiveIMMApp * This,HKL hKL,UINT * uCodePage)676 static HRESULT WINAPI ActiveIMMApp_GetCodePageA(IActiveIMMApp* This,
677         HKL hKL, UINT *uCodePage)
678 {
679     FIXME("Stub\n");
680     return E_NOTIMPL;
681 }
682 
ActiveIMMApp_GetLangId(IActiveIMMApp * This,HKL hKL,LANGID * plid)683 static HRESULT WINAPI ActiveIMMApp_GetLangId(IActiveIMMApp* This,
684         HKL hKL, LANGID *plid)
685 {
686     FIXME("Stub\n");
687     return E_NOTIMPL;
688 }
689 
ActiveIMMApp_AssociateContextEx(IActiveIMMApp * This,HWND hWnd,HIMC hIMC,DWORD dwFlags)690 static HRESULT WINAPI ActiveIMMApp_AssociateContextEx(IActiveIMMApp* This,
691         HWND hWnd, HIMC hIMC, DWORD dwFlags)
692 {
693     BOOL rc;
694 
695     rc = ImmAssociateContextEx(hWnd,hIMC,dwFlags);
696 
697     if (rc)
698         return S_OK;
699     else
700         return E_FAIL;
701 }
702 
ActiveIMMApp_DisableIME(IActiveIMMApp * This,DWORD idThread)703 static HRESULT WINAPI ActiveIMMApp_DisableIME(IActiveIMMApp* This,
704         DWORD idThread)
705 {
706     BOOL rc;
707 
708     rc = ImmDisableIME(idThread);
709 
710     if (rc)
711         return S_OK;
712     else
713         return E_FAIL;
714 }
715 
ActiveIMMApp_GetImeMenuItemsA(IActiveIMMApp * This,HIMC hIMC,DWORD dwFlags,DWORD dwType,IMEMENUITEMINFOA * pImeParentMenu,IMEMENUITEMINFOA * pImeMenu,DWORD dwSize,DWORD * pdwResult)716 static HRESULT WINAPI ActiveIMMApp_GetImeMenuItemsA(IActiveIMMApp* This,
717         HIMC hIMC, DWORD dwFlags, DWORD dwType,
718         IMEMENUITEMINFOA *pImeParentMenu, IMEMENUITEMINFOA *pImeMenu,
719         DWORD dwSize, DWORD *pdwResult)
720 {
721     *pdwResult = ImmGetImeMenuItemsA(hIMC,dwFlags,dwType,pImeParentMenu,pImeMenu,dwSize);
722     return S_OK;
723 }
724 
ActiveIMMApp_GetImeMenuItemsW(IActiveIMMApp * This,HIMC hIMC,DWORD dwFlags,DWORD dwType,IMEMENUITEMINFOW * pImeParentMenu,IMEMENUITEMINFOW * pImeMenu,DWORD dwSize,DWORD * pdwResult)725 static HRESULT WINAPI ActiveIMMApp_GetImeMenuItemsW(IActiveIMMApp* This,
726         HIMC hIMC, DWORD dwFlags, DWORD dwType,
727         IMEMENUITEMINFOW *pImeParentMenu, IMEMENUITEMINFOW *pImeMenu,
728         DWORD dwSize, DWORD *pdwResult)
729 {
730     *pdwResult = ImmGetImeMenuItemsW(hIMC,dwFlags,dwType,pImeParentMenu,pImeMenu,dwSize);
731     return S_OK;
732 }
733 
ActiveIMMApp_EnumInputContext(IActiveIMMApp * This,DWORD idThread,IEnumInputContext ** ppEnum)734 static HRESULT WINAPI ActiveIMMApp_EnumInputContext(IActiveIMMApp* This,
735         DWORD idThread, IEnumInputContext **ppEnum)
736 {
737     FIXME("Stub\n");
738     return E_NOTIMPL;
739 }
740 
741 static const IActiveIMMAppVtbl ActiveIMMAppVtbl =
742 {
743     ActiveIMMApp_QueryInterface,
744     ActiveIMMApp_AddRef,
745     ActiveIMMApp_Release,
746 
747     ActiveIMMApp_AssociateContext,
748     ActiveIMMApp_ConfigureIMEA,
749     ActiveIMMApp_ConfigureIMEW,
750     ActiveIMMApp_CreateContext,
751     ActiveIMMApp_DestroyContext,
752     ActiveIMMApp_EnumRegisterWordA,
753     ActiveIMMApp_EnumRegisterWordW,
754     ActiveIMMApp_EscapeA,
755     ActiveIMMApp_EscapeW,
756     ActiveIMMApp_GetCandidateListA,
757     ActiveIMMApp_GetCandidateListW,
758     ActiveIMMApp_GetCandidateListCountA,
759     ActiveIMMApp_GetCandidateListCountW,
760     ActiveIMMApp_GetCandidateWindow,
761     ActiveIMMApp_GetCompositionFontA,
762     ActiveIMMApp_GetCompositionFontW,
763     ActiveIMMApp_GetCompositionStringA,
764     ActiveIMMApp_GetCompositionStringW,
765     ActiveIMMApp_GetCompositionWindow,
766     ActiveIMMApp_GetContext,
767     ActiveIMMApp_GetConversionListA,
768     ActiveIMMApp_GetConversionListW,
769     ActiveIMMApp_GetConversionStatus,
770     ActiveIMMApp_GetDefaultIMEWnd,
771     ActiveIMMApp_GetDescriptionA,
772     ActiveIMMApp_GetDescriptionW,
773     ActiveIMMApp_GetGuideLineA,
774     ActiveIMMApp_GetGuideLineW,
775     ActiveIMMApp_GetIMEFileNameA,
776     ActiveIMMApp_GetIMEFileNameW,
777     ActiveIMMApp_GetOpenStatus,
778     ActiveIMMApp_GetProperty,
779     ActiveIMMApp_GetRegisterWordStyleA,
780     ActiveIMMApp_GetRegisterWordStyleW,
781     ActiveIMMApp_GetStatusWindowPos,
782     ActiveIMMApp_GetVirtualKey,
783     ActiveIMMApp_InstallIMEA,
784     ActiveIMMApp_InstallIMEW,
785     ActiveIMMApp_IsIME,
786     ActiveIMMApp_IsUIMessageA,
787     ActiveIMMApp_IsUIMessageW,
788     ActiveIMMApp_NotifyIME,
789     ActiveIMMApp_RegisterWordA,
790     ActiveIMMApp_RegisterWordW,
791     ActiveIMMApp_ReleaseContext,
792     ActiveIMMApp_SetCandidateWindow,
793     ActiveIMMApp_SetCompositionFontA,
794     ActiveIMMApp_SetCompositionFontW,
795     ActiveIMMApp_SetCompositionStringA,
796     ActiveIMMApp_SetCompositionStringW,
797     ActiveIMMApp_SetCompositionWindow,
798     ActiveIMMApp_SetConversionStatus,
799     ActiveIMMApp_SetOpenStatus,
800     ActiveIMMApp_SetStatusWindowPos,
801     ActiveIMMApp_SimulateHotKey,
802     ActiveIMMApp_UnregisterWordA,
803     ActiveIMMApp_UnregisterWordW,
804 
805     ActiveIMMApp_Activate,
806     ActiveIMMApp_Deactivate,
807     ActiveIMMApp_OnDefWindowProc,
808     ActiveIMMApp_FilterClientWindows,
809     ActiveIMMApp_GetCodePageA,
810     ActiveIMMApp_GetLangId,
811     ActiveIMMApp_AssociateContextEx,
812     ActiveIMMApp_DisableIME,
813     ActiveIMMApp_GetImeMenuItemsA,
814     ActiveIMMApp_GetImeMenuItemsW,
815     ActiveIMMApp_EnumInputContext
816 };
817 
impl_from_IActiveIMMMessagePumpOwner(IActiveIMMMessagePumpOwner * iface)818 static inline ActiveIMMApp *impl_from_IActiveIMMMessagePumpOwner(IActiveIMMMessagePumpOwner *iface)
819 {
820     return CONTAINING_RECORD(iface, ActiveIMMApp, IActiveIMMMessagePumpOwner_iface);
821 }
822 
ActiveIMMMessagePumpOwner_QueryInterface(IActiveIMMMessagePumpOwner * iface,REFIID iid,LPVOID * ppvOut)823 static HRESULT WINAPI ActiveIMMMessagePumpOwner_QueryInterface(IActiveIMMMessagePumpOwner* iface,
824         REFIID iid, LPVOID *ppvOut)
825 {
826     ActiveIMMApp *This = impl_from_IActiveIMMMessagePumpOwner(iface);
827     return IActiveIMMApp_QueryInterface(&This->IActiveIMMApp_iface, iid, ppvOut);
828 }
829 
ActiveIMMMessagePumpOwner_AddRef(IActiveIMMMessagePumpOwner * iface)830 static ULONG WINAPI ActiveIMMMessagePumpOwner_AddRef(IActiveIMMMessagePumpOwner* iface)
831 {
832     ActiveIMMApp *This = impl_from_IActiveIMMMessagePumpOwner(iface);
833     return IActiveIMMApp_AddRef(&This->IActiveIMMApp_iface);
834 }
835 
ActiveIMMMessagePumpOwner_Release(IActiveIMMMessagePumpOwner * iface)836 static ULONG WINAPI ActiveIMMMessagePumpOwner_Release(IActiveIMMMessagePumpOwner* iface)
837 {
838     ActiveIMMApp *This = impl_from_IActiveIMMMessagePumpOwner(iface);
839     return IActiveIMMApp_Release(&This->IActiveIMMApp_iface);
840 }
841 
ActiveIMMMessagePumpOwner_Start(IActiveIMMMessagePumpOwner * iface)842 static HRESULT WINAPI ActiveIMMMessagePumpOwner_Start(IActiveIMMMessagePumpOwner* iface)
843 {
844     ActiveIMMApp *This = impl_from_IActiveIMMMessagePumpOwner(iface);
845     FIXME("(%p)->(): stub\n", This);
846     return E_NOTIMPL;
847 }
848 
ActiveIMMMessagePumpOwner_End(IActiveIMMMessagePumpOwner * iface)849 static HRESULT WINAPI ActiveIMMMessagePumpOwner_End(IActiveIMMMessagePumpOwner* iface)
850 {
851     ActiveIMMApp *This = impl_from_IActiveIMMMessagePumpOwner(iface);
852     FIXME("(%p)->(): stub\n", This);
853     return E_NOTIMPL;
854 }
855 
ActiveIMMMessagePumpOwner_OnTranslateMessage(IActiveIMMMessagePumpOwner * iface,const MSG * msg)856 static HRESULT WINAPI ActiveIMMMessagePumpOwner_OnTranslateMessage(IActiveIMMMessagePumpOwner* iface,
857         const MSG *msg)
858 {
859     ActiveIMMApp *This = impl_from_IActiveIMMMessagePumpOwner(iface);
860     FIXME("(%p)->(%p): stub\n", This, msg);
861     return E_NOTIMPL;
862 }
863 
ActiveIMMMessagePumpOwner_Pause(IActiveIMMMessagePumpOwner * iface,DWORD * cookie)864 static HRESULT WINAPI ActiveIMMMessagePumpOwner_Pause(IActiveIMMMessagePumpOwner* iface,
865         DWORD *cookie)
866 {
867     ActiveIMMApp *This = impl_from_IActiveIMMMessagePumpOwner(iface);
868     FIXME("(%p)->(%p): stub\n", This, cookie);
869     return E_NOTIMPL;
870 }
871 
ActiveIMMMessagePumpOwner_Resume(IActiveIMMMessagePumpOwner * iface,DWORD cookie)872 static HRESULT WINAPI ActiveIMMMessagePumpOwner_Resume(IActiveIMMMessagePumpOwner* iface,
873         DWORD cookie)
874 {
875     ActiveIMMApp *This = impl_from_IActiveIMMMessagePumpOwner(iface);
876     FIXME("(%p)->(%u): stub\n", This, cookie);
877     return E_NOTIMPL;
878 }
879 
880 static const IActiveIMMMessagePumpOwnerVtbl ActiveIMMMessagePumpOwnerVtbl =
881 {
882     ActiveIMMMessagePumpOwner_QueryInterface,
883     ActiveIMMMessagePumpOwner_AddRef,
884     ActiveIMMMessagePumpOwner_Release,
885     ActiveIMMMessagePumpOwner_Start,
886     ActiveIMMMessagePumpOwner_End,
887     ActiveIMMMessagePumpOwner_OnTranslateMessage,
888     ActiveIMMMessagePumpOwner_Pause,
889     ActiveIMMMessagePumpOwner_Resume,
890 };
891 
ActiveIMMApp_Constructor(IUnknown * pUnkOuter,IUnknown ** ppOut)892 DECLSPEC_HIDDEN HRESULT ActiveIMMApp_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
893 {
894     ActiveIMMApp *This;
895     if (pUnkOuter)
896         return CLASS_E_NOAGGREGATION;
897 
898     This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ActiveIMMApp));
899     if (This == NULL)
900         return E_OUTOFMEMORY;
901 
902     This->IActiveIMMApp_iface.lpVtbl = &ActiveIMMAppVtbl;
903     This->IActiveIMMMessagePumpOwner_iface.lpVtbl = &ActiveIMMMessagePumpOwnerVtbl;
904     This->refCount = 1;
905 
906     TRACE("returning %p\n",This);
907     *ppOut = (IUnknown *)&This->IActiveIMMApp_iface;
908     return S_OK;
909 }
910