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