ReactOS  0.4.15-dev-4570-g4f8bbd1
keymsg.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS IMM32
3  * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4  * PURPOSE: Implementing IMM32 keys and messages
5  * COPYRIGHT: Copyright 1998 Patrik Stridvall
6  * Copyright 2002, 2003, 2007 CodeWeavers, Aric Stewart
7  * Copyright 2017 James Tabor <james.tabor@reactos.org>
8  * Copyright 2018 Amine Khaldi <amine.khaldi@reactos.org>
9  * Copyright 2020-2021 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
10  */
11 
12 #include "precomp.h"
13 
15 
17 {
18  LPINPUTCONTEXT pIC;
19  BOOL fOpen;
20 
21  if (hWnd != NULL)
22  return FALSE;
23 
24  if (!IS_IME_HKL(hKL) || LOWORD(hKL) != LangID)
25  {
26  FIXME("We have to do something here\n");
27  return TRUE;
28  }
29 
30  pIC = ImmLockIMC(hIMC);
31  if (pIC == NULL)
32  return TRUE;
33 
34  fOpen = pIC->fOpen;
35  ImmUnlockIMC(hIMC);
36 
37  if (!fOpen)
38  {
39  ImmSetOpenStatus(hIMC, TRUE);
40  return TRUE;
41  }
42 
43  FIXME("We have to do something here\n");
44  return TRUE;
45 }
46 
48 {
49  LPINPUTCONTEXT pIC;
50  BOOL fOpen;
51  DWORD dwConversion, dwSentence;
52 
53  if (hWnd == NULL || !IS_IME_HKL(hKL))
54  return FALSE;
55 
56  pIC = ImmLockIMC(hIMC);
57  if (pIC == NULL)
58  return TRUE;
59 
60  fOpen = pIC->fOpen;
61  if (fOpen)
62  {
63  dwConversion = (pIC->fdwConversion ^ IME_CMODE_FULLSHAPE);
64  dwSentence = pIC->fdwSentence;
65  }
66 
67  ImmUnlockIMC(hIMC);
68 
69  if (fOpen)
70  ImmSetConversionStatus(hIMC, dwConversion, dwSentence);
71  else
72  ImmSetOpenStatus(hIMC, TRUE);
73 
74  return TRUE;
75 }
76 
78 {
79  LPINPUTCONTEXT pIC;
80  BOOL fOpen;
81  DWORD dwConversion, dwSentence;
82 
83  if (hWnd == NULL || !IS_IME_HKL(hKL))
84  return FALSE;
85 
86  pIC = ImmLockIMC(hIMC);
87  if (pIC == NULL)
88  return TRUE;
89 
90  fOpen = pIC->fOpen;
91  if (fOpen)
92  {
93  dwConversion = (pIC->fdwConversion ^ IME_CMODE_SYMBOL);
94  dwSentence = pIC->fdwSentence;
95  }
96 
97  ImmUnlockIMC(hIMC);
98 
99  if (fOpen)
100  ImmSetConversionStatus(hIMC, dwConversion, dwSentence);
101  else
102  ImmSetOpenStatus(hIMC, TRUE);
103 
104  return TRUE;
105 }
106 
108 {
109  BOOL fOpen;
110 
111  if (ImmIsIME(hKL) && LOWORD(hKL) == LANGID_JAPANESE)
112  {
113  fOpen = ImmGetOpenStatus(hIMC);
114  ImmSetOpenStatus(hIMC, !fOpen);
115  return TRUE;
116  }
117 
118  FIXME("We have to do something here\n");
119  return TRUE;
120 }
121 
123 {
124  LPINPUTCONTEXT pIC;
125  DWORD dwConversion, dwSentence;
126 
127  pIC = ImmLockIMC(hIMC);
128  if (pIC == NULL)
129  return FALSE;
130 
131  dwConversion = (pIC->fdwConversion ^ IME_CMODE_FULLSHAPE);
132  dwSentence = pIC->fdwSentence;
133  ImmSetConversionStatus(hIMC, dwConversion, dwSentence);
134 
136  ImmSetOpenStatus(hIMC, TRUE);
137  else
138  ImmSetOpenStatus(hIMC, FALSE);
139 
140  ImmUnlockIMC(hIMC);
141  return TRUE;
142 }
143 
145 {
146  LPINPUTCONTEXT pIC;
147  DWORD dwConversion, dwSentence;
148 
149  pIC = ImmLockIMC(hIMC);
150  if (!pIC)
151  return FALSE;
152 
153  dwConversion = (pIC->fdwConversion ^ IME_CMODE_HANJACONVERT);
154  dwSentence = pIC->fdwSentence;
155  ImmUnlockIMC(hIMC);
156 
157  ImmSetConversionStatus(hIMC, dwConversion, dwSentence);
158  return TRUE;
159 }
160 
162 {
163  LPINPUTCONTEXT pIC;
164  DWORD dwConversion, dwSentence;
165  BOOL fOpen;
166 
167  pIC = ImmLockIMC(hIMC);
168  if (pIC == NULL)
169  return FALSE;
170 
171  dwConversion = (pIC->fdwConversion ^ IME_CMODE_NATIVE);
172  dwSentence = pIC->fdwSentence;
173  ImmSetConversionStatus(hIMC, dwConversion, dwSentence);
174 
175  fOpen = ((pIC->fdwConversion & (IME_CMODE_FULLSHAPE | IME_CMODE_NATIVE)) != 0);
176  ImmSetOpenStatus(hIMC, fOpen);
177 
178  ImmUnlockIMC(hIMC);
179  return TRUE;
180 }
181 
182 // Win: HotKeyIDDispatcher
184 {
185  PIMEDPI pImeDpi;
186  BOOL ret;
187 
188  if (hIMC && Imm32IsCrossThreadAccess(hIMC))
189  return FALSE;
190 
191  switch (dwHotKeyID)
192  {
195 
197  return Imm32CShapeToggle(hIMC, hKL, hWnd);
198 
200  return Imm32CSymbolToggle(hIMC, hKL, hWnd);
201 
203  return Imm32JCloseOpen(hIMC, hKL, hWnd);
204 
206  return Imm32KShapeToggle(hIMC);
207 
209  return Imm32KHanjaConvert(hIMC);
210 
211  case IME_KHOTKEY_ENGLISH:
212  return Imm32KEnglish(hIMC);
213 
216 
218  return Imm32CShapeToggle(hIMC, hKL, hWnd);
219 
221  return Imm32CSymbolToggle(hIMC, hKL, hWnd);
222 
223  default:
224  break;
225  }
226 
227  if (dwHotKeyID < IME_HOTKEY_PRIVATE_FIRST || IME_HOTKEY_PRIVATE_LAST < dwHotKeyID)
228  return FALSE;
229 
230  pImeDpi = ImmLockImeDpi(hKL);
231  if (pImeDpi == NULL)
232  return FALSE;
233 
234  ret = (BOOL)pImeDpi->ImeEscape(hIMC, IME_ESC_PRIVATE_HOTKEY, &dwHotKeyID);
235  ImmUnlockImeDpi(pImeDpi);
236  return ret;
237 }
238 
239 // Win: ImmIsUIMessageWorker
240 static BOOL APIENTRY
242 {
243  switch (msg)
244  {
245  case WM_IME_STARTCOMPOSITION: case WM_IME_ENDCOMPOSITION:
246  case WM_IME_COMPOSITION: case WM_IME_SETCONTEXT: case WM_IME_NOTIFY:
248  break;
249  default:
250  return FALSE;
251  }
252 
253  if (!hWndIME)
254  return TRUE;
255 
256  if (bAnsi)
257  SendMessageA(hWndIME, msg, wParam, lParam);
258  else
259  SendMessageW(hWndIME, msg, wParam, lParam);
260 
261  return TRUE;
262 }
263 
264 typedef struct IMM_UNKNOWN_PROCESS1
265 {
269 
271 {
272  HWND hwndDefIME;
273  UINT uValue;
274  DWORD_PTR lResult;
276 
277  Sleep(3000);
278  hwndDefIME = ImmGetDefaultIMEWnd(pUnknown->hWnd);
279  if (hwndDefIME)
280  {
281  uValue = (pUnknown->fFlag ? 0x23 : 0x24);
282  SendMessageTimeoutW(hwndDefIME, WM_IME_SYSTEM, uValue, (LPARAM)pUnknown->hWnd,
283  SMTO_BLOCK | SMTO_ABORTIFHUNG, 5000, &lResult);
284  }
286  return FALSE;
287 }
288 
290 {
291  HANDLE hThread;
292  PWND pWnd = NULL;
293  PIMM_UNKNOWN_PROCESS1 pUnknown1;
294  DWORD_PTR lResult = 0;
295 
296  if (hWnd && gpsi)
297  pWnd = ValidateHwndNoErr(hWnd);
298 
299  if (!pWnd)
300  return 0;
301 
303  {
304  SendMessageTimeoutW(hWnd, 0x505, 0, fFlag, 3, 5000, &lResult);
305  return lResult;
306  }
307 
308  pUnknown1 = ImmLocalAlloc(0, sizeof(IMM_UNKNOWN_PROCESS1));
309  if (!pUnknown1)
310  return 0;
311 
312  pUnknown1->hWnd = hWnd;
313  pUnknown1->fFlag = fFlag;
314 
315  hThread = CreateThread(NULL, 0, Imm32UnknownProcess1Proc, pUnknown1, 0, NULL);
316  if (hThread)
318  return 0;
319 }
320 
322 {
323  HWND hWnd;
324  LPINPUTCONTEXTDX pIC;
325 
326  pIC = (LPINPUTCONTEXTDX)ImmLockIMC(hIMC);
327  if (!pIC)
328  return TRUE;
329 
330  hWnd = pIC->hWnd;
331  if (!IsWindow(hWnd))
332  goto Quit;
333 
339  NtUserNotifyIMEStatus(hWnd, pIC->fOpen, pIC->fdwConversion);
342 Quit:
343  pIC->dwChange = 0;
344  ImmUnlockIMC(hIMC); // ??? Windows doesn't unlock here
345  return TRUE;
346 }
347 
349 {
350  return ImmEnumInputContext((bProcess ? -1 : 0), Imm32SendChangeProc, 0);
351 }
352 
354 {
355  FIXME("()\n");
356  SetLastError(dwError);
357 }
358 
360 Imm32ProcessRequest(HIMC hIMC, PWND pWnd, DWORD dwCommand, LPVOID pData, BOOL bAnsiAPI)
361 {
362  HWND hWnd;
363  DWORD ret = 0, dwCharPos, cchCompStr;
364  LPVOID pCS, pTempData = pData;
365  LPRECONVERTSTRING pRS;
366  LPIMECHARPOSITION pICP;
367  PCLIENTIMC pClientImc;
368  UINT uCodePage = CP_ACP;
369  BOOL bAnsiWnd = !!(pWnd->state & WNDS_ANSIWINDOWPROC);
370  static const size_t acbData[7 * 2] =
371  {
372  /* UNICODE */
373  sizeof(COMPOSITIONFORM), sizeof(CANDIDATEFORM), sizeof(LOGFONTW),
374  sizeof(RECONVERTSTRING), sizeof(RECONVERTSTRING),
375  sizeof(IMECHARPOSITION), sizeof(RECONVERTSTRING),
376  /* ANSI */
377  sizeof(COMPOSITIONFORM), sizeof(CANDIDATEFORM), sizeof(LOGFONTA),
378  sizeof(RECONVERTSTRING), sizeof(RECONVERTSTRING),
379  sizeof(IMECHARPOSITION), sizeof(RECONVERTSTRING),
380  };
381 
382  if (dwCommand == 0 || dwCommand > IMR_DOCUMENTFEED)
383  return 0; /* Out of range */
384 
385  if (pData && IsBadWritePtr(pData, acbData[bAnsiAPI * 7 + dwCommand - 1]))
386  return 0; /* Invalid pointer */
387 
388  /* Sanity check */
389  switch (dwCommand)
390  {
392  pRS = pData;
393  if (pRS && (pRS->dwVersion != 0 || pRS->dwSize < sizeof(RECONVERTSTRING)))
394  {
396  return 0;
397  }
398  break;
399 
401  pRS = pData;
402  if (!pRS || pRS->dwVersion != 0)
403  {
405  return 0;
406  }
407  break;
408 
409  default:
410  if (!pData)
411  {
413  return 0;
414  }
415  break;
416  }
417 
418  pClientImc = ImmLockClientImc(hIMC);
419  if (pClientImc)
420  {
421  uCodePage = pClientImc->uCodePage;
422  ImmUnlockClientImc(pClientImc);
423  }
424 
425  /* Prepare */
426  switch (dwCommand)
427  {
428  case IMR_COMPOSITIONFONT:
429  if (bAnsiAPI == bAnsiWnd)
430  goto DoIt;
431  if (bAnsiWnd)
432  pTempData = ImmLocalAlloc(0, sizeof(LOGFONTA));
433  else
434  pTempData = ImmLocalAlloc(0, sizeof(LOGFONTW));
435  if (!pTempData)
436  return 0;
437  break;
438 
440  if (bAnsiAPI == bAnsiWnd || !pData)
441  goto DoIt;
442 
443  if (bAnsiWnd)
444  ret = Imm32ReconvertAnsiFromWide(NULL, pData, uCodePage);
445  else
446  ret = Imm32ReconvertWideFromAnsi(NULL, pData, uCodePage);
447 
448  pTempData = ImmLocalAlloc(0, ret + sizeof(WCHAR));
449  if (!pTempData)
450  return 0;
451 
452  pRS = pTempData;
453  pRS->dwSize = ret;
454  pRS->dwVersion = 0;
455 
456  if (dwCommand == IMR_CONFIRMRECONVERTSTRING)
457  {
458  if (bAnsiWnd)
459  ret = Imm32ReconvertAnsiFromWide(pTempData, pData, uCodePage);
460  else
461  ret = Imm32ReconvertWideFromAnsi(pTempData, pData, uCodePage);
462  }
463  break;
464 
466  if (bAnsiAPI == bAnsiWnd)
467  goto DoIt;
468 
469  pICP = pData;
470  dwCharPos = pICP->dwCharPos;
471 
472  if (bAnsiAPI)
473  {
474  cchCompStr = ImmGetCompositionStringA(hIMC, GCS_COMPSTR, NULL, 0);
475  if (!cchCompStr)
476  return 0;
477 
478  pCS = ImmLocalAlloc(0, (cchCompStr + 1) * sizeof(CHAR));
479  if (!pCS)
480  return 0;
481 
482  ImmGetCompositionStringA(hIMC, GCS_COMPSTR, pCS, cchCompStr);
483  pICP->dwCharPos = IchWideFromAnsi(pICP->dwCharPos, pCS, uCodePage);
484  }
485  else
486  {
487  cchCompStr = ImmGetCompositionStringW(hIMC, GCS_COMPSTR, NULL, 0);
488  if (!cchCompStr)
489  return 0;
490 
491  pCS = ImmLocalAlloc(0, (cchCompStr + 1) * sizeof(WCHAR));
492  if (!pCS)
493  return 0;
494 
495  ImmGetCompositionStringW(hIMC, GCS_COMPSTR, pCS, cchCompStr);
496  pICP->dwCharPos = IchAnsiFromWide(pICP->dwCharPos, pCS, uCodePage);
497  }
498 
499  ImmLocalFree(pCS);
500  break;
501 
502  default:
503  break;
504  }
505 
506 DoIt:
507  /* The main task */
508  hWnd = pWnd->head.h;
509  if (bAnsiWnd)
510  ret = SendMessageA(hWnd, WM_IME_REQUEST, dwCommand, (LPARAM)pTempData);
511  else
512  ret = SendMessageW(hWnd, WM_IME_REQUEST, dwCommand, (LPARAM)pTempData);
513 
514  if (bAnsiAPI == bAnsiWnd)
515  goto Quit;
516 
517  /* Get back to caller */
518  switch (dwCommand)
519  {
520  case IMR_COMPOSITIONFONT:
521  if (bAnsiAPI)
522  LogFontWideToAnsi(pTempData, pData);
523  else
524  LogFontAnsiToWide(pTempData, pData);
525  break;
526 
528  if (!ret)
529  break;
530 
531  if (ret < sizeof(RECONVERTSTRING))
532  {
533  ret = 0;
534  break;
535  }
536 
537  if (pTempData)
538  {
539  if (bAnsiWnd)
540  ret = Imm32ReconvertWideFromAnsi(pData, pTempData, uCodePage);
541  else
542  ret = Imm32ReconvertAnsiFromWide(pData, pTempData, uCodePage);
543  }
544  break;
545 
547  pICP->dwCharPos = dwCharPos;
548  break;
549 
550  default:
551  break;
552  }
553 
554 Quit:
555  if (pTempData != pData)
556  ImmLocalFree(pTempData);
557  return ret;
558 }
559 
560 // Win: ImmRequestMessageWorker
562 {
563  LRESULT ret = 0;
564  LPINPUTCONTEXT pIC;
565  HWND hWnd;
566  PWND pWnd = NULL;
567 
568  if (!hIMC || Imm32IsCrossThreadAccess(hIMC))
569  return FALSE;
570 
571  pIC = ImmLockIMC(hIMC);
572  if (!pIC)
573  return FALSE;
574 
575  hWnd = pIC->hWnd;
576  if (hWnd)
577  pWnd = ValidateHwnd(hWnd);
578 
579  if (pWnd && pWnd->head.pti == Imm32CurrentPti())
580  ret = Imm32ProcessRequest(hIMC, pWnd, (DWORD)wParam, (LPVOID)lParam, bAnsi);
581 
582  ImmUnlockIMC(hIMC);
583  return ret;
584 }
585 
586 /***********************************************************************
587  * ImmIsUIMessageA (IMM32.@)
588  */
590 {
591  TRACE("(%p, 0x%X, %p, %p)\n", hWndIME, msg, wParam, lParam);
592  return ImmIsUIMessageAW(hWndIME, msg, wParam, lParam, TRUE);
593 }
594 
595 /***********************************************************************
596  * ImmIsUIMessageW (IMM32.@)
597  */
599 {
600  TRACE("(%p, 0x%X, %p, %p)\n", hWndIME, msg, wParam, lParam);
601  return ImmIsUIMessageAW(hWndIME, msg, wParam, lParam, FALSE);
602 }
603 
604 /***********************************************************************
605  * ImmGetHotKey(IMM32.@)
606  */
607 BOOL WINAPI
608 ImmGetHotKey(IN DWORD dwHotKey, OUT LPUINT lpuModifiers, OUT LPUINT lpuVKey,
609  OUT LPHKL lphKL)
610 {
611  TRACE("(0x%lX, %p, %p, %p)\n", dwHotKey, lpuModifiers, lpuVKey, lphKL);
612  if (lpuModifiers && lpuVKey)
613  return NtUserGetImeHotKey(dwHotKey, lpuModifiers, lpuVKey, lphKL);
614  return FALSE;
615 }
616 
617 /***********************************************************************
618  * ImmWINNLSGetIMEHotkey (IMM32.@)
619  */
621 {
622  TRACE("(%p)\n", hwndIme);
623  UNREFERENCED_PARAMETER(hwndIme);
624  return 0; /* This is correct. This function of Windows just returns zero. */
625 }
626 
627 /***********************************************************************
628  * ImmSimulateHotKey (IMM32.@)
629  */
631 {
632  HIMC hIMC;
634  HKL hKL;
635  BOOL ret;
636 
637  TRACE("(%p, 0x%lX)\n", hWnd, dwHotKeyID);
638 
639  hIMC = ImmGetContext(hWnd);
642  ret = Imm32ProcessHotKey(hWnd, hIMC, hKL, dwHotKeyID);
643  ImmReleaseContext(hWnd, hIMC);
644  return ret;
645 }
646 
647 /***********************************************************************
648  * ImmGetVirtualKey (IMM32.@)
649  */
651 {
652  HIMC hIMC;
653  LPINPUTCONTEXTDX pIC;
655 
656  TRACE("(%p)\n", hWnd);
657 
658  hIMC = ImmGetContext(hWnd);
659  pIC = (LPINPUTCONTEXTDX)ImmLockIMC(hIMC);
660  if (!pIC)
661  return ret;
662 
663  if (pIC->bNeedsTrans)
664  ret = pIC->nVKey;
665 
666  ImmUnlockIMC(hIMC);
667  return ret;
668 }
669 
670 /***********************************************************************
671  * ImmProcessKey(IMM32.@)
672  * ( Undocumented, called from user32.dll )
673  */
675 ImmProcessKey(HWND hWnd, HKL hKL, UINT vKey, LPARAM lParam, DWORD dwHotKeyID)
676 {
677  DWORD ret = 0;
678  HIMC hIMC;
679  PIMEDPI pImeDpi;
680  LPINPUTCONTEXTDX pIC;
681  BYTE KeyState[256];
682  UINT vk;
683  BOOL bUseIme = TRUE, bSkipThisKey = FALSE, bLowWordOnly = FALSE;
684 
685  TRACE("(%p, %p, 0x%X, %p, 0x%lX)\n", hWnd, hKL, vKey, lParam, dwHotKeyID);
686 
687  hIMC = ImmGetContext(hWnd);
688  pImeDpi = ImmLockImeDpi(hKL);
689  if (pImeDpi)
690  {
691  pIC = (LPINPUTCONTEXTDX)ImmLockIMC(hIMC);
692  if (pIC)
693  {
694  if (LOBYTE(vKey) == VK_PACKET &&
696  {
697  if (ImeDpi_IsUnicode(pImeDpi))
698  {
699  bLowWordOnly = TRUE;
700  }
701  else
702  {
703  bUseIme = FALSE;
704  if (pIC->fOpen)
705  bSkipThisKey = TRUE;
706  }
707  }
708 
709  if (bUseIme)
710  {
711  if (GetKeyboardState(KeyState))
712  {
713  vk = (bLowWordOnly ? LOWORD(vKey) : vKey);
714  if (pImeDpi->ImeProcessKey(hIMC, vk, lParam, KeyState))
715  {
716  pIC->bNeedsTrans = TRUE;
717  pIC->nVKey = vKey;
719  }
720  }
721  }
722  else if (bSkipThisKey)
723  {
725  }
726 
727  ImmUnlockIMC(hIMC);
728  }
729 
730  ImmUnlockImeDpi(pImeDpi);
731  }
732 
733  if (dwHotKeyID != INVALID_HOTKEY_ID)
734  {
735  if (Imm32ProcessHotKey(hWnd, hIMC, hKL, dwHotKeyID))
736  {
737  if (vKey != VK_KANJI || dwHotKeyID != IME_JHOTKEY_CLOSE_OPEN)
738  ret |= IPHK_HOTKEY;
739  }
740  }
741 
742  if (ret & IPHK_PROCESSBYIME)
743  {
744  FIXME("TODO: We have to do something here.\n");
745  }
746 
747  ImmReleaseContext(hWnd, hIMC);
748  return ret;
749 }
750 
751 /***********************************************************************
752  * ImmSystemHandler(IMM32.@)
753  */
755 {
756  TRACE("(%p, %p, %p)\n", hIMC, wParam, lParam);
757 
758  switch (wParam)
759  {
760  case 0x1f:
762  return 0;
763 
764  case 0x20:
766  return 0;
767 
768  case 0x23: case 0x24:
769  return Imm32UnknownProcess1((HWND)lParam, (wParam == 0x23));
770 
771  default:
772  return 0;
773  }
774 }
775 
776 /***********************************************************************
777  * ImmGenerateMessage(IMM32.@)
778  */
780 {
781  PCLIENTIMC pClientImc;
782  LPINPUTCONTEXT pIC;
783  LPTRANSMSG pMsgs, pTrans = NULL, pItem;
784  HWND hWnd;
785  DWORD dwIndex, dwCount, cbTrans;
786  HIMCC hMsgBuf = NULL;
787  BOOL bAnsi;
788 
789  TRACE("(%p)\n", hIMC);
790 
791  if (Imm32IsCrossThreadAccess(hIMC))
792  return FALSE;
793 
794  pClientImc = ImmLockClientImc(hIMC);
795  if (pClientImc == NULL)
796  return FALSE;
797 
798  bAnsi = !(pClientImc->dwFlags & CLIENTIMC_WIDE);
799  ImmUnlockClientImc(pClientImc);
800 
801  pIC = ImmLockIMC(hIMC);
802  if (pIC == NULL)
803  return FALSE;
804 
805  dwCount = pIC->dwNumMsgBuf;
806  if (dwCount == 0)
807  goto Quit;
808 
809  hMsgBuf = pIC->hMsgBuf;
810  pMsgs = ImmLockIMCC(hMsgBuf);
811  if (pMsgs == NULL)
812  goto Quit;
813 
814  cbTrans = dwCount * sizeof(TRANSMSG);
815  pTrans = ImmLocalAlloc(0, cbTrans);
816  if (pTrans == NULL)
817  goto Quit;
818 
819  RtlCopyMemory(pTrans, pMsgs, cbTrans);
820 
821 #ifdef IMM_WIN3_SUPPORT
822  if (GetWin32ClientInfo()->dwExpWinVer < _WIN32_WINNT_NT4) /* old version (3.x)? */
823  {
825  WORD wLang = PRIMARYLANGID(LangID);
826 
827  /* translate the messages if Japanese or Korean */
828  if (wLang == LANG_JAPANESE ||
829  (wLang == LANG_KOREAN && NtUserGetAppImeLevel(pIC->hWnd) == 3))
830  {
831  dwCount = ImmNt3Trans(dwCount, pTrans, hIMC, bAnsi, wLang);
832  }
833  }
834 #endif
835 
836  /* send them */
837  hWnd = pIC->hWnd;
838  pItem = pTrans;
839  for (dwIndex = 0; dwIndex < dwCount; ++dwIndex, ++pItem)
840  {
841  if (bAnsi)
842  SendMessageA(hWnd, pItem->message, pItem->wParam, pItem->lParam);
843  else
844  SendMessageW(hWnd, pItem->message, pItem->wParam, pItem->lParam);
845  }
846 
847 Quit:
848  ImmLocalFree(pTrans);
849  if (hMsgBuf)
850  ImmUnlockIMCC(hMsgBuf);
851  pIC->dwNumMsgBuf = 0; /* done */
852  ImmUnlockIMC(hIMC);
853  return TRUE;
854 }
855 
857 Imm32PostMessages(HWND hwnd, HIMC hIMC, DWORD dwCount, LPTRANSMSG lpTransMsg)
858 {
859  DWORD dwIndex;
860  PCLIENTIMC pClientImc;
861  LPTRANSMSG pNewTransMsg = lpTransMsg, pItem;
862  BOOL bAnsi;
863 
864  pClientImc = ImmLockClientImc(hIMC);
865  if (pClientImc == NULL)
866  return;
867 
868  bAnsi = !(pClientImc->dwFlags & CLIENTIMC_WIDE);
869  ImmUnlockClientImc(pClientImc);
870 
871 #ifdef IMM_WIN3_SUPPORT
872  if (GetWin32ClientInfo()->dwExpWinVer < _WIN32_WINNT_NT4) /* old version (3.x)? */
873  {
875  WORD Lang = PRIMARYLANGID(LangID);
876 
877  /* translate the messages if Japanese or Korean */
878  if (Lang == LANG_JAPANESE ||
879  (Lang == LANG_KOREAN && NtUserGetAppImeLevel(hwnd) == 3))
880  {
881  DWORD cbTransMsg = dwCount * sizeof(TRANSMSG);
882  pNewTransMsg = ImmLocalAlloc(0, cbTransMsg);
883  if (pNewTransMsg)
884  {
885  RtlCopyMemory(pNewTransMsg, lpTransMsg, cbTransMsg);
886  dwCount = ImmNt3Trans(dwCount, pNewTransMsg, hIMC, bAnsi, Lang);
887  }
888  else
889  {
890  pNewTransMsg = lpTransMsg;
891  }
892  }
893  }
894 #endif
895 
896  /* post them */
897  pItem = pNewTransMsg;
898  for (dwIndex = 0; dwIndex < dwCount; ++dwIndex, ++pItem)
899  {
900  if (bAnsi)
901  PostMessageA(hwnd, pItem->message, pItem->wParam, pItem->lParam);
902  else
903  PostMessageW(hwnd, pItem->message, pItem->wParam, pItem->lParam);
904  }
905 
906 #ifdef IMM_WIN3_SUPPORT
907  if (pNewTransMsg != lpTransMsg)
908  ImmLocalFree(pNewTransMsg);
909 #endif
910 }
911 
912 /***********************************************************************
913  * ImmTranslateMessage(IMM32.@)
914  * ( Undocumented, call internally and from user32.dll )
915  */
917 {
918 #define MSG_COUNT 0x100
919  BOOL ret = FALSE;
920  INT kret;
921  LPINPUTCONTEXTDX pIC;
922  PIMEDPI pImeDpi = NULL;
924  LPTRANSMSG pTransMsg;
925  BYTE abKeyState[256];
926  HIMC hIMC;
927  HKL hKL;
928  UINT vk;
929  DWORD dwThreadId, dwCount, cbList;
930  WCHAR wch;
931  WORD wChar;
932 
933  TRACE("(%p, 0x%X, %p, %p)\n", hwnd, msg, wParam, lKeyData);
934 
935  /* filter the message */
936  switch (msg)
937  {
938  case WM_KEYDOWN: case WM_KEYUP: case WM_SYSKEYDOWN: case WM_SYSKEYUP:
939  break;
940  default:
941  return FALSE;
942  }
943 
944  hIMC = ImmGetContext(hwnd);
945  pIC = (LPINPUTCONTEXTDX)ImmLockIMC(hIMC);
946  if (pIC == NULL)
947  {
948  ImmReleaseContext(hwnd, hIMC);
949  return FALSE;
950  }
951 
952  if (!pIC->bNeedsTrans) /* is translation needed? */
953  {
954  /* directly post them */
955  dwCount = pIC->dwNumMsgBuf;
956  if (dwCount == 0)
957  goto Quit;
958 
959  pTransMsg = ImmLockIMCC(pIC->hMsgBuf);
960  if (pTransMsg)
961  {
962  Imm32PostMessages(hwnd, hIMC, dwCount, pTransMsg);
963  ImmUnlockIMCC(pIC->hMsgBuf);
964  ret = TRUE;
965  }
966  pIC->dwNumMsgBuf = 0; /* done */
967  goto Quit;
968  }
969  pIC->bNeedsTrans = FALSE; /* clear the flag */
970 
973  pImeDpi = ImmLockImeDpi(hKL);
974  if (pImeDpi == NULL)
975  goto Quit;
976 
977  if (!GetKeyboardState(abKeyState)) /* get keyboard ON/OFF status */
978  goto Quit;
979 
980  /* convert a virtual key if IME_PROP_KBD_CHAR_FIRST */
981  vk = pIC->nVKey;
983  {
984  if (ImeDpi_IsUnicode(pImeDpi))
985  {
986  wch = 0;
987  kret = ToUnicode(vk, HIWORD(lKeyData), abKeyState, &wch, 1, 0);
988  if (kret == 1)
989  vk = MAKELONG(LOBYTE(vk), wch);
990  }
991  else
992  {
993  wChar = 0;
994  kret = ToAsciiEx(vk, HIWORD(lKeyData), abKeyState, &wChar, 0, hKL);
995  if (kret > 0)
996  vk = MAKEWORD(vk, wChar);
997  }
998  }
999 
1000  /* allocate a list */
1001  cbList = offsetof(TRANSMSGLIST, TransMsg) + MSG_COUNT * sizeof(TRANSMSG);
1002  pList = ImmLocalAlloc(0, cbList);
1003  if (!pList)
1004  goto Quit;
1005 
1006  /* use IME conversion engine and convert the list */
1007  pList->uMsgCount = MSG_COUNT;
1008  kret = pImeDpi->ImeToAsciiEx(vk, HIWORD(lKeyData), abKeyState, pList, 0, hIMC);
1009  if (kret <= 0)
1010  goto Quit;
1011 
1012  /* post them */
1013  if (kret <= MSG_COUNT)
1014  {
1015  Imm32PostMessages(hwnd, hIMC, kret, pList->TransMsg);
1016  ret = TRUE;
1017  }
1018  else
1019  {
1020  pTransMsg = ImmLockIMCC(pIC->hMsgBuf);
1021  if (pTransMsg == NULL)
1022  goto Quit;
1023  Imm32PostMessages(hwnd, hIMC, kret, pTransMsg);
1024  ImmUnlockIMCC(pIC->hMsgBuf);
1025  }
1026 
1027 Quit:
1029  ImmUnlockImeDpi(pImeDpi);
1030  ImmUnlockIMC(hIMC);
1031  ImmReleaseContext(hwnd, hIMC);
1032  return ret;
1033 #undef MSG_COUNT
1034 }
1035 
1036 /***********************************************************************
1037  * ImmRequestMessageA(IMM32.@)
1038  */
1040 {
1041  TRACE("(%p, %p, %p)\n", hIMC, wParam, lParam);
1042  return ImmRequestMessageAW(hIMC, wParam, lParam, TRUE);
1043 }
1044 
1045 /***********************************************************************
1046  * ImmRequestMessageW(IMM32.@)
1047  */
1049 {
1050  TRACE("(%p, %p, %p)\n", hIMC, wParam, lParam);
1051  return ImmRequestMessageAW(hIMC, wParam, lParam, FALSE);
1052 }
1053 
1054 /***********************************************************************
1055  * ImmSendMessageToActiveDefImeWndW (IMM32.@)
1056  */
1059 {
1060  HWND hwndIME;
1061 
1062  if (uMsg != WM_COPYDATA)
1063  return 0;
1064 
1066  if (!hwndIME)
1067  return 0;
1068 
1069  return SendMessageW(hwndIME, uMsg, wParam, lParam);
1070 }
#define LANGID_JAPANESE
Definition: precomp.h:58
DWORD HIMCC
Definition: dimm.idl:76
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:758
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
struct IMM_UNKNOWN_PROCESS1 * PIMM_UNKNOWN_PROCESS1
#define IME_CHOTKEY_IME_NONIME_TOGGLE
Definition: imm.h:331
#define LANGID_CHINESE_SIMPLIFIED
Definition: precomp.h:56
BOOL WINAPI ImmEnumInputContext(DWORD dwThreadId, IMCENUMPROC lpfn, LPARAM lParam)
Definition: imm.c:1101
#define IME_CMODE_SYMBOL
Definition: imm.h:500
#define WM_IME_NOTIFY
Definition: winuser.h:1817
#define IN
Definition: typedefs.h:39
#define IME_THOTKEY_SHAPE_TOGGLE
Definition: imm.h:344
#define IME_PROP_ACCEPT_WIDE_VKEY
Definition: imm.h:218
IMEINFO ImeInfo
Definition: ntuser.h:1253
LONG WINAPI ImmGetCompositionStringA(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
Definition: compstr.c:850
#define IME_JHOTKEY_CLOSE_OPEN
Definition: imm.h:336
#define CloseHandle
Definition: compat.h:598
#define VK_PROCESSKEY
Definition: winuser.h:2307
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
LRESULT WINAPI ImmSendMessageToActiveDefImeWndW(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: keymsg.c:1058
#define VK_KANJI
Definition: winuser.h:2193
BOOL NTAPI IsBadWritePtr(IN LPVOID lp, IN UINT_PTR ucb)
Definition: except.c:881
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
DWORD APIENTRY Imm32ReconvertAnsiFromWide(LPRECONVERTSTRING pDest, const RECONVERTSTRING *pSrc, UINT uCodePage)
Definition: utils.c:504
BOOL WINAPI IsWindow(_In_opt_ HWND)
DWORD dwSize
Definition: imm.h:97
#define LOBYTE(W)
Definition: jmemdos.c:487
BOOL WINAPI ImmGetOpenStatus(HIMC hIMC)
Definition: ime.c:1144
#define IME_KHOTKEY_SHAPE_TOGGLE
Definition: imm.h:339
struct tagRECONVERTSTRING RECONVERTSTRING
#define MAKEWORD(a, b)
Definition: typedefs.h:248
VOID APIENTRY LogFontAnsiToWide(const LOGFONTA *plfA, LPLOGFONTW plfW)
Definition: utils.c:132
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1023
#define CP_ACP
Definition: compat.h:109
#define IME_PROP_KBD_CHAR_FIRST
Definition: imm.h:214
BOOL APIENTRY Imm32KEnglish(HIMC hIMC)
Definition: keymsg.c:161
static BOOL APIENTRY ImmIsUIMessageAW(HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam, BOOL bAnsi)
Definition: keymsg.c:241
WORD vk
Definition: input.c:77
char CHAR
Definition: xmlstorage.h:175
LPVOID APIENTRY ImmLocalAlloc(DWORD dwFlags, DWORD dwBytes)
Definition: utils.c:234
#define LANGID_CHINESE_TRADITIONAL
Definition: precomp.h:57
#define CALLBACK
Definition: compat.h:35
PSERVERINFO gpsi
Definition: imm.c:17
struct IMM_UNKNOWN_PROCESS1 IMM_UNKNOWN_PROCESS1
BOOL APIENTRY Imm32SendChange(BOOL bProcess)
Definition: keymsg.c:348
HWND hWnd
Definition: settings.c:17
LPVOID WINAPI ImmLockIMCC(HIMCC imcc)
Definition: utils.c:986
DWORD NTAPI NtUserNotifyIMEStatus(HWND hwnd, BOOL fOpen, DWORD dwConversion)
Definition: ime.c:809
HANDLE HWND
Definition: compat.h:19
#define WM_IME_SELECT
Definition: winuser.h:1820
static DWORD WINAPI Imm32UnknownProcess1Proc(LPVOID arg)
Definition: keymsg.c:270
uint32_t * LPUINT
Definition: typedefs.h:59
BOOL APIENTRY Imm32CShapeToggle(HIMC hIMC, HKL hKL, HWND hWnd)
Definition: keymsg.c:47
#define INPUTCONTEXTDX_CHANGE_OPEN
Definition: immdev.h:134
void * arg
Definition: msvc.h:10
UINT_PTR WPARAM
Definition: windef.h:207
WORD LANGID
Definition: typedefs.h:81
#define GetWin32ClientInfo()
Definition: ntuser.h:335
static PTHREADINFO FASTCALL Imm32CurrentPti(VOID)
Definition: precomp.h:162
DWORD fdwConversion
Definition: immdev.h:43
BOOL APIENTRY Imm32ImeNonImeToggle(HIMC hIMC, HKL hKL, HWND hWnd, LANGID LangID)
Definition: keymsg.c:16
DWORD dwChange
Definition: immdev.h:112
BOOL APIENTRY Imm32JCloseOpen(HIMC hIMC, HKL hKL, HWND hWnd)
Definition: keymsg.c:107
BOOL APIENTRY Imm32KShapeToggle(HIMC hIMC)
Definition: keymsg.c:122
BOOL WINAPI ImmTranslateMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lKeyData)
Definition: keymsg.c:916
DWORD dwVersion
Definition: imm.h:98
#define BOOL
Definition: nt_native.h:43
BOOL APIENTRY Imm32ProcessHotKey(HWND hWnd, HIMC hIMC, HKL hKL, DWORD dwHotKeyID)
Definition: keymsg.c:183
BOOL WINAPI ImmSetConversionStatus(HIMC hIMC, DWORD fdwConversion, DWORD fdwSentence)
Definition: ime.c:1627
#define WM_IME_COMPOSITIONFULL
Definition: winuser.h:1819
int32_t INT
Definition: typedefs.h:58
DWORD APIENTRY Imm32ReconvertWideFromAnsi(LPRECONVERTSTRING pDest, const RECONVERTSTRING *pSrc, UINT uCodePage)
Definition: utils.c:448
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI ImmGetHotKey(IN DWORD dwHotKey, OUT LPUINT lpuModifiers, OUT LPUINT lpuVKey, OUT LPHKL lphKL)
Definition: keymsg.c:608
#define SMTO_ABORTIFHUNG
Definition: winuser.h:1213
LRESULT APIENTRY Imm32UnknownProcess1(HWND hWnd, BOOL fFlag)
Definition: keymsg.c:289
#define IPHK_PROCESSBYIME
Definition: undocuser.h:139
DWORD_PTR NTAPI NtUserQueryWindow(HWND hWnd, DWORD Index)
Definition: window.c:4172
#define CLIENTIMC_WIDE
Definition: ntuser.h:1325
#define IMR_COMPOSITIONFONT
Definition: imm.h:540
#define IMN_SETOPENSTATUS
Definition: imm.h:528
#define LANG_JAPANESE
Definition: nls.h:76
#define FALSE
Definition: types.h:117
#define IME_CMODE_NATIVE
Definition: imm.h:485
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI ImmSetOpenStatus(HIMC hIMC, BOOL fOpen)
Definition: ime.c:1167
FxChildList * pList
#define CPS_COMPLETE
Definition: imm.h:312
BOOL bNeedsTrans
Definition: immdev.h:107
BOOL WINAPI ImmIsUIMessageA(HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: keymsg.c:589
UINT nVKey
Definition: immdev.h:106
#define FIXME(fmt,...)
Definition: debug.h:111
BOOL APIENTRY Imm32CSymbolToggle(HIMC hIMC, HKL hKL, HWND hWnd)
Definition: keymsg.c:77
#define IMR_QUERYCHARPOSITION
Definition: imm.h:543
THRDESKHEAD head
Definition: ntuser.h:674
#define MAKELONG(a, b)
Definition: typedefs.h:249
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
#define IMN_SETSENTENCEMODE
Definition: imm.h:527
#define offsetof(TYPE, MEMBER)
#define _WIN32_WINNT_NT4
Definition: sdkddkver.h:20
#define WM_KEYDOWN
Definition: winuser.h:1702
LONG_PTR LPARAM
Definition: windef.h:208
LCID WINAPI GetSystemDefaultLCID(void)
Definition: lang.c:791
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1203
PCLIENTIMC WINAPI ImmLockClientImc(HIMC hImc)
Definition: imm.c:909
DWORD WINAPI ImmProcessKey(HWND hWnd, HKL hKL, UINT vKey, LPARAM lParam, DWORD dwHotKeyID)
Definition: keymsg.c:675
#define IMR_RECONVERTSTRING
Definition: imm.h:541
#define IME_ESC_PRIVATE_HOTKEY
Definition: imm.h:571
#define WM_IME_REQUEST
Definition: winuser.h:1823
#define WM_IME_SYSTEM
Definition: undocuser.h:59
DWORD HIMC
Definition: dimm.idl:75
UINT uCodePage
Definition: ntuser.h:1308
#define QUERY_WINDOW_DEFAULT_IME
Definition: ntuser.h:2926
#define IMR_CONFIRMRECONVERTSTRING
Definition: imm.h:542
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
DWORD NTAPI NtUserGetAppImeLevel(HWND hWnd)
Definition: ime.c:927
#define WM_COPYDATA
Definition: winuser.h:1651
UINT WINAPI ImmGetVirtualKey(HWND hWnd)
Definition: keymsg.c:650
BOOL WINAPI ImmNotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
Definition: ime.c:652
#define TRACE(s)
Definition: solgame.cpp:4
struct _tagCOMPOSITIONFORM COMPOSITIONFORM
LRESULT APIENTRY Imm32ProcessRequest(HIMC hIMC, PWND pWnd, DWORD dwCommand, LPVOID pData, BOOL bAnsiAPI)
Definition: keymsg.c:360
LONG WINAPI ImmGetCompositionStringW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
Definition: compstr.c:892
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IME_KHOTKEY_HANJACONVERT
Definition: imm.h:340
struct tagLOGFONTW LOGFONTW
#define IME_CMODE_FULLSHAPE
Definition: imm.h:493
#define IME_THOTKEY_IME_NONIME_TOGGLE
Definition: imm.h:343
DWORD fdwProperty
Definition: imm.h:158
#define WM_IME_SETCONTEXT
Definition: winuser.h:1816
HIMC WINAPI ImmGetContext(HWND hWnd)
Definition: imm.c:1010
#define ValidateHwndNoErr(hwnd)
Definition: precomp.h:84
PIMEDPI WINAPI ImmLockImeDpi(HKL hKL)
Definition: ime.c:729
#define NI_COMPOSITIONSTR
Definition: imm.h:298
#define WINAPI
Definition: msvc.h:6
#define WM_KEYUP
Definition: winuser.h:1703
struct INPUTCONTEXTDX * LPINPUTCONTEXTDX
unsigned short WORD
Definition: ntddk_ex.h:93
VOID APIENTRY LogFontWideToAnsi(const LOGFONTW *plfW, LPLOGFONTA plfA)
Definition: utils.c:145
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WNDS2_WMCREATEMSGPROCESSED
Definition: ntuser.h:653
struct _tagTRANSMSG TRANSMSG
#define SetLastError(x)
Definition: compat.h:611
#define ImeDpi_IsUnicode(pImeDpi)
Definition: precomp.h:116
_Check_return_ BOOL WINAPI GetKeyboardState(_Out_writes_(256) PBYTE lpKeyState)
static BOOL Imm32IsCrossThreadAccess(HIMC hIMC)
Definition: precomp.h:100
#define IME_HOTKEY_PRIVATE_FIRST
Definition: imm.h:352
DWORD dwCharPos
Definition: imm.h:141
#define MSG_COUNT
#define IME_CHOTKEY_SHAPE_TOGGLE
Definition: imm.h:332
#define ImmLocalFree(lpData)
Definition: precomp.h:89
BOOL WINAPI ImmUnlockIMCC(HIMCC imcc)
Definition: utils.c:996
int ret
DWORD dwThreadId
Definition: fdebug.c:31
#define IME_HOTKEY_PRIVATE_LAST
Definition: imm.h:357
HIMCC hMsgBuf
Definition: immdev.h:56
#define IME_CHOTKEY_SYMBOL_TOGGLE
Definition: imm.h:333
LONG APIENTRY IchWideFromAnsi(LONG cchAnsi, LPCSTR pchAnsi, UINT uCodePage)
Definition: utils.c:89
#define LANGIDFROMLCID(l)
Definition: nls.h:18
BOOL WINAPI ImmGenerateMessage(HIMC hIMC)
Definition: keymsg.c:779
struct tagCANDIDATEFORM CANDIDATEFORM
LONG APIENTRY IchAnsiFromWide(LONG cchWide, LPCWSTR pchWide, UINT uCodePage)
Definition: utils.c:109
UINT_PTR HKL
Definition: msctf.idl:101
uint32_t DWORD_PTR
Definition: typedefs.h:65
LRESULT APIENTRY ImmRequestMessageAW(HIMC hIMC, WPARAM wParam, LPARAM lParam, BOOL bAnsi)
Definition: keymsg.c:561
#define IME_THOTKEY_SYMBOL_TOGGLE
Definition: imm.h:345
unsigned char BYTE
Definition: xxhash.c:193
int WINAPI ToAsciiEx(_In_ UINT, _In_ UINT, _In_reads_opt_(256) CONST BYTE *, _Out_ LPWORD, _In_ UINT, _In_opt_ HKL)
BOOL WINAPI ImmIsIME(HKL hKL)
Definition: ime.c:628
#define IME_CMODE_HANJACONVERT
Definition: imm.h:496
BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC)
Definition: imm.c:1051
LRESULT WINAPI ImmSystemHandler(HIMC hIMC, WPARAM wParam, LPARAM lParam)
Definition: keymsg.c:754
#define IMR_DOCUMENTFEED
Definition: imm.h:544
Definition: ntuser.h:672
#define INPUTCONTEXTDX_CHANGE_SENTENCE
Definition: immdev.h:136
BOOL NTAPI NtUserGetImeHotKey(DWORD dwHotKeyId, LPUINT lpuModifiers, LPUINT lpuVirtualKey, LPHKL lphKL)
Definition: ime.c:416
HWND WINAPI ImmGetDefaultIMEWnd(HWND hWnd)
Definition: ime.c:638
LRESULT WINAPI ImmRequestMessageW(HIMC hIMC, WPARAM wParam, LPARAM lParam)
Definition: keymsg.c:1048
#define WM_SYSKEYUP
Definition: winuser.h:1707
#define IPHK_SKIPTHISKEY
Definition: undocuser.h:141
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IMN_SETCONVERSIONMODE
Definition: imm.h:526
#define WNDS_ANSIWINDOWPROC
Definition: ntuser.h:607
PKEYBOARD_LAYOUT GetKeyboardLayout()
Definition: utils.c:194
DWORD state
Definition: ntuser.h:680
DWORD dwNumMsgBuf
Definition: immdev.h:55
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
VOID APIENTRY Imm32PostMessages(HWND hwnd, HIMC hIMC, DWORD dwCount, LPTRANSMSG lpTransMsg)
Definition: keymsg.c:857
DWORD fdwSentence
Definition: immdev.h:44
static BOOL CALLBACK Imm32SendChangeProc(HIMC hIMC, LPARAM lParam)
Definition: keymsg.c:321
int WINAPI ToUnicode(_In_ UINT wVirtKey, _In_ UINT wScanCode, _In_reads_bytes_opt_(256) CONST BYTE *lpKeyState, _Out_writes_(cchBuff) LPWSTR pwszBuff, _In_ int cchBuff, _In_ UINT wFlags)
BOOL WINAPI ImmIsUIMessageW(HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: keymsg.c:598
HANDLE hThread
Definition: wizard.c:28
LRESULT WINAPI SendMessageTimeoutW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM, _In_ UINT, _In_ UINT, _Out_opt_ PDWORD_PTR)
#define IME_KHOTKEY_ENGLISH
Definition: imm.h:341
#define IPHK_HOTKEY
Definition: undocuser.h:138
DWORD dwFlags
Definition: ntuser.h:1305
BOOL WINAPI ImmSimulateHotKey(HWND hWnd, DWORD dwHotKeyID)
Definition: keymsg.c:630
#define msg(x)
Definition: auth_time.c:54
UINT WINAPI ImmWINNLSGetIMEHotkey(HWND hwndIme)
Definition: keymsg.c:620
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define OUT
Definition: typedefs.h:40
#define WM_SYSKEYDOWN
Definition: winuser.h:1706
VOID APIENTRY Imm32RequestError(DWORD dwError)
Definition: keymsg.c:353
#define HIWORD(l)
Definition: typedefs.h:247
DWORD state2
Definition: ntuser.h:681
LRESULT WINAPI ImmRequestMessageA(HIMC hIMC, WPARAM wParam, LPARAM lParam)
Definition: keymsg.c:1039
#define INPUTCONTEXTDX_CHANGE_CONVERSION
Definition: immdev.h:135
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define LANG_KOREAN
Definition: nls.h:84
#define INVALID_HOTKEY_ID
Definition: precomp.h:52
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
LONG_PTR LRESULT
Definition: windef.h:209
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
WINE_DEFAULT_DEBUG_CHANNEL(imm)
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT _In_ UCHAR _In_opt_ USHORT LangID
Definition: wdfusb.h:1075
struct tagIMECHARPOSITION IMECHARPOSITION
#define GCS_COMPSTR
Definition: imm.h:367
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1032
LPARAM lParam
Definition: combotst.c:139
#define SMTO_BLOCK
Definition: winuser.h:1214
#define LOWORD(l)
Definition: pedump.c:82
#define APIENTRY
Definition: api.h:79
BOOL APIENTRY Imm32KHanjaConvert(HIMC hIMC)
Definition: keymsg.c:144
#define ValidateHwnd(hwnd)
Definition: precomp.h:85
#define PRIMARYLANGID(l)
Definition: nls.h:16
VOID WINAPI ImmUnlockClientImc(PCLIENTIMC pClientImc)
Definition: imm.c:954