ReactOS  0.4.12-dev-918-g6c6e7b8
imm.c
Go to the documentation of this file.
1 /*
2  * IMM32 library
3  *
4  * Copyright 1998 Patrik Stridvall
5  * Copyright 2002, 2003, 2007 CodeWeavers, Aric Stewart
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21 
22 #include <stdarg.h>
23 #include <stdio.h>
24 
25 #include "windef.h"
26 #include "winbase.h"
27 #include "wingdi.h"
28 #include "winuser.h"
29 #include "winerror.h"
30 #include "wine/debug.h"
31 #include "imm.h"
32 #include "ddk/imm.h"
33 #include "winnls.h"
34 #include "winreg.h"
35 #include "wine/list.h"
36 #include "wine/unicode.h"
37 
39 
40 #define IMM_INIT_MAGIC 0x19650412
42 
43 typedef struct _tagImmHkl{
44  struct list entry;
48  WCHAR imeClassName[17]; /* 16 character max */
51 
52  /* Function Pointers */
53  BOOL (WINAPI *pImeInquire)(IMEINFO *, WCHAR *, const WCHAR *);
54  BOOL (WINAPI *pImeConfigure)(HKL, HWND, DWORD, void *);
55  BOOL (WINAPI *pImeDestroy)(UINT);
56  LRESULT (WINAPI *pImeEscape)(HIMC, UINT, void *);
57  BOOL (WINAPI *pImeSelect)(HIMC, BOOL);
58  BOOL (WINAPI *pImeSetActiveContext)(HIMC, BOOL);
59  UINT (WINAPI *pImeToAsciiEx)(UINT, UINT, const BYTE *, DWORD *, UINT, HIMC);
60  BOOL (WINAPI *pNotifyIME)(HIMC, DWORD, DWORD, DWORD);
61  BOOL (WINAPI *pImeRegisterWord)(const WCHAR *, DWORD, const WCHAR *);
62  BOOL (WINAPI *pImeUnregisterWord)(const WCHAR *, DWORD, const WCHAR *);
63  UINT (WINAPI *pImeEnumRegisterWord)(REGISTERWORDENUMPROCW, const WCHAR *, DWORD, const WCHAR *, void *);
64  BOOL (WINAPI *pImeSetCompositionString)(HIMC, DWORD, const void *, DWORD, const void *, DWORD);
65  DWORD (WINAPI *pImeConversionList)(HIMC, const WCHAR *, CANDIDATELIST *, DWORD, UINT);
66  BOOL (WINAPI *pImeProcessKey)(HIMC, UINT, LPARAM, const BYTE *);
67  UINT (WINAPI *pImeGetRegisterWordStyle)(UINT, STYLEBUFW *);
68  DWORD (WINAPI *pImeGetImeMenuItems)(HIMC, DWORD, DWORD, IMEMENUITEMINFOW *, IMEMENUITEMINFOW *, DWORD);
69 } ImmHkl;
70 
71 typedef struct tagInputContextData
72 {
76 
82 
83 #define WINE_IMC_VALID_MAGIC 0x56434D49
84 
85 typedef struct _tagTRANSMSG {
90 
91 typedef struct _tagIMMThreadData {
92  struct list entry;
99 
102 
103 static const WCHAR szwWineIMCProperty[] = {'W','i','n','e','I','m','m','H','I','M','C','P','r','o','p','e','r','t','y',0};
104 
105 static const WCHAR szImeFileW[] = {'I','m','e',' ','F','i','l','e',0};
106 static const WCHAR szLayoutTextW[] = {'L','a','y','o','u','t',' ','T','e','x','t',0};
107 static const WCHAR szImeRegFmt[] = {'S','y','s','t','e','m','\\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\','C','o','n','t','r','o','l','\\','K','e','y','b','o','a','r','d',' ','L','a','y','o','u','t','s','\\','%','0','8','l','x',0};
108 
109 static const WCHAR szwIME[] = {'I','M','E',0};
110 static const WCHAR szwDefaultIME[] = {'D','e','f','a','u','l','t',' ','I','M','E',0};
111 
114 {
115  0, 0, &threaddata_cs,
117  0, 0, { (DWORD_PTR)(__FILE__ ": threaddata_cs") }
118 };
119 static CRITICAL_SECTION threaddata_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
121 
122 #define is_himc_ime_unicode(p) (p->immKbd->imeInfo.fdwProperty & IME_PROP_UNICODE)
123 #define is_kbd_ime_unicode(p) (p->imeInfo.fdwProperty & IME_PROP_UNICODE)
124 
125 static BOOL IMM_DestroyContext(HIMC hIMC);
126 static InputContextData* get_imc_data(HIMC hIMC);
127 
128 static inline WCHAR *strdupAtoW( const char *str )
129 {
130  WCHAR *ret = NULL;
131  if (str)
132  {
133  DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
134  if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
135  MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
136  }
137  return ret;
138 }
139 
140 static inline CHAR *strdupWtoA( const WCHAR *str )
141 {
142  CHAR *ret = NULL;
143  if (str)
144  {
145  DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
146  if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
147  WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
148  }
149  return ret;
150 }
151 
154 {
155  DWORD ret, i, len;
156 
158  if ( lpDst && dwBufLen > 0 )
159  {
160  *lpDst = *lpSrc;
161  lpDst->dwOffset[0] = ret;
162  }
163 
164  for ( i = 0; i < lpSrc->dwCount; i++)
165  {
166  LPBYTE src = (LPBYTE)lpSrc + lpSrc->dwOffset[i];
167 
168  if ( lpDst && dwBufLen > 0 )
169  {
170  LPBYTE dest = (LPBYTE)lpDst + lpDst->dwOffset[i];
171 
173  (LPSTR)dest, dwBufLen, NULL, NULL);
174 
175  if ( i + 1 < lpSrc->dwCount )
176  lpDst->dwOffset[i+1] = lpDst->dwOffset[i] + len * sizeof(char);
177  dwBufLen -= len * sizeof(char);
178  }
179  else
181 
182  ret += len * sizeof(char);
183  }
184 
185  if ( lpDst )
186  lpDst->dwSize = ret;
187 
188  return ret;
189 }
190 
193 {
194  DWORD ret, i, len;
195 
197  if ( lpDst && dwBufLen > 0 )
198  {
199  *lpDst = *lpSrc;
200  lpDst->dwOffset[0] = ret;
201  }
202 
203  for ( i = 0; i < lpSrc->dwCount; i++)
204  {
205  LPBYTE src = (LPBYTE)lpSrc + lpSrc->dwOffset[i];
206 
207  if ( lpDst && dwBufLen > 0 )
208  {
209  LPBYTE dest = (LPBYTE)lpDst + lpDst->dwOffset[i];
210 
212  (LPWSTR)dest, dwBufLen);
213 
214  if ( i + 1 < lpSrc->dwCount )
215  lpDst->dwOffset[i+1] = lpDst->dwOffset[i] + len * sizeof(WCHAR);
216  dwBufLen -= len * sizeof(WCHAR);
217  }
218  else
219  len = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)src, -1, NULL, 0);
220 
221  ret += len * sizeof(WCHAR);
222  }
223 
224  if ( lpDst )
225  lpDst->dwSize = ret;
226 
227  return ret;
228 }
229 
231 {
233  DWORD process;
234 
235  if (hwnd)
236  {
237  if (!(thread = GetWindowThreadProcessId(hwnd, &process))) return NULL;
238  if (process != GetCurrentProcessId()) return NULL;
239  }
240  else if (thread)
241  {
243  if (!h) return NULL;
245  CloseHandle(h);
246  if (process != GetCurrentProcessId()) return NULL;
247  }
248  else
250 
253  if (data->threadID == thread) return data;
254 
256  data->threadID = thread;
258  TRACE("Thread Data Created (%x)\n",thread);
259  return data;
260 }
261 
263 {
265 
266  if (!data)
267  return FALSE;
268 
269  return data->threadDefault;
270 }
271 
272 static void IMM_FreeThreadData(void)
273 {
275 
278  {
279  if (data->threadID == GetCurrentThreadId())
280  {
281  list_remove(&data->entry);
283  IMM_DestroyContext(data->defaultContext);
285  TRACE("Thread Data Destroyed\n");
286  return;
287  }
288  }
290 }
291 
293 {
294  static const WCHAR display_device_guid_propW[] = {
295  '_','_','w','i','n','e','_','d','i','s','p','l','a','y','_',
296  'd','e','v','i','c','e','_','g','u','i','d',0 };
297  static const WCHAR key_pathW[] = {
298  'S','y','s','t','e','m','\\',
299  'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
300  'C','o','n','t','r','o','l','\\',
301  'V','i','d','e','o','\\','{',0};
302  static const WCHAR displayW[] = {'}','\\','0','0','0','0',0};
303  static const WCHAR driverW[] = {'G','r','a','p','h','i','c','s','D','r','i','v','e','r',0};
304 
305  HMODULE ret = 0;
306  HKEY hkey;
307  DWORD size;
309  WCHAR key[ARRAY_SIZE( key_pathW ) + ARRAY_SIZE( displayW ) + 40];
310  UINT guid_atom = HandleToULong( GetPropW( GetDesktopWindow(), display_device_guid_propW ));
311 
312  if (!guid_atom) return 0;
313  memcpy( key, key_pathW, sizeof(key_pathW) );
314  if (!GlobalGetAtomNameW( guid_atom, key + strlenW(key), 40 )) return 0;
315  strcatW( key, displayW );
316  if (RegOpenKeyW( HKEY_LOCAL_MACHINE, key, &hkey )) return 0;
317  size = sizeof(path);
318  if (!RegQueryValueExW( hkey, driverW, NULL, NULL, (BYTE *)path, &size )) ret = LoadLibraryW( path );
319  RegCloseKey( hkey );
320  TRACE( "%s %p\n", debugstr_w(path), ret );
321  return ret;
322 }
323 
324 /* ImmHkl loading and freeing */
325 #define LOAD_FUNCPTR(f) if((ptr->p##f = (LPVOID)GetProcAddress(ptr->hIME, #f)) == NULL){WARN("Can't find function %s in ime\n", #f);}
327 {
328  ImmHkl *ptr;
330 
331  TRACE("Seeking ime for keyboard %p\n",hkl);
332 
334  {
335  if (ptr->hkl == hkl)
336  return ptr;
337  }
338  /* not found... create it */
339 
341 
342  ptr->hkl = hkl;
344  if (!ptr->hIME) ptr->hIME = load_graphics_driver();
345  if (ptr->hIME)
346  {
348  if (!ptr->pImeInquire || !ptr->pImeInquire(&ptr->imeInfo, ptr->imeClassName, NULL))
349  {
350  FreeLibrary(ptr->hIME);
351  ptr->hIME = NULL;
352  }
353  else
354  {
357  if (!ptr->pImeSelect || !ptr->pImeDestroy)
358  {
359  FreeLibrary(ptr->hIME);
360  ptr->hIME = NULL;
361  }
362  else
363  {
377  /* make sure our classname is WCHAR */
378  if (!is_kbd_ime_unicode(ptr))
379  {
380  WCHAR bufW[17];
381  MultiByteToWideChar(CP_ACP, 0, (LPSTR)ptr->imeClassName,
382  -1, bufW, 17);
383  lstrcpyW(ptr->imeClassName, bufW);
384  }
385  }
386  }
387  }
388  list_add_head(&ImmHklList,&ptr->entry);
389 
390  return ptr;
391 }
392 #undef LOAD_FUNCPTR
393 
395 {
396  ImmHkl *immHkl = IMM_GetImmHkl(hkl);
397  return immHkl->UIWnd;
398 }
399 
400 static void IMM_FreeAllImmHkl(void)
401 {
402  ImmHkl *ptr,*cursor2;
403 
405  {
406  list_remove(&ptr->entry);
407  if (ptr->hIME)
408  {
409  ptr->pImeDestroy(1);
410  FreeLibrary(ptr->hIME);
411  }
412  if (ptr->UIWnd)
413  DestroyWindow(ptr->UIWnd);
415  }
416 }
417 
418 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpReserved)
419 {
420  TRACE("%p, %x, %p\n",hInstDLL,fdwReason,lpReserved);
421  switch (fdwReason)
422  {
423  case DLL_PROCESS_ATTACH:
425  {
426  return FALSE;
427  }
428  break;
429  case DLL_THREAD_ATTACH:
430  break;
431  case DLL_THREAD_DETACH:
433  break;
434  case DLL_PROCESS_DETACH:
435  if (lpReserved) break;
438  break;
439  }
440  return TRUE;
441 }
442 
443 /* for posting messages as the IME */
445 {
446  HWND target = GetFocus();
447  if (!target)
448  PostMessageW(data->IMC.hWnd,msg,wParam,lParam);
449  else
451 }
452 
453 /* for sending messages as the IME */
455 {
456  HWND target = GetFocus();
457  if (!target)
458  SendMessageW(data->IMC.hWnd,msg,wParam,lParam);
459  else
461 }
462 
464 {
465  HWND target;
466 
467  target = data->IMC.hWnd;
468  if (!target) target = GetFocus();
469 
470  if (target)
472 
473  return 0;
474 }
475 
477 {
478  HIMCC rc;
480  rc = ImmCreateIMCC(sizeof(COMPOSITIONSTRING));
481  ptr = ImmLockIMCC(rc);
482  memset(ptr,0,sizeof(COMPOSITIONSTRING));
483  ptr->dwSize = sizeof(COMPOSITIONSTRING);
484  ImmUnlockIMCC(rc);
485  return rc;
486 }
487 
489 {
490  InputContextData *data = hIMC;
491 
492  if (hIMC == NULL)
493  return NULL;
494 
495  if(IsBadReadPtr(data, sizeof(InputContextData)) || data->magic != WINE_IMC_VALID_MAGIC)
496  {
498  return NULL;
499  }
500  return data;
501 }
502 
504 {
505  HIMC ret;
507 
508  if (!thread_data) return 0;
509 
510  if (thread_data->defaultContext)
511  {
512  ret = thread_data->defaultContext;
514  return ret;
515  }
516 
517  /* can't create a default context in another thread */
518  if (thread_data->threadID != GetCurrentThreadId())
519  {
521  return 0;
522  }
523 
525 
526  ret = ImmCreateContext();
527  if (!ret) return 0;
528  ((InputContextData*)ret)->threadDefault = TRUE;
529 
530  /* thread_data is in the current thread so we can assume it's still valid */
532 
533  if (thread_data->defaultContext) /* someone beat us */
534  {
536  ret = thread_data->defaultContext;
537  }
538  else thread_data->defaultContext = ret;
539 
541  return ret;
542 }
543 
545 {
547 
548  if (hWnd)
549  {
551  if (thread != GetCurrentThreadId()) return TRUE;
552  }
553  data = get_imc_data(hIMC);
554  if (data && data->threadID != GetCurrentThreadId())
555  return TRUE;
556 
557  return FALSE;
558 }
559 
560 /***********************************************************************
561  * ImmAssociateContext (IMM32.@)
562  */
564 {
565  HIMC old = NULL;
567 
568  TRACE("(%p, %p):\n", hWnd, hIMC);
569 
570  if(hIMC && !data)
571  return NULL;
572 
573  /*
574  * If already associated just return
575  */
576  if (hIMC && data->IMC.hWnd == hWnd)
577  return hIMC;
578 
579  if (hIMC && IMM_IsCrossThreadAccess(hWnd, hIMC))
580  return NULL;
581 
582  if (hWnd)
583  {
584  HIMC defaultContext = get_default_context( hWnd );
586 
587  if (old == NULL)
588  old = defaultContext;
589  else if (old == (HIMC)-1)
590  old = NULL;
591 
592  if (hIMC != defaultContext)
593  {
594  if (hIMC == NULL) /* Meaning disable imm for that window*/
596  else
598  }
599 
600  if (old)
601  {
602  InputContextData *old_data = old;
603  if (old_data->IMC.hWnd == hWnd)
604  old_data->IMC.hWnd = NULL;
605  }
606  }
607 
608  if (!hIMC)
609  return old;
610 
611  if(GetActiveWindow() == data->IMC.hWnd)
612  {
614  data->IMC.hWnd = hWnd;
616  }
617 
618  return old;
619 }
620 
621 
622 /*
623  * Helper function for ImmAssociateContextEx
624  */
626 {
627  HIMC hImc = (HIMC)lParam;
629  return TRUE;
630 }
631 
632 /***********************************************************************
633  * ImmAssociateContextEx (IMM32.@)
634  */
636 {
637  TRACE("(%p, %p, 0x%x):\n", hWnd, hIMC, dwFlags);
638 
639  if (!hWnd)
640  return FALSE;
641 
642  switch (dwFlags)
643  {
644  case 0:
646  return TRUE;
647  case IACE_DEFAULT:
648  {
649  HIMC defaultContext = get_default_context( hWnd );
650  if (!defaultContext) return FALSE;
651  ImmAssociateContext(hWnd,defaultContext);
652  return TRUE;
653  }
657  return TRUE;
658  case IACE_CHILDREN:
660  return TRUE;
661  default:
662  FIXME("Unknown dwFlags 0x%x\n",dwFlags);
663  return FALSE;
664  }
665 }
666 
667 /***********************************************************************
668  * ImmConfigureIMEA (IMM32.@)
669  */
671  HKL hKL, HWND hWnd, DWORD dwMode, LPVOID lpData)
672 {
673  ImmHkl *immHkl = IMM_GetImmHkl(hKL);
674 
675  TRACE("(%p, %p, %d, %p):\n", hKL, hWnd, dwMode, lpData);
676 
677  if (dwMode == IME_CONFIG_REGISTERWORD && !lpData)
678  return FALSE;
679 
680  if (immHkl->hIME && immHkl->pImeConfigure)
681  {
682  if (dwMode != IME_CONFIG_REGISTERWORD || !is_kbd_ime_unicode(immHkl))
683  return immHkl->pImeConfigure(hKL,hWnd,dwMode,lpData);
684  else
685  {
686  REGISTERWORDW rww;
687  REGISTERWORDA *rwa = lpData;
688  BOOL rc;
689 
690  rww.lpReading = strdupAtoW(rwa->lpReading);
691  rww.lpWord = strdupAtoW(rwa->lpWord);
692  rc = immHkl->pImeConfigure(hKL,hWnd,dwMode,&rww);
694  HeapFree(GetProcessHeap(),0,rww.lpWord);
695  return rc;
696  }
697  }
698  else
699  return FALSE;
700 }
701 
702 /***********************************************************************
703  * ImmConfigureIMEW (IMM32.@)
704  */
706  HKL hKL, HWND hWnd, DWORD dwMode, LPVOID lpData)
707 {
708  ImmHkl *immHkl = IMM_GetImmHkl(hKL);
709 
710  TRACE("(%p, %p, %d, %p):\n", hKL, hWnd, dwMode, lpData);
711 
712  if (dwMode == IME_CONFIG_REGISTERWORD && !lpData)
713  return FALSE;
714 
715  if (immHkl->hIME && immHkl->pImeConfigure)
716  {
717  if (dwMode != IME_CONFIG_REGISTERWORD || is_kbd_ime_unicode(immHkl))
718  return immHkl->pImeConfigure(hKL,hWnd,dwMode,lpData);
719  else
720  {
721  REGISTERWORDW *rww = lpData;
722  REGISTERWORDA rwa;
723  BOOL rc;
724 
725  rwa.lpReading = strdupWtoA(rww->lpReading);
726  rwa.lpWord = strdupWtoA(rww->lpWord);
727  rc = immHkl->pImeConfigure(hKL,hWnd,dwMode,&rwa);
729  HeapFree(GetProcessHeap(),0,rwa.lpWord);
730  return rc;
731  }
732  }
733  else
734  return FALSE;
735 }
736 
737 /***********************************************************************
738  * ImmCreateContext (IMM32.@)
739  */
741 {
742  InputContextData *new_context;
743  LPGUIDELINE gl;
744  LPCANDIDATEINFO ci;
745  int i;
746 
748 
749  /* Load the IME */
750  new_context->immKbd = IMM_GetImmHkl(GetKeyboardLayout(0));
751 
752  if (!new_context->immKbd->hIME)
753  {
754  TRACE("IME dll could not be loaded\n");
755  HeapFree(GetProcessHeap(),0,new_context);
756  return 0;
757  }
758 
759  /* the HIMCCs are never NULL */
760  new_context->IMC.hCompStr = ImmCreateBlankCompStr();
761  new_context->IMC.hMsgBuf = ImmCreateIMCC(0);
762  new_context->IMC.hCandInfo = ImmCreateIMCC(sizeof(CANDIDATEINFO));
763  ci = ImmLockIMCC(new_context->IMC.hCandInfo);
764  memset(ci,0,sizeof(CANDIDATEINFO));
765  ci->dwSize = sizeof(CANDIDATEINFO);
766  ImmUnlockIMCC(new_context->IMC.hCandInfo);
767  new_context->IMC.hGuideLine = ImmCreateIMCC(sizeof(GUIDELINE));
768  gl = ImmLockIMCC(new_context->IMC.hGuideLine);
769  memset(gl,0,sizeof(GUIDELINE));
770  gl->dwSize = sizeof(GUIDELINE);
771  ImmUnlockIMCC(new_context->IMC.hGuideLine);
772 
773  for (i = 0; i < ARRAY_SIZE(new_context->IMC.cfCandForm); i++)
774  new_context->IMC.cfCandForm[i].dwIndex = ~0u;
775 
776  /* Initialize the IME Private */
777  new_context->IMC.hPrivate = ImmCreateIMCC(new_context->immKbd->imeInfo.dwPrivateDataSize);
778 
779  new_context->IMC.fdwConversion = new_context->immKbd->imeInfo.fdwConversionCaps;
780  new_context->IMC.fdwSentence = new_context->immKbd->imeInfo.fdwSentenceCaps;
781 
782  if (!new_context->immKbd->pImeSelect(new_context, TRUE))
783  {
784  TRACE("Selection of IME failed\n");
785  IMM_DestroyContext(new_context);
786  return 0;
787  }
788  new_context->threadID = GetCurrentThreadId();
789  SendMessageW(GetFocus(), WM_IME_SELECT, TRUE, (LPARAM)new_context->immKbd);
790 
791  new_context->immKbd->uSelected++;
792  TRACE("Created context %p\n",new_context);
793 
794  new_context->magic = WINE_IMC_VALID_MAGIC;
795  return new_context;
796 }
797 
799 {
801 
802  TRACE("Destroying %p\n",hIMC);
803 
804  if (!data)
805  return FALSE;
806 
807  data->immKbd->uSelected --;
808  data->immKbd->pImeSelect(hIMC, FALSE);
809  SendMessageW(data->IMC.hWnd, WM_IME_SELECT, FALSE, (LPARAM)data->immKbd);
810 
811  ImmDestroyIMCC(data->IMC.hCompStr);
812  ImmDestroyIMCC(data->IMC.hCandInfo);
813  ImmDestroyIMCC(data->IMC.hGuideLine);
814  ImmDestroyIMCC(data->IMC.hPrivate);
815  ImmDestroyIMCC(data->IMC.hMsgBuf);
816 
817  data->magic = 0;
819 
820  return TRUE;
821 }
822 
823 /***********************************************************************
824  * ImmDestroyContext (IMM32.@)
825  */
827 {
828  if (!IMM_IsDefaultContext(hIMC) && !IMM_IsCrossThreadAccess(NULL, hIMC))
829  return IMM_DestroyContext(hIMC);
830  else
831  return FALSE;
832 }
833 
834 /***********************************************************************
835  * ImmDisableIME (IMM32.@)
836  */
838 {
839  if (idThread == (DWORD)-1)
840  disable_ime = TRUE;
841  else {
843  if (!thread_data) return FALSE;
844  thread_data->disableIME = TRUE;
846  }
847  return TRUE;
848 }
849 
850 /***********************************************************************
851  * ImmEnumRegisterWordA (IMM32.@)
852  */
854  HKL hKL, REGISTERWORDENUMPROCA lpfnEnumProc,
855  LPCSTR lpszReading, DWORD dwStyle,
856  LPCSTR lpszRegister, LPVOID lpData)
857 {
858  ImmHkl *immHkl = IMM_GetImmHkl(hKL);
859  TRACE("(%p, %p, %s, %d, %s, %p):\n", hKL, lpfnEnumProc,
860  debugstr_a(lpszReading), dwStyle, debugstr_a(lpszRegister), lpData);
861  if (immHkl->hIME && immHkl->pImeEnumRegisterWord)
862  {
863  if (!is_kbd_ime_unicode(immHkl))
864  return immHkl->pImeEnumRegisterWord((REGISTERWORDENUMPROCW)lpfnEnumProc,
865  (LPCWSTR)lpszReading, dwStyle, (LPCWSTR)lpszRegister, lpData);
866  else
867  {
868  LPWSTR lpszwReading = strdupAtoW(lpszReading);
869  LPWSTR lpszwRegister = strdupAtoW(lpszRegister);
870  BOOL rc;
871 
872  rc = immHkl->pImeEnumRegisterWord((REGISTERWORDENUMPROCW)lpfnEnumProc,
873  lpszwReading, dwStyle, lpszwRegister,
874  lpData);
875 
876  HeapFree(GetProcessHeap(),0,lpszwReading);
877  HeapFree(GetProcessHeap(),0,lpszwRegister);
878  return rc;
879  }
880  }
881  else
882  return 0;
883 }
884 
885 /***********************************************************************
886  * ImmEnumRegisterWordW (IMM32.@)
887  */
889  HKL hKL, REGISTERWORDENUMPROCW lpfnEnumProc,
890  LPCWSTR lpszReading, DWORD dwStyle,
891  LPCWSTR lpszRegister, LPVOID lpData)
892 {
893  ImmHkl *immHkl = IMM_GetImmHkl(hKL);
894  TRACE("(%p, %p, %s, %d, %s, %p):\n", hKL, lpfnEnumProc,
895  debugstr_w(lpszReading), dwStyle, debugstr_w(lpszRegister), lpData);
896  if (immHkl->hIME && immHkl->pImeEnumRegisterWord)
897  {
898  if (is_kbd_ime_unicode(immHkl))
899  return immHkl->pImeEnumRegisterWord(lpfnEnumProc, lpszReading, dwStyle,
900  lpszRegister, lpData);
901  else
902  {
903  LPSTR lpszaReading = strdupWtoA(lpszReading);
904  LPSTR lpszaRegister = strdupWtoA(lpszRegister);
905  BOOL rc;
906 
907  rc = immHkl->pImeEnumRegisterWord(lpfnEnumProc, (LPCWSTR)lpszaReading,
908  dwStyle, (LPCWSTR)lpszaRegister, lpData);
909 
910  HeapFree(GetProcessHeap(),0,lpszaReading);
911  HeapFree(GetProcessHeap(),0,lpszaRegister);
912  return rc;
913  }
914  }
915  else
916  return 0;
917 }
918 
919 static inline BOOL EscapeRequiresWA(UINT uEscape)
920 {
921  if (uEscape == IME_ESC_GET_EUDC_DICTIONARY ||
922  uEscape == IME_ESC_SET_EUDC_DICTIONARY ||
923  uEscape == IME_ESC_IME_NAME ||
924  uEscape == IME_ESC_GETHELPFILENAME)
925  return TRUE;
926  return FALSE;
927 }
928 
929 /***********************************************************************
930  * ImmEscapeA (IMM32.@)
931  */
933  HKL hKL, HIMC hIMC,
934  UINT uEscape, LPVOID lpData)
935 {
936  ImmHkl *immHkl = IMM_GetImmHkl(hKL);
937  TRACE("(%p, %p, %d, %p):\n", hKL, hIMC, uEscape, lpData);
938 
939  if (immHkl->hIME && immHkl->pImeEscape)
940  {
941  if (!EscapeRequiresWA(uEscape) || !is_kbd_ime_unicode(immHkl))
942  return immHkl->pImeEscape(hIMC,uEscape,lpData);
943  else
944  {
945  WCHAR buffer[81]; /* largest required buffer should be 80 */
946  LRESULT rc;
947  if (uEscape == IME_ESC_SET_EUDC_DICTIONARY)
948  {
949  MultiByteToWideChar(CP_ACP,0,lpData,-1,buffer,81);
950  rc = immHkl->pImeEscape(hIMC,uEscape,buffer);
951  }
952  else
953  {
954  rc = immHkl->pImeEscape(hIMC,uEscape,buffer);
955  WideCharToMultiByte(CP_ACP,0,buffer,-1,lpData,80, NULL, NULL);
956  }
957  return rc;
958  }
959  }
960  else
961  return 0;
962 }
963 
964 /***********************************************************************
965  * ImmEscapeW (IMM32.@)
966  */
968  HKL hKL, HIMC hIMC,
969  UINT uEscape, LPVOID lpData)
970 {
971  ImmHkl *immHkl = IMM_GetImmHkl(hKL);
972  TRACE("(%p, %p, %d, %p):\n", hKL, hIMC, uEscape, lpData);
973 
974  if (immHkl->hIME && immHkl->pImeEscape)
975  {
976  if (!EscapeRequiresWA(uEscape) || is_kbd_ime_unicode(immHkl))
977  return immHkl->pImeEscape(hIMC,uEscape,lpData);
978  else
979  {
980  CHAR buffer[81]; /* largest required buffer should be 80 */
981  LRESULT rc;
982  if (uEscape == IME_ESC_SET_EUDC_DICTIONARY)
983  {
984  WideCharToMultiByte(CP_ACP,0,lpData,-1,buffer,81, NULL, NULL);
985  rc = immHkl->pImeEscape(hIMC,uEscape,buffer);
986  }
987  else
988  {
989  rc = immHkl->pImeEscape(hIMC,uEscape,buffer);
990  MultiByteToWideChar(CP_ACP,0,buffer,-1,lpData,80);
991  }
992  return rc;
993  }
994  }
995  else
996  return 0;
997 }
998 
999 /***********************************************************************
1000  * ImmGetCandidateListA (IMM32.@)
1001  */
1003  HIMC hIMC, DWORD dwIndex,
1004  LPCANDIDATELIST lpCandList, DWORD dwBufLen)
1005 {
1007  LPCANDIDATEINFO candinfo;
1008  LPCANDIDATELIST candlist;
1009  DWORD ret = 0;
1010 
1011  TRACE("%p, %d, %p, %d\n", hIMC, dwIndex, lpCandList, dwBufLen);
1012 
1013  if (!data || !data->IMC.hCandInfo)
1014  return 0;
1015 
1016  candinfo = ImmLockIMCC(data->IMC.hCandInfo);
1017  if (dwIndex >= candinfo->dwCount || dwIndex >= ARRAY_SIZE(candinfo->dwOffset))
1018  goto done;
1019 
1020  candlist = (LPCANDIDATELIST)((LPBYTE)candinfo + candinfo->dwOffset[dwIndex]);
1021  if ( !candlist->dwSize || !candlist->dwCount )
1022  goto done;
1023 
1024  if ( !is_himc_ime_unicode(data) )
1025  {
1026  ret = candlist->dwSize;
1027  if ( lpCandList && dwBufLen >= ret )
1028  memcpy(lpCandList, candlist, ret);
1029  }
1030  else
1031  ret = convert_candidatelist_WtoA( candlist, lpCandList, dwBufLen);
1032 
1033 done:
1034  ImmUnlockIMCC(data->IMC.hCandInfo);
1035  return ret;
1036 }
1037 
1038 /***********************************************************************
1039  * ImmGetCandidateListCountA (IMM32.@)
1040  */
1042  HIMC hIMC, LPDWORD lpdwListCount)
1043 {
1045  LPCANDIDATEINFO candinfo;
1046  DWORD ret, count;
1047 
1048  TRACE("%p, %p\n", hIMC, lpdwListCount);
1049 
1050  if (!data || !lpdwListCount || !data->IMC.hCandInfo)
1051  return 0;
1052 
1053  candinfo = ImmLockIMCC(data->IMC.hCandInfo);
1054 
1055  *lpdwListCount = count = candinfo->dwCount;
1056 
1057  if ( !is_himc_ime_unicode(data) )
1058  ret = candinfo->dwSize;
1059  else
1060  {
1061  ret = sizeof(CANDIDATEINFO);
1062  while ( count-- )
1063  ret += ImmGetCandidateListA(hIMC, count, NULL, 0);
1064  }
1065 
1066  ImmUnlockIMCC(data->IMC.hCandInfo);
1067  return ret;
1068 }
1069 
1070 /***********************************************************************
1071  * ImmGetCandidateListCountW (IMM32.@)
1072  */
1074  HIMC hIMC, LPDWORD lpdwListCount)
1075 {
1077  LPCANDIDATEINFO candinfo;
1078  DWORD ret, count;
1079 
1080  TRACE("%p, %p\n", hIMC, lpdwListCount);
1081 
1082  if (!data || !lpdwListCount || !data->IMC.hCandInfo)
1083  return 0;
1084 
1085  candinfo = ImmLockIMCC(data->IMC.hCandInfo);
1086 
1087  *lpdwListCount = count = candinfo->dwCount;
1088 
1089  if ( is_himc_ime_unicode(data) )
1090  ret = candinfo->dwSize;
1091  else
1092  {
1093  ret = sizeof(CANDIDATEINFO);
1094  while ( count-- )
1095  ret += ImmGetCandidateListW(hIMC, count, NULL, 0);
1096  }
1097 
1098  ImmUnlockIMCC(data->IMC.hCandInfo);
1099  return ret;
1100 }
1101 
1102 /***********************************************************************
1103  * ImmGetCandidateListW (IMM32.@)
1104  */
1106  HIMC hIMC, DWORD dwIndex,
1107  LPCANDIDATELIST lpCandList, DWORD dwBufLen)
1108 {
1110  LPCANDIDATEINFO candinfo;
1111  LPCANDIDATELIST candlist;
1112  DWORD ret = 0;
1113 
1114  TRACE("%p, %d, %p, %d\n", hIMC, dwIndex, lpCandList, dwBufLen);
1115 
1116  if (!data || !data->IMC.hCandInfo)
1117  return 0;
1118 
1119  candinfo = ImmLockIMCC(data->IMC.hCandInfo);
1120  if (dwIndex >= candinfo->dwCount || dwIndex >= ARRAY_SIZE(candinfo->dwOffset))
1121  goto done;
1122 
1123  candlist = (LPCANDIDATELIST)((LPBYTE)candinfo + candinfo->dwOffset[dwIndex]);
1124  if ( !candlist->dwSize || !candlist->dwCount )
1125  goto done;
1126 
1127  if ( is_himc_ime_unicode(data) )
1128  {
1129  ret = candlist->dwSize;
1130  if ( lpCandList && dwBufLen >= ret )
1131  memcpy(lpCandList, candlist, ret);
1132  }
1133  else
1134  ret = convert_candidatelist_AtoW( candlist, lpCandList, dwBufLen);
1135 
1136 done:
1137  ImmUnlockIMCC(data->IMC.hCandInfo);
1138  return ret;
1139 }
1140 
1141 /***********************************************************************
1142  * ImmGetCandidateWindow (IMM32.@)
1143  */
1145  HIMC hIMC, DWORD dwIndex, LPCANDIDATEFORM lpCandidate)
1146 {
1148 
1149  TRACE("%p, %d, %p\n", hIMC, dwIndex, lpCandidate);
1150 
1151  if (!data || !lpCandidate)
1152  return FALSE;
1153 
1154  if (dwIndex >= ARRAY_SIZE(data->IMC.cfCandForm))
1155  return FALSE;
1156 
1157  if (data->IMC.cfCandForm[dwIndex].dwIndex != dwIndex)
1158  return FALSE;
1159 
1160  *lpCandidate = data->IMC.cfCandForm[dwIndex];
1161 
1162  return TRUE;
1163 }
1164 
1165 /***********************************************************************
1166  * ImmGetCompositionFontA (IMM32.@)
1167  */
1169 {
1170  LOGFONTW lfW;
1171  BOOL rc;
1172 
1173  TRACE("(%p, %p):\n", hIMC, lplf);
1174 
1175  rc = ImmGetCompositionFontW(hIMC,&lfW);
1176  if (!rc || !lplf)
1177  return FALSE;
1178 
1179  memcpy(lplf,&lfW,sizeof(LOGFONTA));
1180  WideCharToMultiByte(CP_ACP, 0, lfW.lfFaceName, -1, lplf->lfFaceName,
1181  LF_FACESIZE, NULL, NULL);
1182  return TRUE;
1183 }
1184 
1185 /***********************************************************************
1186  * ImmGetCompositionFontW (IMM32.@)
1187  */
1189 {
1191 
1192  TRACE("(%p, %p):\n", hIMC, lplf);
1193 
1194  if (!data || !lplf)
1195  return FALSE;
1196 
1197  *lplf = data->IMC.lfFont.W;
1198 
1199  return TRUE;
1200 }
1201 
1202 
1203 /* Helpers for the GetCompositionString functions */
1204 
1206  BOOL unicode )
1207 {
1208  INT rc;
1209 
1210  if (is_himc_ime_unicode(data) && !unicode)
1211  rc = WideCharToMultiByte(CP_ACP, 0, (LPWSTR)source, slen, (LPSTR)target, tlen, NULL, NULL);
1212  else if (!is_himc_ime_unicode(data) && unicode)
1213  rc = MultiByteToWideChar(CP_ACP, 0, (LPSTR)source, slen, (LPWSTR)target, tlen) * sizeof(WCHAR);
1214  else
1215  {
1216  int dlen = (unicode)?sizeof(WCHAR):sizeof(CHAR);
1217  memcpy( target, source, min(slen,tlen)*dlen);
1218  rc = slen*dlen;
1219  }
1220 
1221  return rc;
1222 }
1223 
1225  LPBYTE target, INT tlen, BOOL unicode )
1226 {
1227  INT rc;
1228 
1229  if (is_himc_ime_unicode(data) && !unicode)
1230  {
1231  rc = WideCharToMultiByte(CP_ACP, 0, (LPWSTR)ssource, sslen, NULL, 0, NULL, NULL);
1232  if (tlen)
1233  {
1234  const BYTE *src = source;
1235  LPBYTE dst = target;
1236  int i, j = 0, k = 0;
1237 
1238  if (rc < tlen)
1239  tlen = rc;
1240  for (i = 0; i < sslen; ++i)
1241  {
1242  int len;
1243 
1244  len = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)ssource + i, 1,
1245  NULL, 0, NULL, NULL);
1246  for (; len > 0; --len)
1247  {
1248  dst[j++] = src[k];
1249 
1250  if (j >= tlen)
1251  goto end;
1252  }
1253  ++k;
1254  }
1255  end:
1256  rc = j;
1257  }
1258  }
1259  else if (!is_himc_ime_unicode(data) && unicode)
1260  {
1261  rc = MultiByteToWideChar(CP_ACP, 0, (LPSTR)ssource, sslen, NULL, 0);
1262  if (tlen)
1263  {
1264  const BYTE *src = source;
1265  LPBYTE dst = target;
1266  int i, j = 0;
1267 
1268  if (rc < tlen)
1269  tlen = rc;
1270  for (i = 0; i < sslen; ++i)
1271  {
1272  if (IsDBCSLeadByte(((LPSTR)ssource)[i]))
1273  continue;
1274 
1275  dst[j++] = src[i];
1276 
1277  if (j >= tlen)
1278  break;
1279  }
1280  rc = j;
1281  }
1282  }
1283  else
1284  {
1285  memcpy( target, source, min(slen,tlen));
1286  rc = slen;
1287  }
1288 
1289  return rc;
1290 }
1291 
1293  LPBYTE target, INT tlen, BOOL unicode )
1294 {
1295  INT rc;
1296 
1297  if (is_himc_ime_unicode(data) && !unicode)
1298  {
1299  if (tlen)
1300  {
1301  int i;
1302 
1303  if (slen < tlen)
1304  tlen = slen;
1305  tlen /= sizeof (DWORD);
1306  for (i = 0; i < tlen; ++i)
1307  {
1308  ((DWORD *)target)[i] = WideCharToMultiByte(CP_ACP, 0, (LPWSTR)ssource,
1309  ((DWORD *)source)[i],
1310  NULL, 0,
1311  NULL, NULL);
1312  }
1313  rc = sizeof (DWORD) * i;
1314  }
1315  else
1316  rc = slen;
1317  }
1318  else if (!is_himc_ime_unicode(data) && unicode)
1319  {
1320  if (tlen)
1321  {
1322  int i;
1323 
1324  if (slen < tlen)
1325  tlen = slen;
1326  tlen /= sizeof (DWORD);
1327  for (i = 0; i < tlen; ++i)
1328  {
1329  ((DWORD *)target)[i] = MultiByteToWideChar(CP_ACP, 0, (LPSTR)ssource,
1330  ((DWORD *)source)[i],
1331  NULL, 0);
1332  }
1333  rc = sizeof (DWORD) * i;
1334  }
1335  else
1336  rc = slen;
1337  }
1338  else
1339  {
1340  memcpy( target, source, min(slen,tlen));
1341  rc = slen;
1342  }
1343 
1344  return rc;
1345 }
1346 
1348 {
1349  int rc;
1350 
1351  if (is_himc_ime_unicode(data) && !unicode)
1352  {
1353  rc = WideCharToMultiByte(CP_ACP, 0, (LPWSTR)ssource, offset, NULL, 0, NULL, NULL);
1354  }
1355  else if (!is_himc_ime_unicode(data) && unicode)
1356  {
1357  rc = MultiByteToWideChar(CP_ACP, 0, (LPSTR)ssource, offset, NULL, 0);
1358  }
1359  else
1360  rc = offset;
1361 
1362  return rc;
1363 }
1364 
1365 static LONG ImmGetCompositionStringT( HIMC hIMC, DWORD dwIndex, LPVOID lpBuf,
1366  DWORD dwBufLen, BOOL unicode)
1367 {
1368  LONG rc = 0;
1370  LPCOMPOSITIONSTRING compstr;
1371  LPBYTE compdata;
1372 
1373  TRACE("(%p, 0x%x, %p, %d)\n", hIMC, dwIndex, lpBuf, dwBufLen);
1374 
1375  if (!data)
1376  return FALSE;
1377 
1378  if (!data->IMC.hCompStr)
1379  return FALSE;
1380 
1381  compdata = ImmLockIMCC(data->IMC.hCompStr);
1382  compstr = (LPCOMPOSITIONSTRING)compdata;
1383 
1384  switch (dwIndex)
1385  {
1386  case GCS_RESULTSTR:
1387  TRACE("GCS_RESULTSTR\n");
1388  rc = CopyCompStringIMEtoClient(data, compdata + compstr->dwResultStrOffset, compstr->dwResultStrLen, lpBuf, dwBufLen, unicode);
1389  break;
1390  case GCS_COMPSTR:
1391  TRACE("GCS_COMPSTR\n");
1392  rc = CopyCompStringIMEtoClient(data, compdata + compstr->dwCompStrOffset, compstr->dwCompStrLen, lpBuf, dwBufLen, unicode);
1393  break;
1394  case GCS_COMPATTR:
1395  TRACE("GCS_COMPATTR\n");
1396  rc = CopyCompAttrIMEtoClient(data, compdata + compstr->dwCompAttrOffset, compstr->dwCompAttrLen,
1397  compdata + compstr->dwCompStrOffset, compstr->dwCompStrLen,
1398  lpBuf, dwBufLen, unicode);
1399  break;
1400  case GCS_COMPCLAUSE:
1401  TRACE("GCS_COMPCLAUSE\n");
1402  rc = CopyCompClauseIMEtoClient(data, compdata + compstr->dwCompClauseOffset,compstr->dwCompClauseLen,
1403  compdata + compstr->dwCompStrOffset,
1404  lpBuf, dwBufLen, unicode);
1405  break;
1406  case GCS_RESULTCLAUSE:
1407  TRACE("GCS_RESULTCLAUSE\n");
1408  rc = CopyCompClauseIMEtoClient(data, compdata + compstr->dwResultClauseOffset,compstr->dwResultClauseLen,
1409  compdata + compstr->dwResultStrOffset,
1410  lpBuf, dwBufLen, unicode);
1411  break;
1412  case GCS_RESULTREADSTR:
1413  TRACE("GCS_RESULTREADSTR\n");
1414  rc = CopyCompStringIMEtoClient(data, compdata + compstr->dwResultReadStrOffset, compstr->dwResultReadStrLen, lpBuf, dwBufLen, unicode);
1415  break;
1416  case GCS_RESULTREADCLAUSE:
1417  TRACE("GCS_RESULTREADCLAUSE\n");
1419  compdata + compstr->dwResultStrOffset,
1420  lpBuf, dwBufLen, unicode);
1421  break;
1422  case GCS_COMPREADSTR:
1423  TRACE("GCS_COMPREADSTR\n");
1424  rc = CopyCompStringIMEtoClient(data, compdata + compstr->dwCompReadStrOffset, compstr->dwCompReadStrLen, lpBuf, dwBufLen, unicode);
1425  break;
1426  case GCS_COMPREADATTR:
1427  TRACE("GCS_COMPREADATTR\n");
1428  rc = CopyCompAttrIMEtoClient(data, compdata + compstr->dwCompReadAttrOffset, compstr->dwCompReadAttrLen,
1429  compdata + compstr->dwCompReadStrOffset, compstr->dwCompReadStrLen,
1430  lpBuf, dwBufLen, unicode);
1431  break;
1432  case GCS_COMPREADCLAUSE:
1433  TRACE("GCS_COMPREADCLAUSE\n");
1434  rc = CopyCompClauseIMEtoClient(data, compdata + compstr->dwCompReadClauseOffset,compstr->dwCompReadClauseLen,
1435  compdata + compstr->dwCompStrOffset,
1436  lpBuf, dwBufLen, unicode);
1437  break;
1438  case GCS_CURSORPOS:
1439  TRACE("GCS_CURSORPOS\n");
1440  rc = CopyCompOffsetIMEtoClient(data, compstr->dwCursorPos, compdata + compstr->dwCompStrOffset, unicode);
1441  break;
1442  case GCS_DELTASTART:
1443  TRACE("GCS_DELTASTART\n");
1444  rc = CopyCompOffsetIMEtoClient(data, compstr->dwDeltaStart, compdata + compstr->dwCompStrOffset, unicode);
1445  break;
1446  default:
1447  FIXME("Unhandled index 0x%x\n",dwIndex);
1448  break;
1449  }
1450 
1451  ImmUnlockIMCC(data->IMC.hCompStr);
1452 
1453  return rc;
1454 }
1455 
1456 /***********************************************************************
1457  * ImmGetCompositionStringA (IMM32.@)
1458  */
1460  HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
1461 {
1462  return ImmGetCompositionStringT(hIMC, dwIndex, lpBuf, dwBufLen, FALSE);
1463 }
1464 
1465 
1466 /***********************************************************************
1467  * ImmGetCompositionStringW (IMM32.@)
1468  */
1470  HIMC hIMC, DWORD dwIndex,
1471  LPVOID lpBuf, DWORD dwBufLen)
1472 {
1473  return ImmGetCompositionStringT(hIMC, dwIndex, lpBuf, dwBufLen, TRUE);
1474 }
1475 
1476 /***********************************************************************
1477  * ImmGetCompositionWindow (IMM32.@)
1478  */
1480 {
1482 
1483  TRACE("(%p, %p)\n", hIMC, lpCompForm);
1484 
1485  if (!data)
1486  return FALSE;
1487 
1488  *lpCompForm = data->IMC.cfCompForm;
1489  return TRUE;
1490 }
1491 
1492 /***********************************************************************
1493  * ImmGetContext (IMM32.@)
1494  *
1495  */
1497 {
1498  HIMC rc;
1499 
1500  TRACE("%p\n", hWnd);
1501 
1502  if (!IsWindow(hWnd))
1503  {
1505  return NULL;
1506  }
1507 
1509  if (rc == (HIMC)-1)
1510  rc = NULL;
1511  else if (rc == NULL)
1512  rc = get_default_context( hWnd );
1513 
1514  if (rc)
1515  {
1516  InputContextData *data = rc;
1517  data->IMC.hWnd = hWnd;
1518  }
1519 
1520  TRACE("returning %p\n", rc);
1521 
1522  return rc;
1523 }
1524 
1525 /***********************************************************************
1526  * ImmGetConversionListA (IMM32.@)
1527  */
1529  HKL hKL, HIMC hIMC,
1530  LPCSTR pSrc, LPCANDIDATELIST lpDst,
1531  DWORD dwBufLen, UINT uFlag)
1532 {
1533  ImmHkl *immHkl = IMM_GetImmHkl(hKL);
1534  TRACE("(%p, %p, %s, %p, %d, %d):\n", hKL, hIMC, debugstr_a(pSrc), lpDst,
1535  dwBufLen, uFlag);
1536  if (immHkl->hIME && immHkl->pImeConversionList)
1537  {
1538  if (!is_kbd_ime_unicode(immHkl))
1539  return immHkl->pImeConversionList(hIMC,(LPCWSTR)pSrc,lpDst,dwBufLen,uFlag);
1540  else
1541  {
1542  LPCANDIDATELIST lpwDst;
1543  DWORD ret = 0, len;
1544  LPWSTR pwSrc = strdupAtoW(pSrc);
1545 
1546  len = immHkl->pImeConversionList(hIMC, pwSrc, NULL, 0, uFlag);
1547  lpwDst = HeapAlloc(GetProcessHeap(), 0, len);
1548  if ( lpwDst )
1549  {
1550  immHkl->pImeConversionList(hIMC, pwSrc, lpwDst, len, uFlag);
1551  ret = convert_candidatelist_WtoA( lpwDst, lpDst, dwBufLen);
1552  HeapFree(GetProcessHeap(), 0, lpwDst);
1553  }
1554  HeapFree(GetProcessHeap(), 0, pwSrc);
1555 
1556  return ret;
1557  }
1558  }
1559  else
1560  return 0;
1561 }
1562 
1563 /***********************************************************************
1564  * ImmGetConversionListW (IMM32.@)
1565  */
1567  HKL hKL, HIMC hIMC,
1568  LPCWSTR pSrc, LPCANDIDATELIST lpDst,
1569  DWORD dwBufLen, UINT uFlag)
1570 {
1571  ImmHkl *immHkl = IMM_GetImmHkl(hKL);
1572  TRACE("(%p, %p, %s, %p, %d, %d):\n", hKL, hIMC, debugstr_w(pSrc), lpDst,
1573  dwBufLen, uFlag);
1574  if (immHkl->hIME && immHkl->pImeConversionList)
1575  {
1576  if (is_kbd_ime_unicode(immHkl))
1577  return immHkl->pImeConversionList(hIMC,pSrc,lpDst,dwBufLen,uFlag);
1578  else
1579  {
1580  LPCANDIDATELIST lpaDst;
1581  DWORD ret = 0, len;
1582  LPSTR paSrc = strdupWtoA(pSrc);
1583 
1584  len = immHkl->pImeConversionList(hIMC, (LPCWSTR)paSrc, NULL, 0, uFlag);
1585  lpaDst = HeapAlloc(GetProcessHeap(), 0, len);
1586  if ( lpaDst )
1587  {
1588  immHkl->pImeConversionList(hIMC, (LPCWSTR)paSrc, lpaDst, len, uFlag);
1589  ret = convert_candidatelist_AtoW( lpaDst, lpDst, dwBufLen);
1590  HeapFree(GetProcessHeap(), 0, lpaDst);
1591  }
1592  HeapFree(GetProcessHeap(), 0, paSrc);
1593 
1594  return ret;
1595  }
1596  }
1597  else
1598  return 0;
1599 }
1600 
1601 /***********************************************************************
1602  * ImmGetConversionStatus (IMM32.@)
1603  */
1605  HIMC hIMC, LPDWORD lpfdwConversion, LPDWORD lpfdwSentence)
1606 {
1608 
1609  TRACE("%p %p %p\n", hIMC, lpfdwConversion, lpfdwSentence);
1610 
1611  if (!data)
1612  return FALSE;
1613 
1614  if (lpfdwConversion)
1615  *lpfdwConversion = data->IMC.fdwConversion;
1616  if (lpfdwSentence)
1617  *lpfdwSentence = data->IMC.fdwSentence;
1618 
1619  return TRUE;
1620 }
1621 
1623 {
1624  WCHAR classW[8];
1625 
1627  return FALSE;
1628  if (GetClassLongPtrW(hwnd, GCL_STYLE) & CS_IME) return FALSE;
1629 
1630  return TRUE;
1631 }
1632 
1633 /***********************************************************************
1634  * __wine_register_window (IMM32.@)
1635  */
1637 {
1638  HWND new = NULL;
1640  TRACE("(%p)\n", hwnd);
1641 
1642  if (!needs_ime_window(hwnd))
1643  return FALSE;
1644 
1646  if (!thread_data)
1647  return FALSE;
1648 
1649  if (thread_data->disableIME || disable_ime)
1650  {
1651  TRACE("IME for this thread is disabled\n");
1653  return FALSE;
1654  }
1655  thread_data->windowRefs++;
1656  TRACE("windowRefs=%u, hwndDefault=%p\n",
1657  thread_data->windowRefs, thread_data->hwndDefault);
1658 
1659  /* Create default IME window */
1660  if (thread_data->windowRefs == 1)
1661  {
1662  /* Do not create the window inside of a critical section */
1666  0, 0, 1, 1, 0, 0, 0, 0);
1667  /* thread_data is in the current thread so we can assume it's still valid */
1669  /* See if anyone beat us */
1670  if (thread_data->hwndDefault == NULL)
1671  {
1672  thread_data->hwndDefault = new;
1673  new = NULL;
1674  TRACE("Default is %p\n", thread_data->hwndDefault);
1675  }
1676  }
1677 
1679 
1680  /* Clean up an unused new window outside of the critical section */
1681  if (new != NULL)
1682  DestroyWindow(new);
1683  return TRUE;
1684 }
1685 
1686 /***********************************************************************
1687  * __wine_unregister_window (IMM32.@)
1688  */
1690 {
1691  HWND to_destroy = 0;
1693  TRACE("(%p)\n", hwnd);
1694 
1696  if (!thread_data) return;
1697 
1698  thread_data->windowRefs--;
1699  TRACE("windowRefs=%u, hwndDefault=%p\n",
1700  thread_data->windowRefs, thread_data->hwndDefault);
1701 
1702  /* Destroy default IME window */
1703  if (thread_data->windowRefs == 0 && thread_data->hwndDefault)
1704  {
1705  to_destroy = thread_data->hwndDefault;
1706  thread_data->hwndDefault = NULL;
1707  }
1709 
1710  if (to_destroy) DestroyWindow( to_destroy );
1711 }
1712 
1713 /***********************************************************************
1714  * ImmGetDefaultIMEWnd (IMM32.@)
1715  */
1717 {
1718  HWND ret;
1720  if (!thread_data)
1721  return NULL;
1722  ret = thread_data->hwndDefault;
1724  TRACE("Default is %p\n",ret);
1725  return ret;
1726 }
1727 
1728 /***********************************************************************
1729  * ImmGetDescriptionA (IMM32.@)
1730  */
1732  HKL hKL, LPSTR lpszDescription, UINT uBufLen)
1733 {
1734  WCHAR *buf;
1735  DWORD len;
1736 
1737  TRACE("%p %p %d\n", hKL, lpszDescription, uBufLen);
1738 
1739  /* find out how many characters in the unicode buffer */
1740  len = ImmGetDescriptionW( hKL, NULL, 0 );
1741  if (!len)
1742  return 0;
1743 
1744  /* allocate a buffer of that size */
1745  buf = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof (WCHAR) );
1746  if( !buf )
1747  return 0;
1748 
1749  /* fetch the unicode buffer */
1750  len = ImmGetDescriptionW( hKL, buf, len + 1 );
1751 
1752  /* convert it back to ASCII */
1753  len = WideCharToMultiByte( CP_ACP, 0, buf, len + 1,
1754  lpszDescription, uBufLen, NULL, NULL );
1755 
1756  HeapFree( GetProcessHeap(), 0, buf );
1757 
1758  if (len == 0)
1759  return 0;
1760 
1761  return len - 1;
1762 }
1763 
1764 /***********************************************************************
1765  * ImmGetDescriptionW (IMM32.@)
1766  */
1767 UINT WINAPI ImmGetDescriptionW(HKL hKL, LPWSTR lpszDescription, UINT uBufLen)
1768 {
1769  static const WCHAR name[] = { 'W','i','n','e',' ','X','I','M',0 };
1770 
1771  FIXME("(%p, %p, %d): semi stub\n", hKL, lpszDescription, uBufLen);
1772 
1773  if (!hKL) return 0;
1774  if (!uBufLen) return lstrlenW( name );
1775  lstrcpynW( lpszDescription, name, uBufLen );
1776  return lstrlenW( lpszDescription );
1777 }
1778 
1779 /***********************************************************************
1780  * ImmGetGuideLineA (IMM32.@)
1781  */
1783  HIMC hIMC, DWORD dwIndex, LPSTR lpBuf, DWORD dwBufLen)
1784 {
1785  FIXME("(%p, %d, %s, %d): stub\n",
1786  hIMC, dwIndex, debugstr_a(lpBuf), dwBufLen
1787  );
1789  return 0;
1790 }
1791 
1792 /***********************************************************************
1793  * ImmGetGuideLineW (IMM32.@)
1794  */
1796 {
1797  FIXME("(%p, %d, %s, %d): stub\n",
1798  hIMC, dwIndex, debugstr_w(lpBuf), dwBufLen
1799  );
1801  return 0;
1802 }
1803 
1804 /***********************************************************************
1805  * ImmGetIMEFileNameA (IMM32.@)
1806  */
1807 UINT WINAPI ImmGetIMEFileNameA( HKL hKL, LPSTR lpszFileName, UINT uBufLen)
1808 {
1809  LPWSTR bufW = NULL;
1810  UINT wBufLen = uBufLen;
1811  UINT rc;
1812 
1813  if (uBufLen && lpszFileName)
1814  bufW = HeapAlloc(GetProcessHeap(),0,uBufLen * sizeof(WCHAR));
1815  else /* We need this to get the number of byte required */
1816  {
1817  bufW = HeapAlloc(GetProcessHeap(),0,MAX_PATH * sizeof(WCHAR));
1818  wBufLen = MAX_PATH;
1819  }
1820 
1821  rc = ImmGetIMEFileNameW(hKL,bufW,wBufLen);
1822 
1823  if (rc > 0)
1824  {
1825  if (uBufLen && lpszFileName)
1826  rc = WideCharToMultiByte(CP_ACP, 0, bufW, -1, lpszFileName,
1827  uBufLen, NULL, NULL);
1828  else /* get the length */
1829  rc = WideCharToMultiByte(CP_ACP, 0, bufW, -1, NULL, 0, NULL,
1830  NULL);
1831  }
1832 
1833  HeapFree(GetProcessHeap(),0,bufW);
1834  return rc;
1835 }
1836 
1837 /***********************************************************************
1838  * ImmGetIMEFileNameW (IMM32.@)
1839  */
1840 UINT WINAPI ImmGetIMEFileNameW(HKL hKL, LPWSTR lpszFileName, UINT uBufLen)
1841 {
1842  HKEY hkey;
1843  DWORD length;
1844  DWORD rc;
1845  WCHAR regKey[ARRAY_SIZE(szImeRegFmt)+8];
1846 
1847  wsprintfW( regKey, szImeRegFmt, (ULONG_PTR)hKL );
1848  rc = RegOpenKeyW( HKEY_LOCAL_MACHINE, regKey, &hkey);
1849  if (rc != ERROR_SUCCESS)
1850  {
1851  SetLastError(rc);
1852  return 0;
1853  }
1854 
1855  length = 0;
1857 
1858  if (rc != ERROR_SUCCESS)
1859  {
1860  RegCloseKey(hkey);
1861  SetLastError(rc);
1862  return 0;
1863  }
1864  if (length > uBufLen * sizeof(WCHAR) || !lpszFileName)
1865  {
1866  RegCloseKey(hkey);
1867  if (lpszFileName)
1868  {
1870  return 0;
1871  }
1872  else
1873  return length / sizeof(WCHAR);
1874  }
1875 
1876  RegGetValueW(hkey, NULL, szImeFileW, RRF_RT_REG_SZ, NULL, lpszFileName, &length);
1877 
1878  RegCloseKey(hkey);
1879 
1880  return length / sizeof(WCHAR);
1881 }
1882 
1883 /***********************************************************************
1884  * ImmGetOpenStatus (IMM32.@)
1885  */
1887 {
1889  static int i;
1890 
1891  if (!data)
1892  return FALSE;
1893 
1894  TRACE("(%p): semi-stub\n", hIMC);
1895 
1896  if (!i++)
1897  FIXME("(%p): semi-stub\n", hIMC);
1898 
1899  return data->IMC.fOpen;
1900 }
1901 
1902 /***********************************************************************
1903  * ImmGetProperty (IMM32.@)
1904  */
1906 {
1907  DWORD rc = 0;
1908  ImmHkl *kbd;
1909 
1910  TRACE("(%p, %d)\n", hKL, fdwIndex);
1911  kbd = IMM_GetImmHkl(hKL);
1912 
1913  if (kbd && kbd->hIME)
1914  {
1915  switch (fdwIndex)
1916  {
1917  case IGP_PROPERTY: rc = kbd->imeInfo.fdwProperty; break;
1918  case IGP_CONVERSION: rc = kbd->imeInfo.fdwConversionCaps; break;
1919  case IGP_SENTENCE: rc = kbd->imeInfo.fdwSentenceCaps; break;
1920  case IGP_SETCOMPSTR: rc = kbd->imeInfo.fdwSCSCaps; break;
1921  case IGP_SELECT: rc = kbd->imeInfo.fdwSelectCaps; break;
1922  case IGP_GETIMEVERSION: rc = IMEVER_0400; break;
1923  case IGP_UI: rc = 0; break;
1924  default: rc = 0;
1925  }
1926  }
1927  return rc;
1928 }
1929 
1930 /***********************************************************************
1931  * ImmGetRegisterWordStyleA (IMM32.@)
1932  */
1934  HKL hKL, UINT nItem, LPSTYLEBUFA lpStyleBuf)
1935 {
1936  ImmHkl *immHkl = IMM_GetImmHkl(hKL);
1937  TRACE("(%p, %d, %p):\n", hKL, nItem, lpStyleBuf);
1938  if (immHkl->hIME && immHkl->pImeGetRegisterWordStyle)
1939  {
1940  if (!is_kbd_ime_unicode(immHkl))
1941  return immHkl->pImeGetRegisterWordStyle(nItem,(LPSTYLEBUFW)lpStyleBuf);
1942  else
1943  {
1944  STYLEBUFW sbw;
1945  UINT rc;
1946 
1947  rc = immHkl->pImeGetRegisterWordStyle(nItem,&sbw);
1949  lpStyleBuf->szDescription, 32, NULL, NULL);
1950  lpStyleBuf->dwStyle = sbw.dwStyle;
1951  return rc;
1952  }
1953  }
1954  else
1955  return 0;
1956 }
1957 
1958 /***********************************************************************
1959  * ImmGetRegisterWordStyleW (IMM32.@)
1960  */
1962  HKL hKL, UINT nItem, LPSTYLEBUFW lpStyleBuf)
1963 {
1964  ImmHkl *immHkl = IMM_GetImmHkl(hKL);
1965  TRACE("(%p, %d, %p):\n", hKL, nItem, lpStyleBuf);
1966  if (immHkl->hIME && immHkl->pImeGetRegisterWordStyle)
1967  {
1968  if (is_kbd_ime_unicode(immHkl))
1969  return immHkl->pImeGetRegisterWordStyle(nItem,lpStyleBuf);
1970  else
1971  {
1972  STYLEBUFA sba;
1973  UINT rc;
1974 
1975  rc = immHkl->pImeGetRegisterWordStyle(nItem,(LPSTYLEBUFW)&sba);
1977  lpStyleBuf->szDescription, 32);
1978  lpStyleBuf->dwStyle = sba.dwStyle;
1979  return rc;
1980  }
1981  }
1982  else
1983  return 0;
1984 }
1985 
1986 /***********************************************************************
1987  * ImmGetStatusWindowPos (IMM32.@)
1988  */
1990 {
1992 
1993  TRACE("(%p, %p)\n", hIMC, lpptPos);
1994 
1995  if (!data || !lpptPos)
1996  return FALSE;
1997 
1998  *lpptPos = data->IMC.ptStatusWndPos;
1999 
2000  return TRUE;
2001 }
2002 
2003 /***********************************************************************
2004  * ImmGetVirtualKey (IMM32.@)
2005  */
2007 {
2010  TRACE("%p\n", hWnd);
2011 
2012  if ( data )
2013  return data->lastVK;
2014 
2015  version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
2016  GetVersionExA( &version );
2017  switch(version.dwPlatformId)
2018  {
2020  return VK_PROCESSKEY;
2021  case VER_PLATFORM_WIN32_NT:
2022  return 0;
2023  default:
2024  FIXME("%d not supported\n",version.dwPlatformId);
2025  return VK_PROCESSKEY;
2026  }
2027 }
2028 
2029 /***********************************************************************
2030  * ImmInstallIMEA (IMM32.@)
2031  */
2033  LPCSTR lpszIMEFileName, LPCSTR lpszLayoutText)
2034 {
2035  LPWSTR lpszwIMEFileName;
2036  LPWSTR lpszwLayoutText;
2037  HKL hkl;
2038 
2039  TRACE ("(%s, %s)\n", debugstr_a(lpszIMEFileName),
2040  debugstr_a(lpszLayoutText));
2041 
2042  lpszwIMEFileName = strdupAtoW(lpszIMEFileName);
2043  lpszwLayoutText = strdupAtoW(lpszLayoutText);
2044 
2045  hkl = ImmInstallIMEW(lpszwIMEFileName, lpszwLayoutText);
2046 
2047  HeapFree(GetProcessHeap(),0,lpszwIMEFileName);
2048  HeapFree(GetProcessHeap(),0,lpszwLayoutText);
2049  return hkl;
2050 }
2051 
2052 /***********************************************************************
2053  * ImmInstallIMEW (IMM32.@)
2054  */
2056  LPCWSTR lpszIMEFileName, LPCWSTR lpszLayoutText)
2057 {
2058  INT lcid = GetUserDefaultLCID();
2059  INT count;
2060  HKL hkl;
2061  DWORD rc;
2062  HKEY hkey;
2063  WCHAR regKey[ARRAY_SIZE(szImeRegFmt)+8];
2064 
2065  TRACE ("(%s, %s):\n", debugstr_w(lpszIMEFileName),
2066  debugstr_w(lpszLayoutText));
2067 
2068  /* Start with 2. e001 will be blank and so default to the wine internal IME */
2069  count = 2;
2070 
2071  while (count < 0xfff)
2072  {
2073  DWORD disposition = 0;
2074 
2075  hkl = (HKL)MAKELPARAM( lcid, 0xe000 | count );
2076  wsprintfW( regKey, szImeRegFmt, (ULONG_PTR)hkl);
2077 
2078  rc = RegCreateKeyExW(HKEY_LOCAL_MACHINE, regKey, 0, NULL, 0, KEY_WRITE, NULL, &hkey, &disposition);
2079  if (rc == ERROR_SUCCESS && disposition == REG_CREATED_NEW_KEY)
2080  break;
2081  else if (rc == ERROR_SUCCESS)
2082  RegCloseKey(hkey);
2083 
2084  count++;
2085  }
2086 
2087  if (count == 0xfff)
2088  {
2089  WARN("Unable to find slot to install IME\n");
2090  return 0;
2091  }
2092 
2093  if (rc == ERROR_SUCCESS)
2094  {
2095  rc = RegSetValueExW(hkey, szImeFileW, 0, REG_SZ, (const BYTE*)lpszIMEFileName,
2096  (lstrlenW(lpszIMEFileName) + 1) * sizeof(WCHAR));
2097  if (rc == ERROR_SUCCESS)
2098  rc = RegSetValueExW(hkey, szLayoutTextW, 0, REG_SZ, (const BYTE*)lpszLayoutText,
2099  (lstrlenW(lpszLayoutText) + 1) * sizeof(WCHAR));
2100  RegCloseKey(hkey);
2101  return hkl;
2102  }
2103  else
2104  {
2105  WARN("Unable to set IME registry values\n");
2106  return 0;
2107  }
2108 }
2109 
2110 /***********************************************************************
2111  * ImmIsIME (IMM32.@)
2112  */
2114 {
2115  ImmHkl *ptr;
2116  TRACE("(%p):\n", hKL);
2117  ptr = IMM_GetImmHkl(hKL);
2118  return (ptr && ptr->hIME);
2119 }
2120 
2121 /***********************************************************************
2122  * ImmIsUIMessageA (IMM32.@)
2123  */
2125  HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
2126 {
2127  TRACE("(%p, %x, %ld, %ld)\n", hWndIME, msg, wParam, lParam);
2128  if ((msg >= WM_IME_STARTCOMPOSITION && msg <= WM_IME_KEYLAST) ||
2129  (msg == WM_IME_SETCONTEXT) ||
2130  (msg == WM_IME_NOTIFY) ||
2131  (msg == WM_IME_COMPOSITIONFULL) ||
2132  (msg == WM_IME_SELECT) ||
2133  (msg == 0x287 /* FIXME: WM_IME_SYSTEM */))
2134  {
2135  if (hWndIME)
2136  SendMessageA(hWndIME, msg, wParam, lParam);
2137 
2138  return TRUE;
2139  }
2140  return FALSE;
2141 }
2142 
2143 /***********************************************************************
2144  * ImmIsUIMessageW (IMM32.@)
2145  */
2147  HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
2148 {
2149  TRACE("(%p, %x, %ld, %ld)\n", hWndIME, msg, wParam, lParam);
2150  if ((msg >= WM_IME_STARTCOMPOSITION && msg <= WM_IME_KEYLAST) ||
2151  (msg == WM_IME_SETCONTEXT) ||
2152  (msg == WM_IME_NOTIFY) ||
2153  (msg == WM_IME_COMPOSITIONFULL) ||
2154  (msg == WM_IME_SELECT) ||
2155  (msg == 0x287 /* FIXME: WM_IME_SYSTEM */))
2156  {
2157  if (hWndIME)
2158  SendMessageW(hWndIME, msg, wParam, lParam);
2159 
2160  return TRUE;
2161  }
2162  return FALSE;
2163 }
2164 
2165 /***********************************************************************
2166  * ImmNotifyIME (IMM32.@)
2167  */
2169  HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
2170 {
2172 
2173  TRACE("(%p, %d, %d, %d)\n",
2174  hIMC, dwAction, dwIndex, dwValue);
2175 
2176  if (hIMC == NULL)
2177  {
2179  return FALSE;
2180  }
2181 
2182  if (!data || ! data->immKbd->pNotifyIME)
2183  {
2184  return FALSE;
2185  }
2186 
2187  return data->immKbd->pNotifyIME(hIMC,dwAction,dwIndex,dwValue);
2188 }
2189 
2190 /***********************************************************************
2191  * ImmRegisterWordA (IMM32.@)
2192  */
2194  HKL hKL, LPCSTR lpszReading, DWORD dwStyle, LPCSTR lpszRegister)
2195 {
2196  ImmHkl *immHkl = IMM_GetImmHkl(hKL);
2197  TRACE("(%p, %s, %d, %s):\n", hKL, debugstr_a(lpszReading), dwStyle,
2198  debugstr_a(lpszRegister));
2199  if (immHkl->hIME && immHkl->pImeRegisterWord)
2200  {
2201  if (!is_kbd_ime_unicode(immHkl))
2202  return immHkl->pImeRegisterWord((LPCWSTR)lpszReading,dwStyle,
2203  (LPCWSTR)lpszRegister);
2204  else
2205  {
2206  LPWSTR lpszwReading = strdupAtoW(lpszReading);
2207  LPWSTR lpszwRegister = strdupAtoW(lpszRegister);
2208  BOOL rc;
2209 
2210  rc = immHkl->pImeRegisterWord(lpszwReading,dwStyle,lpszwRegister);
2211  HeapFree(GetProcessHeap(),0,lpszwReading);
2212  HeapFree(GetProcessHeap(),0,lpszwRegister);
2213  return rc;
2214  }
2215  }
2216  else
2217  return FALSE;
2218 }
2219 
2220 /***********************************************************************
2221  * ImmRegisterWordW (IMM32.@)
2222  */
2224  HKL hKL, LPCWSTR lpszReading, DWORD dwStyle, LPCWSTR lpszRegister)
2225 {
2226  ImmHkl *immHkl = IMM_GetImmHkl(hKL);
2227  TRACE("(%p, %s, %d, %s):\n", hKL, debugstr_w(lpszReading), dwStyle,
2228  debugstr_w(lpszRegister));
2229  if (immHkl->hIME && immHkl->pImeRegisterWord)
2230  {
2231  if (is_kbd_ime_unicode(immHkl))
2232  return immHkl->pImeRegisterWord(lpszReading,dwStyle,lpszRegister);
2233  else
2234  {
2235  LPSTR lpszaReading = strdupWtoA(lpszReading);
2236  LPSTR lpszaRegister = strdupWtoA(lpszRegister);
2237  BOOL rc;
2238 
2239  rc = immHkl->pImeRegisterWord((LPCWSTR)lpszaReading,dwStyle,
2240  (LPCWSTR)lpszaRegister);
2241  HeapFree(GetProcessHeap(),0,lpszaReading);
2242  HeapFree(GetProcessHeap(),0,lpszaRegister);
2243  return rc;
2244  }
2245  }
2246  else
2247  return FALSE;
2248 }
2249 
2250 /***********************************************************************
2251  * ImmReleaseContext (IMM32.@)
2252  */
2254 {
2255  static BOOL shown = FALSE;
2256 
2257  if (!shown) {
2258  FIXME("(%p, %p): stub\n", hWnd, hIMC);
2259  shown = TRUE;
2260  }
2261  return TRUE;
2262 }
2263 
2264 /***********************************************************************
2265 * ImmRequestMessageA(IMM32.@)
2266 */
2268 {
2270 
2271  TRACE("%p %ld %ld\n", hIMC, wParam, wParam);
2272 
2273  if (data) return SendMessageA(data->IMC.hWnd, WM_IME_REQUEST, wParam, lParam);
2274 
2276  return 0;
2277 }
2278 
2279 /***********************************************************************
2280 * ImmRequestMessageW(IMM32.@)
2281 */
2283 {
2285 
2286  TRACE("%p %ld %ld\n", hIMC, wParam, wParam);
2287 
2288  if (data) return SendMessageW(data->IMC.hWnd, WM_IME_REQUEST, wParam, lParam);
2289 
2291  return 0;
2292 }
2293 
2294 /***********************************************************************
2295  * ImmSetCandidateWindow (IMM32.@)
2296  */
2298  HIMC hIMC, LPCANDIDATEFORM lpCandidate)
2299 {
2301 
2302  TRACE("(%p, %p)\n", hIMC, lpCandidate);
2303 
2304  if (!data || !lpCandidate)
2305  return FALSE;
2306 
2307  if (IMM_IsCrossThreadAccess(NULL, hIMC))
2308  return FALSE;
2309 
2310  TRACE("\t%x, %x, %s, %s\n",
2311  lpCandidate->dwIndex, lpCandidate->dwStyle,
2312  wine_dbgstr_point(&lpCandidate->ptCurrentPos),
2313  wine_dbgstr_rect(&lpCandidate->rcArea));
2314 
2315  if (lpCandidate->dwIndex >= ARRAY_SIZE(data->IMC.cfCandForm))
2316  return FALSE;
2317 
2318  data->IMC.cfCandForm[lpCandidate->dwIndex] = *lpCandidate;
2321 
2322  return TRUE;
2323 }
2324 
2325 /***********************************************************************
2326  * ImmSetCompositionFontA (IMM32.@)
2327  */
2329 {
2331  TRACE("(%p, %p)\n", hIMC, lplf);
2332 
2333  if (!data || !lplf)
2334  {
2336  return FALSE;
2337  }
2338 
2339  if (IMM_IsCrossThreadAccess(NULL, hIMC))
2340  return FALSE;
2341 
2342  memcpy(&data->IMC.lfFont.W,lplf,sizeof(LOGFONTA));
2343  MultiByteToWideChar(CP_ACP, 0, lplf->lfFaceName, -1, data->IMC.lfFont.W.lfFaceName,
2344  LF_FACESIZE);
2347 
2348  return TRUE;
2349 }
2350 
2351 /***********************************************************************
2352  * ImmSetCompositionFontW (IMM32.@)
2353  */
2355 {
2357  TRACE("(%p, %p)\n", hIMC, lplf);
2358 
2359  if (!data || !lplf)
2360  {
2362  return FALSE;
2363  }
2364 
2365  if (IMM_IsCrossThreadAccess(NULL, hIMC))
2366  return FALSE;
2367 
2368  data->IMC.lfFont.W = *lplf;
2371 
2372  return TRUE;
2373 }
2374 
2375 /***********************************************************************
2376  * ImmSetCompositionStringA (IMM32.@)
2377  */
2379  HIMC hIMC, DWORD dwIndex,
2380  LPCVOID lpComp, DWORD dwCompLen,
2381  LPCVOID lpRead, DWORD dwReadLen)
2382 {
2383  DWORD comp_len;
2384  DWORD read_len;
2385  WCHAR *CompBuffer = NULL;
2386  WCHAR *ReadBuffer = NULL;
2387  BOOL rc;
2389 
2390  TRACE("(%p, %d, %p, %d, %p, %d):\n",
2391  hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen);
2392 
2393  if (!data)
2394  return FALSE;
2395 
2396  if (!(dwIndex == SCS_SETSTR ||
2397  dwIndex == SCS_CHANGEATTR ||
2398  dwIndex == SCS_CHANGECLAUSE ||
2399  dwIndex == SCS_SETRECONVERTSTRING ||
2400  dwIndex == SCS_QUERYRECONVERTSTRING))
2401  return FALSE;
2402 
2403  if (!is_himc_ime_unicode(data))
2404  return data->immKbd->pImeSetCompositionString(hIMC, dwIndex, lpComp,
2405  dwCompLen, lpRead, dwReadLen);
2406 
2407  comp_len = MultiByteToWideChar(CP_ACP, 0, lpComp, dwCompLen, NULL, 0);
2408  if (comp_len)
2409  {
2410  CompBuffer = HeapAlloc(GetProcessHeap(),0,comp_len * sizeof(WCHAR));
2411  MultiByteToWideChar(CP_ACP, 0, lpComp, dwCompLen, CompBuffer, comp_len);
2412  }
2413 
2414  read_len = MultiByteToWideChar(CP_ACP, 0, lpRead, dwReadLen, NULL, 0);
2415  if (read_len)
2416  {
2417  ReadBuffer = HeapAlloc(GetProcessHeap(),0,read_len * sizeof(WCHAR));
2418  MultiByteToWideChar(CP_ACP, 0, lpRead, dwReadLen, ReadBuffer, read_len);
2419  }
2420 
2421  rc = ImmSetCompositionStringW(hIMC, dwIndex, CompBuffer, comp_len,
2422  ReadBuffer, read_len);
2423 
2424  HeapFree(GetProcessHeap(), 0, CompBuffer);
2426 
2427  return rc;
2428 }
2429 
2430 /***********************************************************************
2431  * ImmSetCompositionStringW (IMM32.@)
2432  */
2434  HIMC hIMC, DWORD dwIndex,
2435  LPCVOID lpComp, DWORD dwCompLen,
2436  LPCVOID lpRead, DWORD dwReadLen)
2437 {
2438  DWORD comp_len;
2439  DWORD read_len;
2440  CHAR *CompBuffer = NULL;
2441  CHAR *ReadBuffer = NULL;
2442  BOOL rc;
2444 
2445  TRACE("(%p, %d, %p, %d, %p, %d):\n",
2446  hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen);
2447 
2448  if (!data)
2449  return FALSE;
2450 
2451  if (!(dwIndex == SCS_SETSTR ||
2452  dwIndex == SCS_CHANGEATTR ||
2453  dwIndex == SCS_CHANGECLAUSE ||
2454  dwIndex == SCS_SETRECONVERTSTRING ||
2455  dwIndex == SCS_QUERYRECONVERTSTRING))
2456  return FALSE;
2457 
2459  return data->immKbd->pImeSetCompositionString(hIMC, dwIndex, lpComp,
2460  dwCompLen, lpRead, dwReadLen);
2461 
2462  comp_len = WideCharToMultiByte(CP_ACP, 0, lpComp, dwCompLen, NULL, 0, NULL,
2463  NULL);
2464  if (comp_len)
2465  {
2466  CompBuffer = HeapAlloc(GetProcessHeap(),0,comp_len);
2467  WideCharToMultiByte(CP_ACP, 0, lpComp, dwCompLen, CompBuffer, comp_len,
2468  NULL, NULL);
2469  }
2470 
2471  read_len = WideCharToMultiByte(CP_ACP, 0, lpRead, dwReadLen, NULL, 0, NULL,
2472  NULL);
2473  if (read_len)
2474  {
2475  ReadBuffer = HeapAlloc(GetProcessHeap(),0,read_len);
2476  WideCharToMultiByte(CP_ACP, 0, lpRead, dwReadLen, ReadBuffer, read_len,
2477  NULL, NULL);
2478  }
2479 
2480  rc = ImmSetCompositionStringA(hIMC, dwIndex, CompBuffer, comp_len,
2481  ReadBuffer, read_len);
2482 
2483  HeapFree(GetProcessHeap(), 0, CompBuffer);
2485 
2486  return rc;
2487 }
2488 
2489 /***********************************************************************
2490  * ImmSetCompositionWindow (IMM32.@)
2491  */
2493  HIMC hIMC, LPCOMPOSITIONFORM lpCompForm)
2494 {
2495  BOOL reshow = FALSE;
2497 
2498  TRACE("(%p, %p)\n", hIMC, lpCompForm);
2499  if (lpCompForm)
2500  TRACE("\t%x, %s, %s\n", lpCompForm->dwStyle,
2501  wine_dbgstr_point(&lpCompForm->ptCurrentPos),
2502  wine_dbgstr_rect(&lpCompForm->rcArea));
2503 
2504  if (!data)
2505  {
2507  return FALSE;
2508  }
2509 
2510  if (IMM_IsCrossThreadAccess(NULL, hIMC))
2511  return FALSE;
2512 
2513  data->IMC.cfCompForm = *lpCompForm;
2514 
2515  if (IsWindowVisible(data->immKbd->UIWnd))
2516  {
2517  reshow = TRUE;
2518  ShowWindow(data->immKbd->UIWnd,SW_HIDE);
2519  }
2520 
2521  /* FIXME: this is a partial stub */
2522 
2523  if (reshow)
2524  ShowWindow(data->immKbd->UIWnd,SW_SHOWNOACTIVATE);
2525 
2527  return TRUE;
2528 }
2529 
2530 /***********************************************************************
2531  * ImmSetConversionStatus (IMM32.@)
2532  */
2534  HIMC hIMC, DWORD fdwConversion, DWORD fdwSentence)
2535 {
2536  DWORD oldConversion, oldSentence;
2538 
2539  TRACE("%p %d %d\n", hIMC, fdwConversion, fdwSentence);
2540 
2541  if (!data)
2542  {
2544  return FALSE;
2545  }
2546 
2547  if (IMM_IsCrossThreadAccess(NULL, hIMC))
2548  return FALSE;
2549 
2550  if ( fdwConversion != data->IMC.fdwConversion )
2551  {
2552  oldConversion = data->IMC.fdwConversion;
2553  data->IMC.fdwConversion = fdwConversion;
2554  ImmNotifyIME(hIMC, NI_CONTEXTUPDATED, oldConversion, IMC_SETCONVERSIONMODE);
2556  }
2557  if ( fdwSentence != data->IMC.fdwSentence )
2558  {
2559  oldSentence = data->IMC.fdwSentence;
2560  data->IMC.fdwSentence = fdwSentence;
2561  ImmNotifyIME(hIMC, NI_CONTEXTUPDATED, oldSentence, IMC_SETSENTENCEMODE);
2563  }
2564 
2565  return TRUE;
2566 }
2567 
2568 /***********************************************************************
2569  * ImmSetOpenStatus (IMM32.@)
2570  */
2572 {
2574 
2575  TRACE("%p %d\n", hIMC, fOpen);
2576 
2577  if (!data)
2578  {
2580  return FALSE;
2581  }
2582 
2583  if (IMM_IsCrossThreadAccess(NULL, hIMC))
2584  return FALSE;
2585 
2586  if (data->immKbd->UIWnd == NULL)
2587  {
2588  /* create the ime window */
2589  data->immKbd->UIWnd = CreateWindowExW( WS_EX_TOOLWINDOW,
2590  data->immKbd->imeClassName, NULL, WS_POPUP, 0, 0, 1, 1, 0,
2591  0, data->immKbd->hIME, 0);
2592  SetWindowLongPtrW(data->immKbd->UIWnd, IMMGWL_IMC, (LONG_PTR)data);
2593  }
2594  else if (fOpen)
2595  SetWindowLongPtrW(data->immKbd->UIWnd, IMMGWL_IMC, (LONG_PTR)data);
2596 
2597  if (!fOpen != !data->IMC.fOpen)
2598  {
2599  data->IMC.fOpen = fOpen;
2602  }
2603 
2604  return TRUE;
2605 }
2606 
2607 /***********************************************************************
2608  * ImmSetStatusWindowPos (IMM32.@)
2609  */
2611 {
2613 
2614  TRACE("(%p, %p)\n", hIMC, lpptPos);
2615 
2616  if (!data || !lpptPos)
2617  {
2619  return FALSE;
2620  }
2621 
2622  if (IMM_IsCrossThreadAccess(NULL, hIMC))
2623  return FALSE;
2624 
2625  TRACE("\t%s\n", wine_dbgstr_point(lpptPos));
2626 
2627  data->IMC.ptStatusWndPos = *lpptPos;
2630 
2631  return TRUE;
2632 }
2633 
2634 /***********************************************************************
2635  * ImmCreateSoftKeyboard(IMM32.@)
2636  */
2637 HWND WINAPI ImmCreateSoftKeyboard(UINT uType, UINT hOwner, int x, int y)
2638 {
2639  FIXME("(%d, %d, %d, %d): stub\n", uType, hOwner, x, y);
2641  return 0;
2642 }
2643 
2644 /***********************************************************************
2645  * ImmDestroySoftKeyboard(IMM32.@)
2646  */
2648 {
2649  FIXME("(%p): stub\n", hSoftWnd);
2651  return FALSE;
2652 }
2653 
2654 /***********************************************************************
2655  * ImmShowSoftKeyboard(IMM32.@)
2656  */
2657 BOOL WINAPI ImmShowSoftKeyboard(HWND hSoftWnd, int nCmdShow)
2658 {
2659  FIXME("(%p, %d): stub\n", hSoftWnd, nCmdShow);
2661  return FALSE;
2662 }
2663 
2664 /***********************************************************************
2665  * ImmSimulateHotKey (IMM32.@)
2666  */
2668 {
2669  FIXME("(%p, %d): stub\n", hWnd, dwHotKeyID);
2671  return FALSE;
2672 }
2673 
2674 /***********************************************************************
2675  * ImmUnregisterWordA (IMM32.@)
2676  */
2678  HKL hKL, LPCSTR lpszReading, DWORD dwStyle, LPCSTR lpszUnregister)
2679 {
2680  ImmHkl *immHkl = IMM_GetImmHkl(hKL);
2681  TRACE("(%p, %s, %d, %s):\n", hKL, debugstr_a(lpszReading), dwStyle,
2682  debugstr_a(lpszUnregister));
2683  if (immHkl->hIME && immHkl->pImeUnregisterWord)
2684  {
2685  if (!is_kbd_ime_unicode(immHkl))
2686  return immHkl->pImeUnregisterWord((LPCWSTR)lpszReading,dwStyle,
2687  (LPCWSTR)lpszUnregister);
2688  else
2689  {
2690  LPWSTR lpszwReading = strdupAtoW(lpszReading);
2691  LPWSTR lpszwUnregister = strdupAtoW(lpszUnregister);
2692  BOOL rc;
2693 
2694  rc = immHkl->pImeUnregisterWord(lpszwReading,dwStyle,lpszwUnregister);
2695  HeapFree(GetProcessHeap(),0,lpszwReading);
2696  HeapFree(GetProcessHeap(),0,lpszwUnregister);
2697  return rc;
2698  }
2699  }
2700  else
2701  return FALSE;
2702 }
2703 
2704 /***********************************************************************
2705  * ImmUnregisterWordW (IMM32.@)
2706  */
2708  HKL hKL, LPCWSTR lpszReading, DWORD dwStyle, LPCWSTR lpszUnregister)
2709 {
2710  ImmHkl *immHkl = IMM_GetImmHkl(hKL);
2711  TRACE("(%p, %s, %d, %s):\n", hKL, debugstr_w(lpszReading), dwStyle,
2712  debugstr_w(lpszUnregister));
2713  if (immHkl->hIME && immHkl->pImeUnregisterWord)
2714  {
2715  if (is_kbd_ime_unicode(immHkl))
2716  return immHkl->pImeUnregisterWord(lpszReading,dwStyle,lpszUnregister);
2717  else
2718  {
2719  LPSTR lpszaReading = strdupWtoA(lpszReading);
2720  LPSTR lpszaUnregister = strdupWtoA(lpszUnregister);
2721  BOOL rc;
2722 
2723  rc = immHkl->pImeUnregisterWord((LPCWSTR)lpszaReading,dwStyle,
2724  (LPCWSTR)lpszaUnregister);
2725  HeapFree(GetProcessHeap(),0,lpszaReading);
2726  HeapFree(GetProcessHeap(),0,lpszaUnregister);
2727  return rc;
2728  }
2729  }
2730  else
2731  return FALSE;
2732 }
2733 
2734 /***********************************************************************
2735  * ImmGetImeMenuItemsA (IMM32.@)
2736  */
2738  LPIMEMENUITEMINFOA lpImeParentMenu, LPIMEMENUITEMINFOA lpImeMenu,
2739  DWORD dwSize)
2740 {
2742  TRACE("(%p, %i, %i, %p, %p, %i):\n", hIMC, dwFlags, dwType,
2743  lpImeParentMenu, lpImeMenu, dwSize);
2744 
2745  if (!data)
2746  {
2748  return 0;
2749  }
2750 
2751  if (data->immKbd->hIME && data->immKbd->pImeGetImeMenuItems)
2752  {
2753  if (!is_himc_ime_unicode(data) || (!lpImeParentMenu && !lpImeMenu))
2754  return data->immKbd->pImeGetImeMenuItems(hIMC, dwFlags, dwType,
2755  (IMEMENUITEMINFOW*)lpImeParentMenu,
2756  (IMEMENUITEMINFOW*)lpImeMenu, dwSize);
2757  else
2758  {
2759  IMEMENUITEMINFOW lpImeParentMenuW;
2760  IMEMENUITEMINFOW *lpImeMenuW, *parent = NULL;
2761  DWORD rc;
2762 
2763  if (lpImeParentMenu)
2764  parent = &lpImeParentMenuW;
2765  if (lpImeMenu)
2766  {
2767  int count = dwSize / sizeof(LPIMEMENUITEMINFOA);
2768  dwSize = count * sizeof(IMEMENUITEMINFOW);
2769  lpImeMenuW = HeapAlloc(GetProcessHeap(), 0, dwSize);
2770  }
2771  else
2772  lpImeMenuW = NULL;
2773 
2774  rc = data->immKbd->pImeGetImeMenuItems(hIMC, dwFlags, dwType,
2775  parent, lpImeMenuW, dwSize);
2776 
2777  if (lpImeParentMenu)
2778  {
2779  memcpy(lpImeParentMenu,&lpImeParentMenuW,sizeof(IMEMENUITEMINFOA));
2780  lpImeParentMenu->hbmpItem = lpImeParentMenuW.hbmpItem;
2781  WideCharToMultiByte(CP_ACP, 0, lpImeParentMenuW.szString,
2782  -1, lpImeParentMenu->szString, IMEMENUITEM_STRING_SIZE,
2783  NULL, NULL);
2784  }
2785  if (lpImeMenu && rc)
2786  {
2787  unsigned int i;
2788  for (i = 0; i < rc; i++)
2789  {
2790  memcpy(&lpImeMenu[i],&lpImeMenuW[1],sizeof(IMEMENUITEMINFOA));
2791  lpImeMenu[i].hbmpItem = lpImeMenuW[i].hbmpItem;
2792  WideCharToMultiByte(CP_ACP, 0, lpImeMenuW[i].szString,
2793  -1, lpImeMenu[i].szString, IMEMENUITEM_STRING_SIZE,
2794  NULL, NULL);
2795  }
2796  }
2797  HeapFree(GetProcessHeap(),0,lpImeMenuW);
2798  return rc;
2799  }
2800  }
2801  else
2802  return 0;
2803 }
2804 
2805 /***********************************************************************
2806 * ImmGetImeMenuItemsW (IMM32.@)
2807 */
2809  LPIMEMENUITEMINFOW lpImeParentMenu, LPIMEMENUITEMINFOW lpImeMenu,
2810  DWORD dwSize)
2811 {
2813  TRACE("(%p, %i, %i, %p, %p, %i):\n", hIMC, dwFlags, dwType,
2814  lpImeParentMenu, lpImeMenu, dwSize);
2815 
2816  if (!data)
2817  {
2819  return 0;
2820  }
2821 
2822  if (data->immKbd->hIME && data->immKbd->pImeGetImeMenuItems)
2823  {
2824  if (is_himc_ime_unicode(data) || (!lpImeParentMenu && !lpImeMenu))
2825  return data->immKbd->pImeGetImeMenuItems(hIMC, dwFlags, dwType,
2826  lpImeParentMenu, lpImeMenu, dwSize);
2827  else
2828  {
2829  IMEMENUITEMINFOA lpImeParentMenuA;
2830  IMEMENUITEMINFOA *lpImeMenuA, *parent = NULL;
2831  DWORD rc;
2832 
2833  if (lpImeParentMenu)
2834  parent = &lpImeParentMenuA;
2835  if (lpImeMenu)
2836  {
2837  int count = dwSize / sizeof(LPIMEMENUITEMINFOW);
2838  dwSize = count * sizeof(IMEMENUITEMINFOA);
2839  lpImeMenuA = HeapAlloc(GetProcessHeap(), 0, dwSize);
2840  }
2841  else
2842  lpImeMenuA = NULL;
2843 
2844  rc = data->immKbd->pImeGetImeMenuItems(hIMC, dwFlags, dwType,
2846  (IMEMENUITEMINFOW*)lpImeMenuA, dwSize);
2847 
2848  if (lpImeParentMenu)
2849  {
2850  memcpy(lpImeParentMenu,&lpImeParentMenuA,sizeof(IMEMENUITEMINFOA));
2851  lpImeParentMenu->hbmpItem = lpImeParentMenuA.hbmpItem;
2852  MultiByteToWideChar(CP_ACP, 0, lpImeParentMenuA.szString,
2853  -1, lpImeParentMenu->szString, IMEMENUITEM_STRING_SIZE);
2854  }
2855  if (lpImeMenu && rc)
2856  {
2857  unsigned int i;
2858  for (i = 0; i < rc; i++)
2859  {
2860  memcpy(&lpImeMenu[i],&lpImeMenuA[1],sizeof(IMEMENUITEMINFOA));
2861  lpImeMenu[i].hbmpItem = lpImeMenuA[i].hbmpItem;
2862  MultiByteToWideChar(CP_ACP, 0, lpImeMenuA[i].szString,
2863  -1, lpImeMenu[i].szString, IMEMENUITEM_STRING_SIZE);
2864  }
2865  }
2866  HeapFree(GetProcessHeap(),0,lpImeMenuA);
2867  return rc;
2868  }
2869  }
2870  else
2871  return 0;
2872 }
2873 
2874 /***********************************************************************
2875 * ImmLockIMC(IMM32.@)
2876 */
2878 {
2880 
2881  if (!data)
2882  return NULL;
2883  data->dwLock++;
2884  return &data->IMC;
2885 }
2886 
2887 /***********************************************************************
2888 * ImmUnlockIMC(IMM32.@)
2889 */
2891 {
2893 
2894  if (!data)
2895  return FALSE;
2896  if (data->dwLock)
2897  data->dwLock--;
2898  return TRUE;
2899 }
2900 
2901 /***********************************************************************
2902 * ImmGetIMCLockCount(IMM32.@)
2903 */
2905 {
2907  if (!data)
2908  return 0;
2909  return data->dwLock;
2910 }
2911 
2912 /***********************************************************************
2913 * ImmCreateIMCC(IMM32.@)
2914 */
2916 {
2918 }
2919 
2920 /***********************************************************************
2921 * ImmDestroyIMCC(IMM32.@)
2922 */
2924 {
2925  return GlobalFree(block);
2926 }
2927 
2928 /***********************************************************************
2929 * ImmLockIMCC(IMM32.@)
2930 */
2932 {
2933  return GlobalLock(imcc);
2934 }
2935 
2936 /***********************************************************************
2937 * ImmUnlockIMCC(IMM32.@)
2938 */
2940 {
2941  return GlobalUnlock(imcc);
2942 }
2943 
2944 /***********************************************************************
2945 * ImmGetIMCCLockCount(IMM32.@)
2946 */
2948 {
2949  return GlobalFlags(imcc) & GMEM_LOCKCOUNT;
2950 }
2951 
2952 /***********************************************************************
2953 * ImmReSizeIMCC(IMM32.@)
2954 */
2956 {
2957  return GlobalReAlloc(imcc, size, GMEM_ZEROINIT | GMEM_MOVEABLE);
2958 }
2959 
2960 /***********************************************************************
2961 * ImmGetIMCCSize(IMM32.@)
2962 */
2964 {
2965  return GlobalSize(imcc);
2966 }
2967 
2968 /***********************************************************************
2969 * ImmGenerateMessage(IMM32.@)
2970 */
2972 {
2974 
2975  if (!data)
2976  {
2978  return FALSE;
2979  }
2980 
2981  TRACE("%i messages queued\n",data->IMC.dwNumMsgBuf);
2982  if (data->IMC.dwNumMsgBuf > 0)
2983  {
2984  LPTRANSMSG lpTransMsg;
2985  HIMCC hMsgBuf;
2986  DWORD i, dwNumMsgBuf;
2987 
2988  /* We are going to detach our hMsgBuff so that if processing messages
2989  generates new messages they go into a new buffer */
2990  hMsgBuf = data->IMC.hMsgBuf;
2991  dwNumMsgBuf = data->IMC.dwNumMsgBuf;
2992 
2993  data->IMC.hMsgBuf = ImmCreateIMCC(0);
2994  data->IMC.dwNumMsgBuf = 0;
2995 
2996  lpTransMsg = ImmLockIMCC(hMsgBuf);
2997  for (i = 0; i < dwNumMsgBuf; i++)
2998  ImmInternalSendIMEMessage(data, lpTransMsg[i].message, lpTransMsg[i].wParam, lpTransMsg[i].lParam);
2999 
3000  ImmUnlockIMCC(hMsgBuf);
3001  ImmDestroyIMCC(hMsgBuf);
3002  }
3003 
3004  return TRUE;
3005 }
3006 
3007 /***********************************************************************
3008 * ImmTranslateMessage(IMM32.@)
3009 * ( Undocumented, call internally and from user32.dll )
3010 */
3012 {
3014  HIMC imc = ImmGetContext(hwnd);
3015  BYTE state[256];
3016  UINT scancode;
3017  LPVOID list = 0;
3018  UINT msg_count;
3019  UINT uVirtKey;
3020  static const DWORD list_count = 10;
3021 
3022  TRACE("%p %x %x %x\n",hwnd, msg, (UINT)wParam, (UINT)lKeyData);
3023 
3024  if (imc)
3025  data = imc;
3026  else
3027  return FALSE;
3028 
3029  if (!data->immKbd->hIME || !data->immKbd->pImeToAsciiEx)
3030  return FALSE;
3031 
3033  scancode = lKeyData >> 0x10 & 0xff;
3034 
3036  ((DWORD*)list)[0] = list_count;
3037 
3038  if (data->immKbd->imeInfo.fdwProperty & IME_PROP_KBD_CHAR_FIRST)
3039  {
3040  WCHAR chr;
3041 
3042  if (!is_himc_ime_unicode(data))
3043  ToAscii(data->lastVK, scancode, state, &chr, 0);
3044  else
3045  ToUnicodeEx(data->lastVK, scancode, state, &chr, 1, 0, GetKeyboardLayout(0));
3046  uVirtKey = MAKELONG(data->lastVK,chr);
3047  }
3048  else
3049  uVirtKey = data->lastVK;
3050 
3051  msg_count = data->immKbd->pImeToAsciiEx(uVirtKey, scancode, state, list, 0, imc);
3052  TRACE("%i messages generated\n",msg_count);
3053  if (msg_count && msg_count <= list_count)
3054  {
3055  UINT i;
3056  LPTRANSMSG msgs = (LPTRANSMSG)((LPBYTE)list + sizeof(DWORD));
3057 
3058  for (i = 0; i < msg_count; i++)
3059  ImmInternalPostIMEMessage(data, msgs[i].message, msgs[i].wParam, msgs[i].lParam);
3060  }
3061  else if (msg_count > list_count)
3062  ImmGenerateMessage(imc);
3063 
3065 
3066  data->lastVK = VK_PROCESSKEY;
3067 
3068  return (msg_count > 0);
3069 }
3070 
3071 /***********************************************************************
3072 * ImmProcessKey(IMM32.@)
3073 * ( Undocumented, called from user32.dll )
3074 */
3076 {
3078  HIMC imc = ImmGetContext(hwnd);
3079  BYTE state[256];
3080 
3081  TRACE("%p %p %x %x %x\n",hwnd, hKL, vKey, (UINT)lKeyData, unknown);
3082 
3083  if (imc)
3084  data = imc;
3085  else
3086  return FALSE;
3087 
3088  /* Make sure we are inputting to the correct keyboard */
3089  if (data->immKbd->hkl != hKL)
3090  {
3091  ImmHkl *new_hkl = IMM_GetImmHkl(hKL);
3092  if (new_hkl)
3093  {
3094  data->immKbd->pImeSelect(imc, FALSE);
3095  data->immKbd->uSelected--;
3096  data->immKbd = new_hkl;
3097  data->immKbd->pImeSelect(imc, TRUE);
3098  data->immKbd->uSelected++;
3099  }
3100  else
3101  return FALSE;
3102  }
3103 
3104  if (!data->immKbd->hIME || !data->immKbd->pImeProcessKey)
3105  return FALSE;
3106 
3108  if (data->immKbd->pImeProcessKey(imc, vKey, lKeyData, state))
3109  {
3110  data->lastVK = vKey;
3111  return TRUE;
3112  }
3113 
3114  data->lastVK = VK_PROCESSKEY;
3115  return FALSE;
3116 }
3117 
3118 /***********************************************************************
3119 * ImmDisableTextFrameService(IMM32.@)
3120 */
3122 {
3123  FIXME("Stub\n");
3124  return FALSE;
3125 }
3126 
3127 /***********************************************************************
3128  * ImmEnumInputContext(IMM32.@)
3129  */
3130 
3132 {
3133  FIXME("Stub\n");
3134  return FALSE;
3135 }
3136 
3137 /***********************************************************************
3138  * ImmGetHotKey(IMM32.@)
3139  */
3140 
3141 BOOL WINAPI ImmGetHotKey(DWORD hotkey, UINT *modifiers, UINT *key, HKL hkl)
3142 {
3143  FIXME("%x, %p, %p, %p: stub\n", hotkey, modifiers, key, hkl);
3144  return FALSE;
3145 }
3146 
3147 /***********************************************************************
3148  * ImmDisableLegacyIME(IMM32.@)
3149  */
3151 {
3152  FIXME("stub\n");
3153  return TRUE;
3154 }
BOOL WINAPI ImmGetHotKey(DWORD hotkey, UINT *modifiers, UINT *key, HKL hkl)
Definition: imm.c:3141
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1975
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
DWORD WINAPI ImmGetCandidateListCountW(HIMC hIMC, LPDWORD lpdwListCount)
Definition: imm.c:1073
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
static unsigned int block
Definition: xmlmemory.c:118
DWORD WINAPI ImmGetCandidateListCountA(HIMC hIMC, LPDWORD lpdwListCount)
Definition: imm.c:1041
DWORD HIMCC
Definition: dimm.idl:76
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
static WCHAR * strdupAtoW(const char *str)
Definition: imm.c:128
static CHAR * strdupWtoA(const WCHAR *str)
Definition: imm.c:140
BOOL WINAPI EnumChildWindows(_In_opt_ HWND, _In_ WNDENUMPROC, _In_ LPARAM)
#define IACE_DEFAULT
Definition: imm.h:576
#define is_himc_ime_unicode(p)
Definition: imm.c:122
static const WCHAR classW[]
Definition: lex.c:38
#define IME_PROP_KBD_CHAR_FIRST
Definition: imm.h:211
#define LOAD_FUNCPTR(f)
Definition: imm.c:325
struct _tagTRANSMSG * LPTRANSMSG
#define WS_DISABLED
Definition: pedump.c:621
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static INT CopyCompClauseIMEtoClient(InputContextData *data, LPBYTE source, INT slen, LPBYTE ssource, LPBYTE target, INT tlen, BOOL unicode)
Definition: imm.c:1292
#define GCS_RESULTREADSTR
Definition: imm.h:364
#define WM_IME_NOTIFY
Definition: winuser.h:1806
BOOL WINAPI ImeConfigure(HKL, HWND, DWORD, LPVOID)
#define VER_PLATFORM_WIN32_NT
Definition: rtltypes.h:236
Definition: tftpd.h:59
BOOL WINAPI ImmUnregisterWordW(HKL hKL, LPCWSTR lpszReading, DWORD dwStyle, LPCWSTR lpszUnregister)
Definition: imm.c:2707
#define IMN_SETCONVERSIONMODE
Definition: imm.h:519
DWORD dwStyle
Definition: imm.h:82
#define IACE_IGNORENOCONTEXT
Definition: imm.h:577
#define TRUE
Definition: types.h:120
BOOL disableIME
Definition: imm.c:96
static IMMThreadData * IMM_GetThreadData(HWND hwnd, DWORD thread)
Definition: imm.c:230
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
BOOL WINAPI ImmConfigureIMEW(HKL hKL, HWND hWnd, DWORD dwMode, LPVOID lpData)
Definition: imm.c:705
DWORD dwStyle
Definition: dimm.idl:109
#define CloseHandle
Definition: compat.h:398
#define VK_PROCESSKEY
Definition: winuser.h:2281
struct tagCOMPOSITIONSTRING * LPCOMPOSITIONSTRING
DWORD
Definition: imm.c:60
#define NI_CONTEXTUPDATED
Definition: imm.h:222
#define LF_FACESIZE
Definition: dimm.idl:39
DWORD dwCompAttrLen
Definition: imm.h:168
HMODULE hIME
Definition: imm.c:46
LPARAM
Definition: imm.c:66
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define SW_SHOWNOACTIVATE
Definition: winuser.h:768
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI ImmDisableLegacyIME(void)
Definition: imm.c:3150
const WCHAR const WCHAR const WCHAR DWORD
Definition: imm.c:63
#define CS_IME
Definition: winuser.h:654
static HIMC get_default_context(HWND hwnd)
Definition: imm.c:503
#define IMC_SETSENTENCEMODE
Definition: imm.h:218
#define SCS_SETSTR
Definition: imm.h:447
#define DWORD_PTR
Definition: treelist.c:76
#define WideCharToMultiByte
Definition: compat.h:101
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
HGLOBAL NTAPI GlobalReAlloc(HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags)
Definition: heapmem.c:825
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define is_kbd_ime_unicode(p)
Definition: imm.c:123
DWORD threadID
Definition: imm.c:75
DWORD dwCompReadClauseOffset
Definition: imm.h:165
LRESULT(WINAPI *pImeEscape)(HIMC
POINT ptCurrentPos
Definition: imm.h:59
BOOL WINAPI ImeProcessKey(HIMC, UINT, LPARAM, CONST LPBYTE)
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
LPARAM lParam
Definition: imm.c:88
DWORD dwCompStrLen
Definition: imm.h:172
#define IMN_SETOPENSTATUS
Definition: imm.h:521
GLsizei const GLchar ** path
Definition: glext.h:7234
#define DLL_THREAD_ATTACH
Definition: compat.h:121
DWORD WINAPI ImmGetImeMenuItemsW(HIMC hIMC, DWORD dwFlags, DWORD dwType, LPIMEMENUITEMINFOW lpImeParentMenu, LPIMEMENUITEMINFOW lpImeMenu, DWORD dwSize)
Definition: imm.c:2808
#define SW_HIDE
Definition: winuser.h:762
UINT WINAPI ImeToAsciiEx(UINT, UINT, CONST LPBYTE, LPDWORD, UINT, HIMC)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SCS_CHANGEATTR
Definition: imm.h:448
int(CALLBACK * REGISTERWORDENUMPROCW)(_In_ LPCWSTR, _In_ DWORD, _In_ LPCWSTR, _In_ LPVOID)
Definition: imm.h:49
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:2877
#define CP_ACP
Definition: compat.h:99
GLuint GLuint GLsizei count
Definition: gl.h:1545
HKL WINAPI ImmInstallIMEW(LPCWSTR lpszIMEFileName, LPCWSTR lpszLayoutText)
Definition: imm.c:2055
UINT NTAPI GlobalFlags(HGLOBAL hMem)
Definition: heapmem.c:520
DWORD dwCompReadClauseLen
Definition: imm.h:164
char CHAR
Definition: xmlstorage.h:175
#define IGP_PROPERTY
Definition: imm.h:438
struct list entry
Definition: imm.c:44
DWORD dwCompAttrOffset
Definition: imm.h:169
uint8_t entry
Definition: isohybrid.c:63
CANDIDATEFORM cfCandForm[4]
Definition: imm.h:39
static void ImmInternalPostIMEMessage(InputContextData *data, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: imm.c:444
#define WARN(fmt,...)
Definition: debug.h:111
int notify
Definition: msacm.c:1353
#define MAKELPARAM(l, h)
Definition: winuser.h:3915
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
DWORD dwCount
Definition: imm.h:200
#define IME_ESC_GETHELPFILENAME
Definition: imm.h:565
HKL hkl
Definition: imm.c:45
DWORD WINAPI ImeGetImeMenuItems(HIMC, DWORD, DWORD, LPIMEMENUITEMINFOW, LPIMEMENUITEMINFOW, DWORD)
DWORD dwStyle
Definition: imm.h:58
#define ReadBuffer(BaseIoAddress, Buffer, Count)
Definition: atapi.h:339
LRESULT WINAPI ImeEscape(HIMC, UINT, LPVOID)
GLintptr offset
Definition: glext.h:5920
#define CALLBACK
Definition: compat.h:27
DWORD WINAPI ImmGetCandidateListW(HIMC hIMC, DWORD dwIndex, LPCANDIDATELIST lpCandList, DWORD dwBufLen)
Definition: imm.c:1105
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
HWND hWnd
Definition: settings.c:17
static BOOL CALLBACK _ImmAssociateContextExEnumProc(HWND hwnd, LPARAM lParam)
Definition: imm.c:625
#define WM_IME_SELECT
Definition: winuser.h:1809
#define GCS_RESULTREADCLAUSE
Definition: imm.h:365
DWORD dwResultReadStrOffset
Definition: imm.h:179
HIMCC WINAPI ImmDestroyIMCC(HIMCC block)
Definition: imm.c:2923
BOOL WINAPI ImmAssociateContextEx(HWND hWnd, HIMC hIMC, DWORD dwFlags)
Definition: imm.c:635
void BOOL
Definition: imm.c:57
static HANDLE process
Definition: process.c:76
DWORD threadID
Definition: imm.c:93
LRESULT WINAPI ImmRequestMessageW(HIMC hIMC, WPARAM wParam, LPARAM lParam)
Definition: imm.c:2282
#define RRF_RT_REG_SZ
Definition: driver.c:575
#define IMMGWL_IMC
Definition: imm.h:206
#define IMN_SETCOMPOSITIONFONT
Definition: imm.h:523
const BYTE STYLEBUFW IMEMENUITEMINFOW IMEMENUITEMINFOW DWORD
Definition: imm.c:68
#define HandleToULong(h)
Definition: basetsd.h:95
POINT ptCurrentPos
Definition: imm.h:146
DWORD WINAPI ImmGetIMCCSize(HIMCC imcc)
Definition: imm.c:2963
GLuint buffer
Definition: glext.h:5915
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
UINT WINAPI ImmEnumRegisterWordA(HKL hKL, REGISTERWORDENUMPROCA lpfnEnumProc, LPCSTR lpszReading, DWORD dwStyle, LPCSTR lpszRegister, LPVOID lpData)
Definition: imm.c:853
#define IMN_SETCOMPOSITIONWINDOW
Definition: imm.h:524
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
INPUTCONTEXT IMC
Definition: imm.c:74
BOOL WINAPI ImmDisableTextFrameService(DWORD idThread)
Definition: imm.c:3121
UINT_PTR WPARAM
Definition: windef.h:207
GLuint GLuint end
Definition: gl.h:1545
LCID WINAPI GetUserDefaultLCID(void)
Definition: lang.c:765
DWORD fdwConversion
Definition: imm.h:32
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HIMCC hPrivate
Definition: imm.h:43
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
DWORD dwSize
Definition: imm.h:199
BOOL WINAPI ImmGetStatusWindowPos(HIMC hIMC, LPPOINT lpptPos)
Definition: imm.c:1989
char * LPSTR
Definition: xmlstorage.h:182
const char * filename
Definition: ioapi.h:135
UINT WINAPI ImmEnumRegisterWordW(HKL hKL, REGISTERWORDENUMPROCW lpfnEnumProc, LPCWSTR lpszReading, DWORD dwStyle, LPCWSTR lpszRegister, LPVOID lpData)
Definition: imm.c:888
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_ DWORD _In_ DWORD dwBufLen
Definition: wincrypt.h:4245
UINT message
Definition: imm.c:86
int(CALLBACK * REGISTERWORDENUMPROCA)(_In_ LPCSTR, _In_ DWORD, _In_ LPCSTR, _In_ LPVOID)
Definition: imm.h:42
#define lstrlenW
Definition: compat.h:407
const WCHAR CANDIDATELIST UINT
Definition: imm.c:65
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define DWORD
Definition: nt_native.h:44
#define WM_IME_COMPOSITIONFULL
Definition: winuser.h:1808
int32_t INT
Definition: typedefs.h:56
HWND UIWnd
Definition: imm.c:50
#define GCS_CURSORPOS
Definition: imm.h:362
WPARAM wParam
Definition: combotst.c:138
#define IMN_SETSENTENCEMODE
Definition: imm.h:520
#define DLL_THREAD_DETACH
Definition: compat.h:122
#define WINE_IMC_VALID_MAGIC
Definition: imm.c:83
HANDLE WINAPI RemovePropW(_In_ HWND, _In_ LPCWSTR)
CHAR lfFaceName[LF_FACESIZE]
Definition: wingdi.h:1872
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1094
DWORD dwCursorPos
Definition: imm.h:174
#define SCS_SETRECONVERTSTRING
Definition: imm.h:450
#define lstrcpynW
Definition: compat.h:397
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
LONG WINAPI ImmGetCompositionStringA(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
Definition: imm.c:1459
static BOOL disable_ime
Definition: imm.c:120
BOOL WINAPI __wine_register_window(HWND hwnd)
Definition: imm.c:1636
DWORD dwCompReadStrLen
Definition: imm.h:166
BOOL WINAPI ImmSetStatusWindowPos(HIMC hIMC, LPPOINT lpptPos)
Definition: imm.c:2610
BOOL WINAPI ImmDestroyContext(HIMC hIMC)
Definition: imm.c:826
_In_ DWORD _In_ DWORD dwOffset
Definition: ntgdi.h:2032
WCHAR szString[IMEMENUITEM_STRING_SIZE]
Definition: imm.h:126
uint32_t ULONG_PTR
Definition: typedefs.h:63
int WINAPI GetClassNameW(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, _In_ int nMaxCount)
BOOL WINAPI ImmIsIME(HKL hKL)
Definition: imm.c:2113
static INT CopyCompOffsetIMEtoClient(InputContextData *data, DWORD offset, LPBYTE ssource, BOOL unicode)
Definition: imm.c:1347
DWORD magic
Definition: imm.c:80
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
BOOL WINAPI ImmSetCompositionWindow(HIMC hIMC, LPCOMPOSITIONFORM lpCompForm)
Definition: imm.c:2492
#define GCL_STYLE
Definition: winuser.h:665
BOOL WINAPI ImeUnregisterWord(LPCWSTR, DWORD, LPCWSTR)
BOOL WINAPI ImmGetConversionStatus(HIMC hIMC, LPDWORD lpfdwConversion, LPDWORD lpfdwSentence)
Definition: imm.c:1604
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpReserved)
Definition: imm.c:418
BOOL WINAPI ImeRegisterWord(LPCWSTR, DWORD, LPCWSTR)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HWND WINAPI ImmGetDefaultIMEWnd(HWND hWnd)
Definition: imm.c:1716
static HIMCC ImmCreateBlankCompStr(void)
Definition: imm.c:476
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
LRESULT WINAPI ImmEscapeW(HKL hKL, HIMC hIMC, UINT uEscape, LPVOID lpData)
Definition: imm.c:967
#define IGP_SELECT
Definition: imm.h:443
LPVOID WINAPI ImmLockIMCC(HIMCC imcc)
Definition: imm.c:2931
LPWSTR lpReading
Definition: dimm.idl:35
static BOOL needs_ime_window(HWND hwnd)
Definition: imm.c:1622
#define IMN_SETCANDIDATEPOS
Definition: imm.h:522
HIMCC hCandInfo
Definition: imm.h:41
DWORD WINAPI ImmGetIMCLockCount(HIMC hIMC)
Definition: imm.c:2904
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD dwSize
Definition: imm.h:65
__WINE_SERVER_LIST_INLINE unsigned int list_count(const struct list *list)
Definition: list.h:155
long LONG
Definition: pedump.c:60
LPSTR lpWord
Definition: dimm.idl:31
UINT
Definition: imm.c:56
DWORD windowRefs
Definition: imm.c:97
LPSTR lpReading
Definition: dimm.idl:30
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3311
UINT WINAPI ImmGetDescriptionA(HKL hKL, LPSTR lpszDescription, UINT uBufLen)
Definition: imm.c:1731
#define debugstr_w
Definition: kernel32.h:32
DWORD WINAPI ImmGetConversionListA(HKL hKL, HIMC hIMC, LPCSTR pSrc, LPCANDIDATELIST lpDst, DWORD dwBufLen, UINT uFlag)
Definition: imm.c:1528
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
DWORD dwOffset[1]
Definition: imm.h:71
static InputContextData * get_imc_data(HIMC hIMC)
Definition: imm.c:488
DWORD WINAPI GetWindowThreadProcessId(HWND, PDWORD)
const WCHAR * str
HKL WINAPI ImmInstallIMEA(LPCSTR lpszIMEFileName, LPCSTR lpszLayoutText)
Definition: imm.c:2032
#define MAKELONG(a, b)
Definition: typedefs.h:248
BOOL WINAPI ImmEnumInputContext(DWORD idThread, IMCENUMPROC lpfn, LPARAM lParam)
Definition: imm.c:3131
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI User32InitializeImmEntryTable(DWORD)
Definition: imm.c:189
static const WCHAR version[]
Definition: asmname.c:64
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622
unsigned char
Definition: typeof.h:29
BOOL WINAPI ImeSetActiveContext(HIMC, BOOL)
WCHAR szDescription[STYLE_DESCRIPTION_SIZE]
Definition: dimm.idl:110
#define GCS_RESULTSTR
Definition: imm.h:366
BOOL WINAPI IsDBCSLeadByte(BYTE TestByte)
Definition: nls.c:2130
LONG_PTR LPARAM
Definition: windef.h:208
struct list entry
Definition: imm.c:92
const WCHAR const WCHAR const WCHAR const WCHAR void const void const void DWORD
Definition: imm.c:64
struct tagIMEMENUITEMINFOA IMEMENUITEMINFOA
#define REG_CREATED_NEW_KEY
Definition: nt_native.h:1084
static DWORD convert_candidatelist_AtoW(LPCANDIDATELIST lpSrc, LPCANDIDATELIST lpDst, DWORD dwBufLen)
Definition: imm.c:191
const char * LPCSTR
Definition: xmlstorage.h:183
WCHAR imeClassName[17]
Definition: imm.c:48
#define WM_IME_REQUEST
Definition: winuser.h:1812
DWORD HIMC
Definition: dimm.idl:75
WCHAR const WCHAR HWND
Definition: imm.c:54
static void ImmInternalSendIMEMessage(InputContextData *data, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: imm.c:454
HIMC WINAPI ImmCreateContext(void)
Definition: imm.c:740
BOOL WINAPI GetVersionExA(IN LPOSVERSIONINFOA lpVersionInformation)
Definition: version.c:69
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:421
#define GCS_COMPREADSTR
Definition: imm.h:356
struct _tagTRANSMSG TRANSMSG
BOOL WINAPI ImmGetOpenStatus(HIMC hIMC)
Definition: imm.c:1886
#define DLL_PROCESS_DETACH
Definition: compat.h:119
UINT WINAPI ImmGetIMEFileNameA(HKL hKL, LPSTR lpszFileName, UINT uBufLen)
Definition: imm.c:1807
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
LRESULT WINAPI ImmRequestMessageA(HIMC hIMC, WPARAM wParam, LPARAM lParam)
Definition: imm.c:2267
DWORD fdwSelectCaps
Definition: imm.h:157
HWND hwndDefault
Definition: imm.c:95
DWORD dwCount
Definition: imm.h:67
#define KEY_WRITE
Definition: nt_native.h:1031
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4917
DWORD dwResultClauseLen
Definition: imm.h:180
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
UINT WINAPI GlobalGetAtomNameW(ATOM nAtom, LPWSTR lpBuffer, int nSize)
Definition: atom.c:496
DWORD dwResultStrLen
Definition: imm.h:182
static BOOL EscapeRequiresWA(UINT uEscape)
Definition: imm.c:919
const char * wine_dbgstr_point(const POINT *guid)
BOOL WINAPI ImmUnregisterWordA(HKL hKL, LPCSTR lpszReading, DWORD dwStyle, LPCSTR lpszUnregister)
Definition: imm.c:2677
ULONG uSelected
Definition: imm.c:49
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:405
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
static BOOL IMM_IsDefaultContext(HIMC imc)
Definition: imm.c:262
HBITMAP hbmpItem
Definition: dimm.idl:138
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
UINT WINAPI ImeEnumRegisterWord(REGISTERWORDENUMPROCW, LPCWSTR, DWORD, LPCWSTR, LPVOID)
#define IGP_SETCOMPSTR
Definition: imm.h:442
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD dwDeltaStart
Definition: imm.h:175
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
r parent
Definition: btrfs.c:2659
struct _tagImmHkl ImmHkl
WCHAR szDescription[32]
Definition: imm.h:83
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define LIST_INIT(head)
Definition: queue.h:197
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct _tagIMMThreadData IMMThreadData
#define debugstr_a
Definition: kernel32.h:31
static const WCHAR displayW[]
Definition: icm.c:30
DWORD dwResultReadClauseOffset
Definition: imm.h:177
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
DWORD fdwProperty
Definition: imm.h:152
LONG WINAPI ImmGetCompositionStringW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
Definition: imm.c:1469
#define WM_IME_SETCONTEXT
Definition: winuser.h:1805
HIMC WINAPI ImmGetContext(HWND hWnd)
Definition: imm.c:1496
#define IMM_INIT_MAGIC
Definition: imm.c:40
DWORD WINAPI ImmGetGuideLineW(HIMC hIMC, DWORD dwIndex, LPWSTR lpBuf, DWORD dwBufLen)
Definition: imm.c:1795
struct tagCANDIDATELIST * LPCANDIDATELIST
static void IMM_FreeThreadData(void)
Definition: imm.c:272
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:8
const char * wine_dbgstr_rect(const RECT *rect)
static void IMM_FreeAllImmHkl(void)
Definition: imm.c:400
unsigned long DWORD
Definition: ntddk_ex.h:95
struct tagInputContextData InputContextData
IMEINFO imeInfo
Definition: imm.c:47
BOOL WINAPI ImmSetCompositionStringW(HIMC hIMC, DWORD dwIndex, LPCVOID lpComp, DWORD dwCompLen, LPCVOID lpRead, DWORD dwReadLen)
Definition: imm.c:2433
BOOL WINAPI ImeInquire(LPIMEINFO, LPWSTR, LPCWSTR lpszOptions)
#define SCS_CHANGECLAUSE
Definition: imm.h:449
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
#define GCS_DELTASTART
Definition: imm.h:363
DWORD fdwConversionCaps
Definition: imm.h:153
#define SetLastError(x)
Definition: compat.h:409
HWND hWnd
Definition: imm.h:28
BOOL WINAPI ImmUnlockIMCC(HIMCC imcc)
Definition: imm.c:2939
DWORD dwCompClauseLen
Definition: imm.h:170
Definition: id3.c:18
_Check_return_ BOOL WINAPI GetKeyboardState(_Out_writes_(256) PBYTE lpKeyState)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define IME_ESC_GET_EUDC_DICTIONARY
Definition: imm.h:557
#define SCS_QUERYRECONVERTSTRING
Definition: imm.h:451
#define GCS_COMPCLAUSE
Definition: imm.h:361
BOOL WINAPI ImmGetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf)
Definition: imm.c:1188
static BOOL IMM_IsCrossThreadAccess(HWND hWnd, HIMC hIMC)
Definition: imm.c:544
DWORD dwStyle
Definition: imm.h:145
static HANDLE thread
Definition: service.c:33
static LONG ImmGetCompositionStringT(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen, BOOL unicode)
Definition: imm.c:1365
int ret
static struct list ImmHklList
Definition: imm.c:100
struct tagCANDIDATEINFO CANDIDATEINFO
HIMCC hMsgBuf
Definition: imm.h:45
DWORD dwPrivateDataSize
Definition: imm.h:151
WCHAR const WCHAR DWORD
Definition: imm.c:54
DWORD WINAPI ImmGetImeMenuItemsA(HIMC hIMC, DWORD dwFlags, DWORD dwType, LPIMEMENUITEMINFOA lpImeParentMenu, LPIMEMENUITEMINFOA lpImeMenu, DWORD dwSize)
Definition: imm.c:2737
DWORD dwOffset[32]
Definition: imm.h:201
DWORD dwResultClauseOffset
Definition: imm.h:181
static const WCHAR szImeFileW[]
Definition: imm.c:105
struct tagGUIDELINE GUIDELINE
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
static const struct getline_s gl[]
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
HIMCC hCompStr
Definition: imm.h:40
DWORD dwCompReadAttrOffset
Definition: imm.h:163
static const WCHAR szwIME[]
Definition: imm.c:109
DWORD WINAPI ImeConversionList(HIMC, LPCWSTR, LPCANDIDATELIST, DWORD, UINT)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static const WCHAR szLayoutTextW[]
Definition: imm.c:106
BOOL WINAPI ImmDisableIME(DWORD idThread)
Definition: imm.c:837
static BOOL IMM_DestroyContext(HIMC hIMC)
Definition: imm.c:798
HANDLE WINAPI OpenThread(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwThreadId)
Definition: thread.c:365
static int state
Definition: maze.c:121
DWORD dwCompReadAttrLen
Definition: imm.h:162
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
#define GCS_COMPATTR
Definition: imm.h:360
Definition: _list.h:228
static const WCHAR szwWineIMCProperty[]
Definition: imm.c:103
BOOL WINAPI NotifyIME(HIMC, DWORD, DWORD, DWORD)
WINE_DEFAULT_DEBUG_CHANNEL(imm)
GLenum src
Definition: glext.h:6340
UINT_PTR HKL
Definition: msctf.idl:101
Definition: imm.c:43
LIST_ENTRY ProcessLocksList
Definition: winbase.h:848
HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC)
Definition: imm.c:563
BOOL WINAPI ImeSetCompositionString(HIMC, DWORD, LPCVOID, DWORD, LPCVOID, DWORD)
static INT CopyCompStringIMEtoClient(InputContextData *data, LPBYTE source, INT slen, LPBYTE target, INT tlen, BOOL unicode)
Definition: imm.c:1205
static ImmHkl * IMM_GetImmHkl(HKL hkl)
Definition: imm.c:326
DWORD dwResultReadClauseLen
Definition: imm.h:176
BOOL WINAPI ImmDestroySoftKeyboard(HWND hSoftWnd)
Definition: imm.c:2647
int chr(char *serport)
Definition: gdblib.c:152
RECT rcArea
Definition: imm.h:60
#define GCS_RESULTCLAUSE
Definition: imm.h:367
BOOL WINAPI ImmSetCompositionFontA(HIMC hIMC, LPLOGFONTA lplf)
Definition: imm.c:2328
static LRESULT ImmInternalSendIMENotify(InputContextData *data, WPARAM notify, LPARAM lParam)
Definition: imm.c:463
#define GCS_COMPREADCLAUSE
Definition: imm.h:358
HWND WINAPI __wine_get_ui_window(HKL hkl)
Definition: imm.c:394
UINT WINAPI ImmGetRegisterWordStyleA(HKL hKL, UINT nItem, LPSTYLEBUFA lpStyleBuf)
Definition: imm.c:1933
DWORD WINAPI ImmGetProperty(HKL hKL, DWORD fdwIndex)
Definition: imm.c:1905
BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC)
Definition: imm.c:2253
UINT WINAPI ImeGetRegisterWordStyle(UINT, LPSTYLEBUFW)
BOOL WINAPI ImmSetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf)
Definition: imm.c:2354
BOOL WINAPI ImeDestroy(UINT)
DWORD dwCompStrOffset
Definition: imm.h:173
DWORD fdwSCSCaps
Definition: imm.h:156
#define IMEMENUITEM_STRING_SIZE
Definition: dimm.idl:115
HKL hkl
Definition: msctf.idl:611
WPARAM wParam
Definition: imm.c:87
BOOL WINAPI ImmGenerateMessage(HIMC hIMC)
Definition: imm.c:2971
BOOL WINAPI ImmSetOpenStatus(HIMC hIMC, BOOL fOpen)
Definition: imm.c:2571
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
BOOL WINAPI ImmGetCompositionFontA(HIMC hIMC, LPLOGFONTA lplf)
Definition: imm.c:1168
DWORD WINAPI GetProcessIdOfThread(IN HANDLE Thread)
Definition: thread.c:851
BOOL WINAPI ImmSimulateHotKey(HWND hWnd, DWORD dwHotKeyID)
Definition: imm.c:2667
UINT WINAPI ImmGetDescriptionW(HKL hKL, LPWSTR lpszDescription, UINT uBufLen)
Definition: imm.c:1767
#define lstrcpyW
Definition: compat.h:406
int WINAPI ToAscii(_In_ UINT, _In_ UINT, _In_reads_opt_(256) CONST BYTE *, _Out_ LPWORD, _In_ UINT)
struct tagIMEMENUITEMINFOW IMEMENUITEMINFOW
DWORD dwIndex
Definition: dimm.idl:79
struct _OSVERSIONINFOA OSVERSIONINFOA
#define IACE_CHILDREN
Definition: imm.h:575
static INT CopyCompAttrIMEtoClient(InputContextData *data, LPBYTE source, INT slen, LPBYTE ssource, INT sslen, LPBYTE target, INT tlen, BOOL unicode)
Definition: imm.c:1224
HWND WINAPI ImmCreateSoftKeyboard(UINT uType, UINT hOwner, int x, int y)
Definition: imm.c:2637
BOOL WINAPI ImmRegisterWordA(HKL hKL, LPCSTR lpszReading, DWORD dwStyle, LPCSTR lpszRegister)
Definition: imm.c:2193
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
#define ARRAY_SIZE(a)
Definition: main.h:24
DWORD WINAPI ImmGetCandidateListA(HIMC hIMC, DWORD dwIndex, LPCANDIDATELIST lpCandList, DWORD dwBufLen)
Definition: imm.c:1002
#define IMN_SETSTATUSWINDOWPOS
Definition: imm.h:525
BOOL WINAPI ImmShowSoftKeyboard(HWND hSoftWnd, int nCmdShow)
Definition: imm.c:2657
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HIMCC hGuideLine
Definition: imm.h:42
WCHAR szString[IMEMENUITEM_STRING_SIZE]
Definition: dimm.idl:137
Definition: services.c:325
GLenum GLenum dst
Definition: glext.h:6340
PKEYBOARD_LAYOUT GetKeyboardLayout()
Definition: utils.c:194
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
BOOL WINAPI ImmConfigureIMEA(HKL hKL, HWND hWnd, DWORD dwMode, LPVOID lpData)
Definition: imm.c:670
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
struct tagCOMPOSITIONSTRING COMPOSITIONSTRING
BOOL WINAPI IsBadReadPtr(IN LPCVOID lp, IN UINT_PTR ucb)
Definition: except.c:807
ImmHkl * immKbd
Definition: imm.c:77
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define IME_CONFIG_REGISTERWORD
Definition: imm.h:547
HIMCC WINAPI ImmCreateIMCC(DWORD size)
Definition: imm.c:2915
#define min(a, b)
Definition: monoChain.cc:55
#define WS_POPUP
Definition: pedump.c:616
HBITMAP hbmpItem
Definition: dimm.idl:126
BOOL WINAPI ImmGetCompositionWindow(HIMC hIMC, LPCOMPOSITIONFORM lpCompForm)
Definition: imm.c:1479
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI ImmGetVirtualKey(HWND hWnd)
Definition: imm.c:2006
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
BOOL threadDefault
Definition: imm.c:79
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
#define IMC_SETOPENSTATUS
Definition: imm.h:219
DWORD fdwSentence
Definition: imm.h:33
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
const BYTE DWORD HIMC
Definition: imm.c:59
const BYTE DWORD UINT
Definition: imm.c:59
DWORD WINAPI ImmGetIMCCLockCount(HIMCC imcc)
Definition: imm.c:2947
BOOL
Definition: imm.c:58
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define IME_ESC_IME_NAME
Definition: imm.h:560
static CRITICAL_SECTION_DEBUG critsect_debug
Definition: imm.c:113
LPWSTR lpWord
Definition: dimm.idl:36
#define MultiByteToWideChar
Definition: compat.h:100
LRESULT WINAPI ImmEscapeA(HKL hKL, HIMC hIMC, UINT uEscape, LPVOID lpData)
Definition: imm.c:932
#define IME_ESC_SET_EUDC_DICTIONARY
Definition: imm.h:558
#define IMC_SETCONVERSIONMODE
Definition: imm.h:217
BOOL WINAPI ImmSetCandidateWindow(HIMC hIMC, LPCANDIDATEFORM lpCandidate)
Definition: imm.c:2297
#define VER_PLATFORM_WIN32_WINDOWS
Definition: rtltypes.h:235
#define ISC_SHOWUIALL
Definition: imm.h:300
#define IMC_SETCOMPOSITIONFONT
Definition: imm.h:273
#define IGP_GETIMEVERSION
Definition: imm.h:437
HWND WINAPI GetFocus(void)
Definition: window.c:1875
#define msg(x)
Definition: auth_time.c:54
CONST void * LPCVOID
Definition: windef.h:191
#define IMC_SETCANDIDATEPOS
Definition: imm.h:271
BOOL WINAPI ImmSetCompositionStringA(HIMC hIMC, DWORD dwIndex, LPCVOID lpComp, DWORD dwCompLen, LPCVOID lpRead, DWORD dwReadLen)
Definition: imm.c:2378
BOOL WINAPI ImeSelect(HIMC, BOOL)
BOOL WINAPI ImmGetCandidateWindow(HIMC hIMC, DWORD dwIndex, LPCANDIDATEFORM lpCandidate)
Definition: imm.c:1144
Definition: name.c:36
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HIMC defaultContext
Definition: imm.c:94
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
DWORD dwCompReadStrOffset
Definition: imm.h:167
#define IMC_SETSTATUSWINDOWPOS
Definition: imm.h:277
uint32_t * LPDWORD
Definition: typedefs.h:57
HIMCC WINAPI ImmReSizeIMCC(HIMCC imcc, DWORD size)
Definition: imm.c:2955
#define THREAD_QUERY_INFORMATION
Definition: pstypes.h:141
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
BOOL(CALLBACK * IMCENUMPROC)(HIMC, LPARAM)
Definition: imm.h:141
HBITMAP hbmpItem
Definition: imm.h:127
unsigned int ULONG
Definition: retypes.h:1
GLenum target
Definition: glext.h:7315
BOOL WINAPI IsWindowVisible(_In_ HWND)
DWORD WINAPI ImmGetGuideLineA(HIMC hIMC, DWORD dwIndex, LPSTR lpBuf, DWORD dwBufLen)
Definition: imm.c:1782
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
BOOL WINAPI ImmSetConversionStatus(HIMC hIMC, DWORD fdwConversion, DWORD fdwSentence)
Definition: imm.c:2533
BOOL WINAPI ImmNotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
Definition: imm.c:2168
UINT WINAPI ImmGetIMEFileNameW(HKL hKL, LPWSTR lpszFileName, UINT uBufLen)
Definition: imm.c:1840
DWORD dwIndex
Definition: imm.h:57
DWORD fdwSentenceCaps
Definition: imm.h:154
int WINAPI ToUnicodeEx(_In_ UINT wVirtKey, _In_ UINT wScanCode, _In_reads_bytes_(256) CONST BYTE *lpKeyState, _Out_writes_(cchBuff) LPWSTR pwszBuff, _In_ int cchBuff, _In_ UINT wFlags, _In_opt_ HKL dwhkl)
static char * dest
Definition: rtl.c:135
#define SetWindowLongPtrW
Definition: winuser.h:5215
static const WCHAR szImeRegFmt[]
Definition: imm.c:107
#define IMEVER_0400
Definition: imm.h:379
BOOL WINAPI ImmTranslateMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lKeyData)
Definition: imm.c:3011
static HMODULE load_graphics_driver(void)
Definition: imm.c:292
DWORD WINAPI ImmGetConversionListW(HKL hKL, HIMC hIMC, LPCWSTR pSrc, LPCANDIDATELIST lpDst, DWORD dwBufLen, UINT uFlag)
Definition: imm.c:1566
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
DWORD dwCompClauseOffset
Definition: imm.h:171
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LONG_PTR LRESULT
Definition: windef.h:209
const WCHAR DWORD
Definition: imm.c:62
DWORD dwResultReadStrLen
Definition: imm.h:178
static DWORD convert_candidatelist_WtoA(LPCANDIDATELIST lpSrc, LPCANDIDATELIST lpDst, DWORD dwBufLen)
Definition: imm.c:152
static const WCHAR szwDefaultIME[]
Definition: imm.c:110
BOOL WINAPI ImmIsUIMessageW(HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: imm.c:2146
#define memset(x, y, z)
Definition: compat.h:39
BOOL WINAPI ImmRegisterWordW(HKL hKL, LPCWSTR lpszReading, DWORD dwStyle, LPCWSTR lpszRegister)
Definition: imm.c:2223
#define GCS_COMPSTR
Definition: imm.h:359
#define CHAR(Char)
#define IGP_SENTENCE
Definition: imm.h:440
#define IGP_CONVERSION
Definition: imm.h:439
#define GMEM_LOCKCOUNT
Definition: winbase.h:306
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:2890
LPARAM lParam
Definition: combotst.c:139
static CRITICAL_SECTION threaddata_cs
Definition: imm.c:112
int k
Definition: mpi.c:3369
HWND WINAPI GetActiveWindow(void)
Definition: winpos.c:137
void WINAPI __wine_unregister_window(HWND hwnd)
Definition: imm.c:1689
struct tagIMEMENUITEMINFOA * LPIMEMENUITEMINFOA
#define HeapFree(x, y, z)
Definition: compat.h:394
CHAR szString[IMEMENUITEM_STRING_SIZE]
Definition: dimm.idl:125
#define GetClassLongPtrW
Definition: winuser.h:4433
#define GMEM_MOVEABLE
Definition: winbase.h:291
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define GMEM_ZEROINIT
Definition: winbase.h:303
UINT WINAPI ImmGetRegisterWordStyleW(HKL hKL, UINT nItem, LPSTYLEBUFW lpStyleBuf)
Definition: imm.c:1961
BOOL WINAPI ImmIsUIMessageA(HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: imm.c:2124
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1188
#define GCS_COMPREADATTR
Definition: imm.h:357
BOOL WINAPI ImmProcessKey(HWND hwnd, HKL hKL, UINT vKey, LPARAM lKeyData, DWORD unknown)
Definition: imm.c:3075
DWORD dwLock
Definition: imm.c:73
struct tagIMEMENUITEMINFOW * LPIMEMENUITEMINFOW
Definition: path.c:42
DWORD dwResultStrOffset
Definition: imm.h:183
static struct list ImmThreadDataList
Definition: imm.c:101
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define IGP_UI
Definition: imm.h:441
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define REG_SZ
Definition: layer.c:22