ReactOS 0.4.16-dev-117-g38f21f9
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#include <jpnvkeys.h>
14
16
17/* Win: IMENonIMEToggle */
19{
20 HKL hOldKL, LayoutList[32], hFoundKL = NULL;
21 UINT iLayout, nLayoutCount;
22
23 /* Get the previous layout */
25
26 /* Get the layout list */
27 nLayoutCount = GetKeyboardLayoutList(_countof(LayoutList), LayoutList);
28
29 /* Is there hOldKL in the list in the specified language ID? */
30 if (hOldKL && (LangID == 0 || LOWORD(hOldKL) == LangID))
31 {
32 for (iLayout = 0; iLayout < nLayoutCount; ++iLayout)
33 {
34 if (LayoutList[iLayout] == hOldKL)
35 {
36 hFoundKL = hOldKL;
37 break;
38 }
39 }
40 }
41
42 if (hFoundKL == NULL) /* Not found? */
43 {
44 /* Is there the keyboard layout of another kind in LangID? */
45 for (iLayout = 0; iLayout < nLayoutCount; ++iLayout)
46 {
47 if (bNowIME == ImmIsIME(LayoutList[iLayout])) /* Same kind? */
48 continue;
49
50 if (LangID == 0 || LangID == LOWORD(LayoutList[iLayout]))
51 {
52 hFoundKL = LayoutList[iLayout];
53 break;
54 }
55 }
56 }
57
58 if (hFoundKL && hKL != hFoundKL) /* Found and different layout */
59 {
60 PostMessageW(hWnd, WM_INPUTLANGCHANGEREQUEST, 1, (LPARAM)hFoundKL);
61 }
62
63 return ImmIsIME(hFoundKL);
64}
65
66/* Open or close the IME on Chinese or Taiwanese */
67/* Win: CIMENonIMEToggle */
69{
71 BOOL fOpen;
72
74 return FALSE;
75
76 if (LOWORD(hKL) != LangID || !ImmIsIME(hKL))
77 {
79 return TRUE;
80 }
81
82 pIC = ImmLockIMC(hIMC);
83 if (IS_NULL_UNEXPECTEDLY(pIC))
84 return TRUE;
85
86 fOpen = pIC->fOpen;
87 ImmUnlockIMC(hIMC);
88
89 if (fOpen)
90 Imm32ImeNonImeToggle(hIMC, hKL, hWnd, TRUE, 0);
91 else
93
94 return TRUE;
95}
96
97/* Toggle shape mode on Chinese or Taiwanese */
98/* Win: TShapeToggle */
100{
101 LPINPUTCONTEXT pIC;
102 BOOL fOpen;
103 DWORD dwConversion, dwSentence;
104
105 if (hWnd == NULL || !ImmIsIME(hKL))
106 return FALSE;
107
108 pIC = ImmLockIMC(hIMC);
109 if (IS_NULL_UNEXPECTEDLY(pIC))
110 return TRUE;
111
112 fOpen = pIC->fOpen;
113 if (fOpen)
114 {
115 dwConversion = (pIC->fdwConversion ^ IME_CMODE_FULLSHAPE);
116 dwSentence = pIC->fdwSentence;
117 }
118
119 ImmUnlockIMC(hIMC);
120
121 if (fOpen)
122 ImmSetConversionStatus(hIMC, dwConversion, dwSentence);
123 else
124 ImmSetOpenStatus(hIMC, TRUE);
125
126 return TRUE;
127}
128
129/* Win: CSymbolToggle */
131{
132 LPINPUTCONTEXT pIC;
133 BOOL fOpen;
134 DWORD dwConversion, dwSentence;
135
136 if (hWnd == NULL || !ImmIsIME(hKL))
137 return FALSE;
138
139 pIC = ImmLockIMC(hIMC);
140 if (IS_NULL_UNEXPECTEDLY(pIC))
141 return TRUE;
142
143 fOpen = pIC->fOpen;
144 if (fOpen)
145 {
146 dwConversion = (pIC->fdwConversion ^ IME_CMODE_SYMBOL);
147 dwSentence = pIC->fdwSentence;
148 }
149
150 ImmUnlockIMC(hIMC);
151
152 if (fOpen)
153 ImmSetConversionStatus(hIMC, dwConversion, dwSentence);
154 else
155 ImmSetOpenStatus(hIMC, TRUE);
156
157 return TRUE;
158}
159
160/* Open or close Japanese IME */
162{
163 BOOL fOpen;
165
166 if (LOWORD(hKL) == LANGID_JAPANESE && ImmIsIME(hKL)) /* Japanese IME is selected */
167 {
168 fOpen = ImmGetOpenStatus(hIMC);
169 ImmSetOpenStatus(hIMC, !fOpen);
170 return TRUE;
171 }
172
173 /* Japanese IME is not selected. Select now */
175 {
176 pIC = (LPINPUTCONTEXTDX)ImmLockIMC(hIMC);
177 if (pIC)
178 {
180 ImmUnlockIMC(hIMC);
181 }
182 }
183
184 return TRUE;
185}
186
187/* Win: KShapeToggle */
189{
190 LPINPUTCONTEXT pIC;
191 DWORD dwConversion, dwSentence;
192
193 pIC = ImmLockIMC(hIMC);
194 if (IS_NULL_UNEXPECTEDLY(pIC))
195 return FALSE;
196
197 dwConversion = (pIC->fdwConversion ^ IME_CMODE_FULLSHAPE);
198 dwSentence = pIC->fdwSentence;
199 ImmSetConversionStatus(hIMC, dwConversion, dwSentence);
200
202 ImmSetOpenStatus(hIMC, TRUE);
203 else
204 ImmSetOpenStatus(hIMC, FALSE);
205
206 ImmUnlockIMC(hIMC);
207 return TRUE;
208}
209
210/* Win: KHanjaConvert */
212{
213 LPINPUTCONTEXT pIC;
214 DWORD dwConversion, dwSentence;
215
216 pIC = ImmLockIMC(hIMC);
217 if (IS_NULL_UNEXPECTEDLY(pIC))
218 return FALSE;
219
220 dwConversion = (pIC->fdwConversion ^ IME_CMODE_HANJACONVERT);
221 dwSentence = pIC->fdwSentence;
222 ImmUnlockIMC(hIMC);
223
224 ImmSetConversionStatus(hIMC, dwConversion, dwSentence);
225 return TRUE;
226}
227
228/* Win: KEnglishHangul */
230{
231 LPINPUTCONTEXT pIC;
232 DWORD dwConversion, dwSentence;
233 BOOL fOpen;
234
235 pIC = ImmLockIMC(hIMC);
236 if (IS_NULL_UNEXPECTEDLY(pIC))
237 return FALSE;
238
239 dwConversion = (pIC->fdwConversion ^ IME_CMODE_NATIVE);
240 dwSentence = pIC->fdwSentence;
241 ImmSetConversionStatus(hIMC, dwConversion, dwSentence);
242
243 fOpen = ((pIC->fdwConversion & (IME_CMODE_FULLSHAPE | IME_CMODE_NATIVE)) != 0);
244 ImmSetOpenStatus(hIMC, fOpen);
245
246 ImmUnlockIMC(hIMC);
247 return TRUE;
248}
249
250/* Win: HotKeyIDDispatcher */
252{
253 PIMEDPI pImeDpi;
254 BOOL ret;
255
256 if (hIMC && IS_CROSS_THREAD_HIMC(hIMC))
257 return FALSE;
258
259 switch (dwHotKeyID)
260 {
263
265 return Imm32CShapeToggle(hIMC, hKL, hWnd);
266
268 return Imm32CSymbolToggle(hIMC, hKL, hWnd);
269
271 return Imm32JCloseOpen(hIMC, hKL, hWnd);
272
274 return Imm32KShapeToggle(hIMC);
275
277 return Imm32KHanjaConvert(hIMC);
278
280 return Imm32KEnglish(hIMC);
281
284
286 return Imm32CShapeToggle(hIMC, hKL, hWnd);
287
289 return Imm32CSymbolToggle(hIMC, hKL, hWnd);
290
291 default:
292 WARN("0x%X\n", dwHotKeyID);
293 break;
294 }
295
296 if (dwHotKeyID < IME_HOTKEY_PRIVATE_FIRST || IME_HOTKEY_PRIVATE_LAST < dwHotKeyID)
297 return FALSE;
298
299 pImeDpi = ImmLockImeDpi(hKL);
300 if (IS_NULL_UNEXPECTEDLY(pImeDpi))
301 return FALSE;
302
303 ret = (BOOL)pImeDpi->ImeEscape(hIMC, IME_ESC_PRIVATE_HOTKEY, &dwHotKeyID);
304 ImmUnlockImeDpi(pImeDpi);
305 return ret;
306}
307
308/* Win: ImmIsUIMessageWorker */
309static BOOL APIENTRY
311{
312 switch (msg)
313 {
314 case WM_IME_STARTCOMPOSITION: case WM_IME_ENDCOMPOSITION:
315 case WM_IME_COMPOSITION: case WM_IME_SETCONTEXT: case WM_IME_NOTIFY:
317 break;
318 default:
319 return FALSE;
320 }
321
322 if (IS_NULL_UNEXPECTEDLY(hWndIME))
323 return TRUE;
324
325 if (bAnsi)
326 SendMessageA(hWndIME, msg, wParam, lParam);
327 else
328 SendMessageW(hWndIME, msg, wParam, lParam);
329
330 return TRUE;
331}
332
333static BOOL CALLBACK
335 _In_ HIMC hIMC,
337{
338 HWND hWnd;
340
342
343 pIC = (LPINPUTCONTEXTDX)ImmLockIMC(hIMC);
344 if (IS_NULL_UNEXPECTEDLY(pIC))
345 return TRUE;
346
347 hWnd = pIC->hWnd;
348 if (!IsWindow(hWnd))
349 goto Quit;
350
351 TRACE("dwChange: 0x%08X\n", pIC->dwChange);
352
358 NtUserNotifyIMEStatus(hWnd, pIC->fOpen, pIC->fdwConversion);
361Quit:
362 pIC->dwChange = 0;
363 ImmUnlockIMC(hIMC); // ??? Windows doesn't unlock here
364 return TRUE;
365}
366
368{
369 return ImmEnumInputContext((bProcess ? -1 : 0), Imm32SendNotificationProc, 0);
370}
371
373Imm32ProcessRequest(HIMC hIMC, PWND pWnd, DWORD dwCommand, LPVOID pData, BOOL bAnsiAPI)
374{
375 HWND hWnd;
376 DWORD ret = 0, dwCharPos, cchCompStr, dwSize;
377 LPVOID pCS, pTempData = pData;
378 LPRECONVERTSTRING pRS;
379 LPIMECHARPOSITION pICP;
380 PCLIENTIMC pClientImc;
381 UINT uCodePage = CP_ACP;
382 BOOL bAnsiWnd = !!(pWnd->state & WNDS_ANSIWINDOWPROC);
383 static const size_t acbData[7 * 2] =
384 {
385 /* UNICODE */
386 sizeof(COMPOSITIONFORM), sizeof(CANDIDATEFORM), sizeof(LOGFONTW),
387 sizeof(RECONVERTSTRING), sizeof(RECONVERTSTRING),
388 sizeof(IMECHARPOSITION), sizeof(RECONVERTSTRING),
389 /* ANSI */
390 sizeof(COMPOSITIONFORM), sizeof(CANDIDATEFORM), sizeof(LOGFONTA),
391 sizeof(RECONVERTSTRING), sizeof(RECONVERTSTRING),
392 sizeof(IMECHARPOSITION), sizeof(RECONVERTSTRING),
393 };
394
395 if (dwCommand == 0 || dwCommand > IMR_DOCUMENTFEED)
396 {
397 ERR("Out of boundary\n");
398 return 0; /* Out of range */
399 }
400
401 dwSize = acbData[bAnsiAPI * 7 + dwCommand - 1];
403 {
404 ERR("\n");
405 return 0; /* Invalid pointer */
406 }
407
408 /* Sanity check */
409 switch (dwCommand)
410 {
411 case IMR_RECONVERTSTRING: case IMR_DOCUMENTFEED:
412 pRS = pData;
413 if (pRS && (pRS->dwVersion != 0 || pRS->dwSize < sizeof(RECONVERTSTRING)))
414 {
415 ERR("Invalid pRS\n");
416 return 0;
417 }
418 break;
419
420 case IMR_CONFIRMRECONVERTSTRING:
421 pRS = pData;
422 if (!pRS || pRS->dwVersion != 0)
423 {
424 ERR("Invalid pRS\n");
425 return 0;
426 }
427 break;
428
429 default:
431 return 0;
432 break;
433 }
434
435 pClientImc = ImmLockClientImc(hIMC);
436 if (pClientImc)
437 {
438 uCodePage = pClientImc->uCodePage;
439 ImmUnlockClientImc(pClientImc);
440 }
441
442 /* Prepare */
443 switch (dwCommand)
444 {
445 case IMR_COMPOSITIONFONT:
446 if (bAnsiAPI == bAnsiWnd)
447 goto DoIt; /* No conversion needed */
448
449 if (bAnsiWnd)
450 pTempData = ImmLocalAlloc(0, sizeof(LOGFONTA));
451 else
452 pTempData = ImmLocalAlloc(0, sizeof(LOGFONTW));
453
454 if (IS_NULL_UNEXPECTEDLY(pTempData))
455 return 0;
456 break;
457
458 case IMR_RECONVERTSTRING: case IMR_CONFIRMRECONVERTSTRING: case IMR_DOCUMENTFEED:
459 if (bAnsiAPI == bAnsiWnd || !pData)
460 goto DoIt; /* No conversion needed */
461
462 if (bAnsiWnd)
464 else
466
467 pTempData = ImmLocalAlloc(0, ret + sizeof(WCHAR));
468 if (IS_NULL_UNEXPECTEDLY(pTempData))
469 return 0;
470
471 pRS = pTempData;
472 pRS->dwSize = ret;
473 pRS->dwVersion = 0;
474
475 if (dwCommand == IMR_CONFIRMRECONVERTSTRING)
476 {
477 if (bAnsiWnd)
478 ret = Imm32ReconvertAnsiFromWide(pTempData, pData, uCodePage);
479 else
480 ret = Imm32ReconvertWideFromAnsi(pTempData, pData, uCodePage);
481 }
482 break;
483
484 case IMR_QUERYCHARPOSITION:
485 if (bAnsiAPI == bAnsiWnd)
486 goto DoIt; /* No conversion needed */
487
488 pICP = pData;
489 dwCharPos = pICP->dwCharPos;
490
491 if (bAnsiAPI)
492 {
493 cchCompStr = ImmGetCompositionStringA(hIMC, GCS_COMPSTR, NULL, 0);
494 if (IS_ZERO_UNEXPECTEDLY(cchCompStr))
495 return 0;
496
497 pCS = ImmLocalAlloc(0, (cchCompStr + 1) * sizeof(CHAR));
498 if (IS_NULL_UNEXPECTEDLY(pCS))
499 return 0;
500
501 ImmGetCompositionStringA(hIMC, GCS_COMPSTR, pCS, cchCompStr);
502 pICP->dwCharPos = IchWideFromAnsi(pICP->dwCharPos, pCS, uCodePage);
503 }
504 else
505 {
506 cchCompStr = ImmGetCompositionStringW(hIMC, GCS_COMPSTR, NULL, 0);
507 if (IS_ZERO_UNEXPECTEDLY(cchCompStr))
508 return 0;
509
510 pCS = ImmLocalAlloc(0, (cchCompStr + 1) * sizeof(WCHAR));
511 if (IS_NULL_UNEXPECTEDLY(pCS))
512 return 0;
513
514 ImmGetCompositionStringW(hIMC, GCS_COMPSTR, pCS, cchCompStr);
515 pICP->dwCharPos = IchAnsiFromWide(pICP->dwCharPos, pCS, uCodePage);
516 }
517
518 ImmLocalFree(pCS);
519 break;
520
521 default:
522 WARN("0x%X\n", dwCommand);
523 break;
524 }
525
526DoIt:
527 /* The main task */
528 hWnd = pWnd->head.h;
529 if (bAnsiWnd)
530 ret = SendMessageA(hWnd, WM_IME_REQUEST, dwCommand, (LPARAM)pTempData);
531 else
532 ret = SendMessageW(hWnd, WM_IME_REQUEST, dwCommand, (LPARAM)pTempData);
533
534 if (bAnsiAPI == bAnsiWnd)
535 goto Quit; /* No conversion needed */
536
537 /* Get back to caller */
538 switch (dwCommand)
539 {
540 case IMR_COMPOSITIONFONT:
541 if (bAnsiAPI)
542 LogFontWideToAnsi(pTempData, pData);
543 else
544 LogFontAnsiToWide(pTempData, pData);
545 break;
546
547 case IMR_RECONVERTSTRING: case IMR_DOCUMENTFEED:
548 if (!ret)
549 break;
550
551 if (ret < sizeof(RECONVERTSTRING))
552 {
553 ret = 0;
554 break;
555 }
556
557 if (pTempData)
558 {
559 if (bAnsiWnd)
560 ret = Imm32ReconvertWideFromAnsi(pData, pTempData, uCodePage);
561 else
562 ret = Imm32ReconvertAnsiFromWide(pData, pTempData, uCodePage);
563 }
564 break;
565
566 case IMR_QUERYCHARPOSITION:
567 pICP->dwCharPos = dwCharPos;
568 break;
569
570 default:
571 WARN("0x%X\n", dwCommand);
572 break;
573 }
574
575Quit:
576 if (pTempData != pData)
577 ImmLocalFree(pTempData);
578 return ret;
579}
580
581/* Win: ImmRequestMessageWorker */
583{
584 LRESULT ret = 0;
585 LPINPUTCONTEXT pIC;
586 HWND hWnd;
587 PWND pWnd = NULL;
588
590 return FALSE;
591
592 pIC = ImmLockIMC(hIMC);
593 if (IS_NULL_UNEXPECTEDLY(pIC))
594 return FALSE;
595
596 hWnd = pIC->hWnd;
597 if (hWnd)
598 pWnd = ValidateHwnd(hWnd);
599
600 if (pWnd && pWnd->head.pti == Imm32CurrentPti())
601 ret = Imm32ProcessRequest(hIMC, pWnd, (DWORD)wParam, (LPVOID)lParam, bAnsi);
602
603 ImmUnlockIMC(hIMC);
604 return ret;
605}
606
607/***********************************************************************
608 * ImmIsUIMessageA (IMM32.@)
609 */
611{
612 TRACE("(%p, 0x%X, %p, %p)\n", hWndIME, msg, wParam, lParam);
613 return ImmIsUIMessageAW(hWndIME, msg, wParam, lParam, TRUE);
614}
615
616/***********************************************************************
617 * ImmIsUIMessageW (IMM32.@)
618 */
620{
621 TRACE("(%p, 0x%X, %p, %p)\n", hWndIME, msg, wParam, lParam);
622 return ImmIsUIMessageAW(hWndIME, msg, wParam, lParam, FALSE);
623}
624
625/***********************************************************************
626 * ImmGetHotKey(IMM32.@)
627 */
629ImmGetHotKey(IN DWORD dwHotKey, OUT LPUINT lpuModifiers, OUT LPUINT lpuVKey,
630 OUT LPHKL lphKL)
631{
632 TRACE("(0x%lX, %p, %p, %p)\n", dwHotKey, lpuModifiers, lpuVKey, lphKL);
633 if (lpuModifiers && lpuVKey)
634 return NtUserGetImeHotKey(dwHotKey, lpuModifiers, lpuVKey, lphKL);
635 return FALSE;
636}
637
638/***********************************************************************
639 * ImmWINNLSGetIMEHotkey (IMM32.@)
640 */
642{
643 TRACE("(%p)\n", hwndIme);
644 UNREFERENCED_PARAMETER(hwndIme);
645 return 0; /* This is correct. This function of Windows just returns zero. */
646}
647
648/***********************************************************************
649 * ImmSimulateHotKey (IMM32.@)
650 */
652{
653 HIMC hIMC;
655 HKL hKL;
656 BOOL ret;
657
658 TRACE("(%p, 0x%lX)\n", hWnd, dwHotKeyID);
659
660 hIMC = ImmGetContext(hWnd);
663 ret = Imm32ProcessHotKey(hWnd, hIMC, hKL, dwHotKeyID);
664 ImmReleaseContext(hWnd, hIMC);
665 return ret;
666}
667
668/***********************************************************************
669 * ImmGetVirtualKey (IMM32.@)
670 */
672{
673 HIMC hIMC;
676
677 TRACE("(%p)\n", hWnd);
678
679 hIMC = ImmGetContext(hWnd);
680 pIC = (LPINPUTCONTEXTDX)ImmLockIMC(hIMC);
681 if (IS_NULL_UNEXPECTEDLY(pIC))
682 return ret;
683
684 if (pIC->bNeedsTrans)
685 ret = pIC->nVKey;
686
687 ImmUnlockIMC(hIMC);
688 return ret;
689}
690
691/***********************************************************************
692 * ImmGetAppCompatFlags (IMM32.@)
693 */
695{
696 PCLIENTIMC pClientIMC;
698
699 TRACE("(%p)\n", hIMC);
700
701 pClientIMC = ImmLockClientImc(hIMC);
702 if (IS_NULL_UNEXPECTEDLY(pClientIMC))
703 return 0;
704
705 dwFlags = pClientIMC->dwCompatFlags;
706 ImmUnlockClientImc(pClientIMC);
707 return (dwFlags | g_aimm_compat_flags);
708}
709
710/***********************************************************************
711 * ImmProcessKey(IMM32.@)
712 * ( Undocumented, called from user32.dll )
713 */
716{
717 DWORD ret = 0;
718 HIMC hIMC;
719 PIMEDPI pImeDpi;
721 BYTE KeyState[256];
722 BOOL bLowWordOnly = FALSE, bSkipThisKey = FALSE, bHotKeyDone = TRUE;
723
724 TRACE("(%p, %p, 0x%X, %p, 0x%lX)\n", hWnd, hKL, vKey, lParam, dwHotKeyID);
725
726 /* Process the key by the IME */
727 hIMC = ImmGetContext(hWnd);
728 pImeDpi = ImmLockImeDpi(hKL);
729 if (pImeDpi)
730 {
731 pIC = (LPINPUTCONTEXTDX)ImmLockIMC(hIMC);
732 if (pIC)
733 {
734 if ((LOBYTE(vKey) == VK_PACKET) &&
736 {
737 if (ImeDpi_IsUnicode(pImeDpi))
738 {
739 bLowWordOnly = TRUE;
740 }
741 else
742 {
743 if (pIC->fOpen)
745
746 bSkipThisKey = TRUE;
747 }
748 }
749
750 if (!bSkipThisKey && GetKeyboardState(KeyState))
751 {
752 UINT vk = (bLowWordOnly ? LOWORD(vKey) : vKey);
753 if (pImeDpi->ImeProcessKey(hIMC, vk, lParam, KeyState))
754 {
755 pIC->bNeedsTrans = TRUE;
756 pIC->nVKey = vKey;
758 }
759 }
760
761 ImmUnlockIMC(hIMC);
762 }
763
764 ImmUnlockImeDpi(pImeDpi);
765 }
766
767 /* Process the hot-key if necessary */
768 if (!CtfImmIsCiceroStartedInThread()) /* Not Cicero? */
769 {
770 /* Process IMM IME hotkey */
771 if ((dwHotKeyID == INVALID_HOTKEY_ID) || !Imm32ProcessHotKey(hWnd, hIMC, hKL, dwHotKeyID))
772 bHotKeyDone = FALSE;
773 }
774 else if (!CtfImeProcessCicHotkey(hIMC, vKey, lParam)) /* CTF IME not processed the hotkey? */
775 {
776 /* Process IMM IME hotkey */
777 if (!IS_IME_HKL(hKL) ||
778 ((dwHotKeyID == INVALID_HOTKEY_ID) || !Imm32ProcessHotKey(hWnd, hIMC, hKL, dwHotKeyID)))
779 {
780 bHotKeyDone = FALSE;
781 }
782 }
783
784 if (bHotKeyDone && ((vKey != VK_KANJI) || (dwHotKeyID != IME_JHOTKEY_CLOSE_OPEN)))
785 ret |= IPHK_HOTKEY;
786
787 if ((ret & IPHK_PROCESSBYIME) && (ImmGetAppCompatFlags(hIMC) & 0x10000))
788 {
789 /* The key has been processed by IME's ImeProcessKey */
791 if ((PRIMARYLANGID(wLangID) == LANG_KOREAN) &&
792 ((vKey == VK_PROCESSKEY) || (ret & IPHK_HOTKEY)))
793 {
794 /* Korean don't want VK_PROCESSKEY and IME hot-keys */
795 }
796 else
797 {
798 /* Add WM_KEYDOWN:VK_PROCESSKEY message */
800
801 ret &= ~IPHK_PROCESSBYIME;
803 }
804 }
805
806 ImmReleaseContext(hWnd, hIMC);
807 return ret; /* Returns IPHK_... flags */
808}
809
810/***********************************************************************
811 * ImmSystemHandler(IMM32.@)
812 */
814{
815 TRACE("(%p, %p, %p)\n", hIMC, wParam, lParam);
816
817 switch (wParam)
818 {
821 return 0;
822
825 return 0;
826
827 case IMS_SETLANGBAND:
830
831 default:
832 WARN("%p\n", wParam);
833 return 0;
834 }
835}
836
837/***********************************************************************
838 * ImmGenerateMessage(IMM32.@)
839 */
841{
842 PCLIENTIMC pClientImc;
843 LPINPUTCONTEXT pIC;
844 LPTRANSMSG pMsgs, pTrans = NULL, pItem;
845 HWND hWnd;
846 DWORD dwIndex, dwCount, cbTrans;
847 HIMCC hMsgBuf = NULL;
848 BOOL bAnsi;
849
850 TRACE("(%p)\n", hIMC);
851
852 if (IS_CROSS_THREAD_HIMC(hIMC))
853 return FALSE;
854
855 pClientImc = ImmLockClientImc(hIMC);
856 if (IS_NULL_UNEXPECTEDLY(pClientImc))
857 return FALSE;
858
859 bAnsi = !(pClientImc->dwFlags & CLIENTIMC_WIDE);
860 ImmUnlockClientImc(pClientImc);
861
862 pIC = ImmLockIMC(hIMC);
863 if (IS_NULL_UNEXPECTEDLY(pIC))
864 return FALSE;
865
866 dwCount = pIC->dwNumMsgBuf;
867 if (dwCount == 0)
868 goto Quit;
869
870 hMsgBuf = pIC->hMsgBuf;
871 pMsgs = ImmLockIMCC(hMsgBuf);
872 if (IS_NULL_UNEXPECTEDLY(pMsgs))
873 goto Quit;
874
875 cbTrans = dwCount * sizeof(TRANSMSG);
876 pTrans = ImmLocalAlloc(0, cbTrans);
877 if (IS_NULL_UNEXPECTEDLY(pTrans))
878 goto Quit;
879
880 RtlCopyMemory(pTrans, pMsgs, cbTrans);
881
882#ifdef IMM_WIN3_SUPPORT
883 if (GetWin32ClientInfo()->dwExpWinVer < _WIN32_WINNT_NT4) /* old version (3.x)? */
884 {
886 WORD wLang = PRIMARYLANGID(LangID);
887
888 /* translate the messages if Japanese or Korean */
889 if (wLang == LANG_JAPANESE ||
890 (wLang == LANG_KOREAN && NtUserGetAppImeLevel(pIC->hWnd) == 3))
891 {
892 dwCount = WINNLSTranslateMessage(dwCount, pTrans, hIMC, bAnsi, wLang);
893 }
894 }
895#endif
896
897 /* send them */
898 hWnd = pIC->hWnd;
899 pItem = pTrans;
900 for (dwIndex = 0; dwIndex < dwCount; ++dwIndex, ++pItem)
901 {
902 if (bAnsi)
903 SendMessageA(hWnd, pItem->message, pItem->wParam, pItem->lParam);
904 else
905 SendMessageW(hWnd, pItem->message, pItem->wParam, pItem->lParam);
906 }
907
908Quit:
909 ImmLocalFree(pTrans);
910 if (hMsgBuf)
911 ImmUnlockIMCC(hMsgBuf);
912 pIC->dwNumMsgBuf = 0; /* done */
913 ImmUnlockIMC(hIMC);
914 return TRUE;
915}
916
918ImmPostMessages(HWND hwnd, HIMC hIMC, DWORD dwCount, LPTRANSMSG lpTransMsg)
919{
920 DWORD dwIndex;
921 PCLIENTIMC pClientImc;
922 LPTRANSMSG pNewTransMsg = lpTransMsg, pItem;
923 BOOL bAnsi;
924
925 pClientImc = ImmLockClientImc(hIMC);
926 if (IS_NULL_UNEXPECTEDLY(pClientImc))
927 return;
928
929 bAnsi = !(pClientImc->dwFlags & CLIENTIMC_WIDE);
930 ImmUnlockClientImc(pClientImc);
931
932#ifdef IMM_WIN3_SUPPORT
933 if (GetWin32ClientInfo()->dwExpWinVer < _WIN32_WINNT_NT4) /* old version (3.x)? */
934 {
936 WORD Lang = PRIMARYLANGID(LangID);
937
938 /* translate the messages if Japanese or Korean */
939 if (Lang == LANG_JAPANESE ||
940 (Lang == LANG_KOREAN && NtUserGetAppImeLevel(hwnd) == 3))
941 {
942 DWORD cbTransMsg = dwCount * sizeof(TRANSMSG);
943 pNewTransMsg = ImmLocalAlloc(0, cbTransMsg);
944 if (pNewTransMsg)
945 {
946 RtlCopyMemory(pNewTransMsg, lpTransMsg, cbTransMsg);
947 dwCount = WINNLSTranslateMessage(dwCount, pNewTransMsg, hIMC, bAnsi, Lang);
948 }
949 else
950 {
951 pNewTransMsg = lpTransMsg;
952 }
953 }
954 }
955#endif
956
957 /* post them */
958 pItem = pNewTransMsg;
959 for (dwIndex = 0; dwIndex < dwCount; ++dwIndex, ++pItem)
960 {
961 if (bAnsi)
962 PostMessageA(hwnd, pItem->message, pItem->wParam, pItem->lParam);
963 else
964 PostMessageW(hwnd, pItem->message, pItem->wParam, pItem->lParam);
965 }
966
967#ifdef IMM_WIN3_SUPPORT
968 if (pNewTransMsg != lpTransMsg)
969 ImmLocalFree(pNewTransMsg);
970#endif
971}
972
973/***********************************************************************
974 * ImmTranslateMessage(IMM32.@)
975 * ( Undocumented, call internally and from user32.dll )
976 */
978{
979#define MSG_COUNT 0x100
980 BOOL ret = FALSE;
981 INT kret;
983 PIMEDPI pImeDpi = NULL;
985 LPTRANSMSG pTransMsg;
986 BYTE abKeyState[256];
987 HIMC hIMC;
988 HKL hKL;
989 UINT vk;
990 DWORD dwThreadId, dwCount, cbList;
991 WCHAR wch;
992 WORD wChar;
993
994 TRACE("(%p, 0x%X, %p, %p)\n", hwnd, msg, wParam, lKeyData);
995
996 /* filter the message */
997 switch (msg)
998 {
999 case WM_KEYDOWN: case WM_KEYUP: case WM_SYSKEYDOWN: case WM_SYSKEYUP:
1000 break;
1001 default:
1002 return FALSE;
1003 }
1004
1005 hIMC = ImmGetContext(hwnd);
1006 pIC = (LPINPUTCONTEXTDX)ImmLockIMC(hIMC);
1007 if (IS_NULL_UNEXPECTEDLY(pIC))
1008 {
1009 ImmReleaseContext(hwnd, hIMC);
1010 return FALSE;
1011 }
1012
1013 if (!pIC->bNeedsTrans) /* is translation needed? */
1014 {
1015 /* directly post them */
1016 dwCount = pIC->dwNumMsgBuf;
1017 if (dwCount == 0)
1018 goto Quit;
1019
1020 pTransMsg = ImmLockIMCC(pIC->hMsgBuf);
1021 if (pTransMsg)
1022 {
1023 ImmPostMessages(hwnd, hIMC, dwCount, pTransMsg);
1024 ImmUnlockIMCC(pIC->hMsgBuf);
1025 ret = TRUE;
1026 }
1027 pIC->dwNumMsgBuf = 0; /* done */
1028 goto Quit;
1029 }
1030 pIC->bNeedsTrans = FALSE; /* clear the flag */
1031
1034 pImeDpi = ImmLockImeDpi(hKL);
1035 if (IS_NULL_UNEXPECTEDLY(pImeDpi))
1036 goto Quit;
1037
1038 if (!GetKeyboardState(abKeyState)) /* get keyboard ON/OFF status */
1039 {
1040 WARN("\n");
1041 goto Quit;
1042 }
1043
1044 /* convert a virtual key if IME_PROP_KBD_CHAR_FIRST */
1045 vk = pIC->nVKey;
1047 {
1048 if (ImeDpi_IsUnicode(pImeDpi))
1049 {
1050 wch = 0;
1051 kret = ToUnicode(vk, HIWORD(lKeyData), abKeyState, &wch, 1, 0);
1052 if (kret == 1)
1053 vk = MAKELONG(LOBYTE(vk), wch);
1054 }
1055 else
1056 {
1057 wChar = 0;
1058 kret = ToAsciiEx(vk, HIWORD(lKeyData), abKeyState, &wChar, 0, hKL);
1059 if (kret > 0)
1060 {
1061 if ((BYTE)vk == VK_PACKET)
1062 {
1063 vk &= 0xFF;
1064 vk |= (wChar << 8);
1065 }
1066 else
1067 {
1068 vk = MAKEWORD(vk, wChar);
1069 }
1070 }
1071 }
1072 }
1073
1074 /* allocate a list */
1075 cbList = offsetof(TRANSMSGLIST, TransMsg) + MSG_COUNT * sizeof(TRANSMSG);
1076 pList = ImmLocalAlloc(0, cbList);
1078 goto Quit;
1079
1080 /* use IME conversion engine and convert the list */
1081 pList->uMsgCount = MSG_COUNT;
1082 kret = pImeDpi->ImeToAsciiEx(vk, HIWORD(lKeyData), abKeyState, pList, 0, hIMC);
1083 if (kret <= 0)
1084 goto Quit;
1085
1086 /* post them */
1087 if (kret <= MSG_COUNT)
1088 {
1089 ImmPostMessages(hwnd, hIMC, kret, pList->TransMsg);
1090 ret = TRUE;
1091 }
1092 else
1093 {
1094 pTransMsg = ImmLockIMCC(pIC->hMsgBuf);
1095 if (IS_NULL_UNEXPECTEDLY(pTransMsg))
1096 goto Quit;
1097 ImmPostMessages(hwnd, hIMC, kret, pTransMsg);
1098 ImmUnlockIMCC(pIC->hMsgBuf);
1099 }
1100
1101Quit:
1103 ImmUnlockImeDpi(pImeDpi);
1104 ImmUnlockIMC(hIMC);
1105 ImmReleaseContext(hwnd, hIMC);
1106 TRACE("ret: %d\n", ret);
1107 return ret;
1108#undef MSG_COUNT
1109}
1110
1111/***********************************************************************
1112 * ImmRequestMessageA(IMM32.@)
1113 */
1115{
1116 TRACE("(%p, %p, %p)\n", hIMC, wParam, lParam);
1117 return ImmRequestMessageAW(hIMC, wParam, lParam, TRUE);
1118}
1119
1120/***********************************************************************
1121 * ImmRequestMessageW(IMM32.@)
1122 */
1124{
1125 TRACE("(%p, %p, %p)\n", hIMC, wParam, lParam);
1126 return ImmRequestMessageAW(hIMC, wParam, lParam, FALSE);
1127}
1128
1129/***********************************************************************
1130 * ImmCallImeConsoleIME (IMM32.@)
1131 */
1134 _In_ HWND hWnd,
1135 _In_ UINT uMsg,
1138 _Out_ LPUINT puVK)
1139{
1140 DWORD dwThreadId, ret = 0;
1141 HKL hKL;
1142 PWND pWnd = NULL;
1143 HIMC hIMC;
1144 PIMEDPI pImeDpi;
1145 UINT uVK;
1146 PIMC pIMC;
1147
1148 switch (uMsg)
1149 {
1150 case WM_KEYDOWN:
1151 case WM_KEYUP:
1152 case WM_SYSKEYDOWN:
1153 case WM_SYSKEYUP:
1154 break;
1155
1156 default:
1157 return 0;
1158 }
1159
1162
1163 if (hWnd && gpsi)
1164 pWnd = ValidateHwndNoErr(hWnd);
1165 if (IS_NULL_UNEXPECTEDLY(pWnd))
1166 return 0;
1167
1168 hIMC = ImmGetContext(hWnd);
1169 if (IS_NULL_UNEXPECTEDLY(hIMC))
1170 return 0;
1171
1172 uVK = *puVK = (wParam & 0xFF);
1173
1175 if (IS_NULL_UNEXPECTEDLY(pIMC))
1176 return 0;
1177
1178 pImeDpi = ImmLockImeDpi(hKL);
1179 if (IS_NULL_UNEXPECTEDLY(pImeDpi))
1180 return 0;
1181
1183 goto Quit;
1184
1185 switch (uVK)
1186 {
1187 case VK_DBE_ROMAN:
1188 case VK_DBE_NOROMAN:
1189 case VK_DBE_HIRAGANA:
1190 case VK_DBE_KATAKANA:
1191 case VK_DBE_CODEINPUT:
1192 case VK_DBE_NOCODEINPUT:
1195 break;
1196
1197 default:
1198 {
1199 if (uMsg == WM_SYSKEYDOWN || uMsg == WM_SYSKEYUP)
1200 {
1201 if (uVK != VK_MENU && uVK != VK_F10)
1202 goto Quit;
1203 }
1204
1205 if (!(pImeDpi->ImeInfo.fdwProperty & IME_PROP_NEED_ALTKEY))
1206 {
1207 if (uVK == VK_MENU || (lParam & MAKELPARAM(0, KF_ALTDOWN)))
1208 goto Quit;
1209 }
1210 }
1211 }
1212
1214
1215Quit:
1216 ImmUnlockImeDpi(pImeDpi);
1217 return ret;
1218}
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
LONG WINAPI ImmGetCompositionStringW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
Definition: compstr.c:899
LONG WINAPI ImmGetCompositionStringA(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
Definition: compstr.c:856
BOOL WINAPI CtfImmIsCiceroStartedInThread(VOID)
Definition: ctf.c:781
LRESULT CtfImmSetLangBand(_In_ HWND hWnd, _In_ BOOL fSet)
Definition: ctf.c:1233
DWORD g_aimm_compat_flags
Definition: ctf.c:204
DWORD HIMCC
Definition: dimm.idl:76
DWORD HIMC
Definition: dimm.idl:75
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define APIENTRY
Definition: api.h:79
#define CP_ACP
Definition: compat.h:109
#define CALLBACK
Definition: compat.h:35
BOOL WINAPI ImmIsIME(HKL hKL)
Definition: ime.c:880
PIMEDPI WINAPI ImmLockImeDpi(HKL hKL)
Definition: ime.c:978
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:1007
BOOL WINAPI ImmGetOpenStatus(HIMC hIMC)
Definition: ime.c:1443
BOOL WINAPI ImmSetConversionStatus(HIMC hIMC, DWORD fdwConversion, DWORD fdwSentence)
Definition: ime.c:1941
BOOL WINAPI ImmNotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD_PTR dwValue)
Definition: ime.c:907
BOOL WINAPI ImmSetOpenStatus(HIMC hIMC, BOOL fOpen)
Definition: ime.c:1466
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1067
HIMC WINAPI ImmGetContext(HWND hWnd)
Definition: imm.c:1045
VOID WINAPI ImmUnlockClientImc(PCLIENTIMC pClientImc)
Definition: imm.c:984
BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC)
Definition: imm.c:1086
PCLIENTIMC WINAPI ImmLockClientImc(HIMC hImc)
Definition: imm.c:938
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1058
BOOL WINAPI ImmEnumInputContext(DWORD dwThreadId, IMCENUMPROC lpfn, LPARAM lParam)
Definition: imm.c:1097
PSERVERINFO gpsi
Definition: imm.c:18
VOID APIENTRY LogFontAnsiToWide(const LOGFONTA *plfA, LPLOGFONTW plfW)
Definition: utils.c:299
#define IS_ZERO_UNEXPECTEDLY(p)
Definition: precomp.h:129
LPVOID APIENTRY ImmLocalAlloc(DWORD dwFlags, DWORD dwBytes)
Definition: utils.c:415
#define LANGID_JAPANESE
Definition: precomp.h:58
#define LANGID_CHINESE_SIMPLIFIED
Definition: precomp.h:56
VOID APIENTRY LogFontWideToAnsi(const LOGFONTW *plfW, LPLOGFONTA plfA)
Definition: utils.c:312
LPVOID FASTCALL ValidateHandleNoErr(HANDLE hObject, UINT uType)
Definition: utils.c:338
#define ValidateHwnd(hwnd)
Definition: precomp.h:85
#define ImmLocalFree(lpData)
Definition: precomp.h:89
#define IS_CROSS_THREAD_HIMC(hIMC)
Definition: precomp.h:148
PTHREADINFO FASTCALL Imm32CurrentPti(VOID)
Definition: utils.c:19
LONG APIENTRY IchWideFromAnsi(LONG cchAnsi, LPCSTR pchAnsi, UINT uCodePage)
Definition: utils.c:252
#define ValidateHwndNoErr(hwnd)
Definition: precomp.h:84
#define LANGID_CHINESE_TRADITIONAL
Definition: precomp.h:57
DWORD APIENTRY Imm32ReconvertAnsiFromWide(LPRECONVERTSTRING pDest, const RECONVERTSTRING *pSrc, UINT uCodePage)
Definition: utils.c:691
#define INVALID_HOTKEY_ID
Definition: precomp.h:52
#define IS_NULL_UNEXPECTEDLY(p)
Definition: precomp.h:125
#define ImeDpi_IsUnicode(pImeDpi)
Definition: precomp.h:150
LONG APIENTRY IchAnsiFromWide(LONG cchWide, LPCWSTR pchWide, UINT uCodePage)
Definition: utils.c:273
DWORD APIENTRY Imm32ReconvertWideFromAnsi(LPRECONVERTSTRING pDest, const RECONVERTSTRING *pSrc, UINT uCodePage)
Definition: utils.c:628
BOOL WINAPI ImmUnlockIMCC(HIMCC imcc)
Definition: utils.c:1208
LPVOID WINAPI ImmLockIMCC(HIMCC imcc)
Definition: utils.c:1198
BOOL NTAPI IsBadWritePtr(IN LPVOID lp, IN UINT_PTR ucb)
Definition: except.c:883
LCID WINAPI GetSystemDefaultLCID(void)
Definition: locale.c:1229
DWORD dwThreadId
Definition: fdebug.c:31
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
FxChildList * pList
struct _tagTRANSMSG TRANSMSG
struct INPUTCONTEXTDX * LPINPUTCONTEXTDX
#define IS_IME_HKL(hKL)
Definition: imm32_undoc.h:20
#define CLIENTIMC_WIDE
Definition: imm32_undoc.h:142
HKL FAR * LPHKL
Definition: imm.h:24
#define IME_CMODE_NATIVE
Definition: imm.h:337
#define IME_HOTKEY_PRIVATE_LAST
Definition: imm.h:221
#define IME_JHOTKEY_CLOSE_OPEN
Definition: imm.h:200
#define IME_CMODE_SYMBOL
Definition: imm.h:352
#define IME_KHOTKEY_HANJACONVERT
Definition: imm.h:204
#define IME_CMODE_HANJACONVERT
Definition: imm.h:348
#define IME_THOTKEY_IME_NONIME_TOGGLE
Definition: imm.h:207
#define IME_CHOTKEY_SYMBOL_TOGGLE
Definition: imm.h:197
#define CPS_COMPLETE
Definition: imm.h:178
#define IME_CHOTKEY_IME_NONIME_TOGGLE
Definition: imm.h:195
#define IMN_SETSENTENCEMODE
Definition: imm.h:378
#define IME_ESC_PRIVATE_HOTKEY
Definition: imm.h:423
#define IME_KHOTKEY_SHAPE_TOGGLE
Definition: imm.h:203
#define GCS_COMPSTR
Definition: imm.h:227
#define IME_THOTKEY_SHAPE_TOGGLE
Definition: imm.h:208
#define IME_HOTKEY_PRIVATE_FIRST
Definition: imm.h:216
#define IME_KHOTKEY_ENGLISH
Definition: imm.h:205
#define IMN_SETOPENSTATUS
Definition: imm.h:379
#define IME_CMODE_FULLSHAPE
Definition: imm.h:345
#define IME_THOTKEY_SYMBOL_TOGGLE
Definition: imm.h:209
#define IME_CHOTKEY_SHAPE_TOGGLE
Definition: imm.h:196
#define IMN_SETCONVERSIONMODE
Definition: imm.h:377
#define INPUTCONTEXTDX_CHANGE_OPEN
Definition: immdev.h:182
#define INPUTCONTEXTDX_CHANGE_SENTENCE
Definition: immdev.h:184
#define NI_COMPOSITIONSTR
Definition: immdev.h:403
#define IMS_SETLANGBAND
Definition: immdev.h:116
#define IMS_COMPLETECOMPSTR
Definition: immdev.h:114
#define IMS_UNSETLANGBAND
Definition: immdev.h:117
#define IME_PROP_ACCEPT_WIDE_VKEY
Definition: immdev.h:389
#define INPUTCONTEXTDX_CHANGE_FORCE_OPEN
Definition: immdev.h:185
#define INPUTCONTEXTDX_CHANGE_CONVERSION
Definition: immdev.h:183
#define IME_PROP_NEED_ALTKEY
Definition: immdev.h:387
#define IMS_SENDNOTIFICATION
Definition: immdev.h:113
#define IME_PROP_KBD_CHAR_FIRST
Definition: immdev.h:385
#define IME_PROP_IGNORE_UPKEYS
Definition: immdev.h:386
DWORD NTAPI NtUserNotifyIMEStatus(HWND hwnd, BOOL fOpen, DWORD dwConversion)
Definition: ime.c:803
DWORD NTAPI NtUserGetAppImeLevel(HWND hWnd)
Definition: ime.c:921
@ THREADSTATE_OLDKEYBOARDLAYOUT
Definition: ntuser.h:2486
BOOL NTAPI NtUserGetImeHotKey(DWORD dwHotKeyId, LPUINT lpuModifiers, LPUINT lpuVirtualKey, LPHKL lphKL)
Definition: ime.c:406
@ TYPE_INPUTCONTEXT
Definition: ntuser.h:57
#define GetWin32ClientInfo()
Definition: ntuser.h:352
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:240
#define WNDS_ANSIWINDOWPROC
Definition: ntuser.h:624
#define LOBYTE(W)
Definition: jmemdos.c:487
#define VK_DBE_ROMAN
Definition: jpnvkeys.h:19
#define VK_DBE_HIRAGANA
Definition: jpnvkeys.h:16
#define VK_DBE_CODEINPUT
Definition: jpnvkeys.h:24
#define VK_DBE_NOROMAN
Definition: jpnvkeys.h:20
#define VK_DBE_KATAKANA
Definition: jpnvkeys.h:15
#define VK_DBE_ENTERCONFIGMODE
Definition: jpnvkeys.h:22
#define VK_DBE_ENTERWORDREGISTERMODE
Definition: jpnvkeys.h:21
#define VK_DBE_NOCODEINPUT
Definition: jpnvkeys.h:25
BOOL WINAPI ImmTranslateMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lKeyData)
Definition: keymsg.c:977
static BOOL APIENTRY ImmIsUIMessageAW(HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam, BOOL bAnsi)
Definition: keymsg.c:310
LRESULT APIENTRY ImmRequestMessageAW(HIMC hIMC, WPARAM wParam, LPARAM lParam, BOOL bAnsi)
Definition: keymsg.c:582
LRESULT WINAPI ImmRequestMessageW(HIMC hIMC, WPARAM wParam, LPARAM lParam)
Definition: keymsg.c:1123
BOOL APIENTRY Imm32JCloseOpen(HIMC hIMC, HKL hKL, HWND hWnd)
Definition: keymsg.c:161
BOOL WINAPI ImmGenerateMessage(HIMC hIMC)
Definition: keymsg.c:840
BOOL WINAPI ImmGetHotKey(IN DWORD dwHotKey, OUT LPUINT lpuModifiers, OUT LPUINT lpuVKey, OUT LPHKL lphKL)
Definition: keymsg.c:629
DWORD WINAPI ImmCallImeConsoleIME(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam, _Out_ LPUINT puVK)
Definition: keymsg.c:1133
DWORD WINAPI ImmProcessKey(HWND hWnd, HKL hKL, UINT vKey, LPARAM lParam, DWORD dwHotKeyID)
Definition: keymsg.c:715
UINT WINAPI ImmGetVirtualKey(HWND hWnd)
Definition: keymsg.c:671
BOOL APIENTRY Imm32CSymbolToggle(HIMC hIMC, HKL hKL, HWND hWnd)
Definition: keymsg.c:130
UINT WINAPI ImmWINNLSGetIMEHotkey(HWND hwndIme)
Definition: keymsg.c:641
BOOL APIENTRY Imm32ImeNonImeToggle(HIMC hIMC, HKL hKL, HWND hWnd, BOOL bNowIME, LANGID LangID)
Definition: keymsg.c:18
LRESULT WINAPI ImmSystemHandler(HIMC hIMC, WPARAM wParam, LPARAM lParam)
Definition: keymsg.c:813
BOOL WINAPI ImmIsUIMessageW(HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: keymsg.c:619
VOID APIENTRY ImmPostMessages(HWND hwnd, HIMC hIMC, DWORD dwCount, LPTRANSMSG lpTransMsg)
Definition: keymsg.c:918
DWORD WINAPI ImmGetAppCompatFlags(HIMC hIMC)
Definition: keymsg.c:694
BOOL APIENTRY Imm32CShapeToggle(HIMC hIMC, HKL hKL, HWND hWnd)
Definition: keymsg.c:99
BOOL APIENTRY Imm32ProcessHotKey(HWND hWnd, HIMC hIMC, HKL hKL, DWORD dwHotKeyID)
Definition: keymsg.c:251
BOOL APIENTRY Imm32KEnglish(HIMC hIMC)
Definition: keymsg.c:229
BOOL APIENTRY Imm32SendNotification(BOOL bProcess)
Definition: keymsg.c:367
BOOL WINAPI ImmIsUIMessageA(HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: keymsg.c:610
LRESULT WINAPI ImmRequestMessageA(HIMC hIMC, WPARAM wParam, LPARAM lParam)
Definition: keymsg.c:1114
BOOL APIENTRY Imm32KShapeToggle(HIMC hIMC)
Definition: keymsg.c:188
BOOL APIENTRY Imm32CImeNonImeToggle(HIMC hIMC, HKL hKL, HWND hWnd, LANGID LangID)
Definition: keymsg.c:68
static BOOL CALLBACK Imm32SendNotificationProc(_In_ HIMC hIMC, _In_ LPARAM lParam)
Definition: keymsg.c:334
#define MSG_COUNT
LRESULT APIENTRY Imm32ProcessRequest(HIMC hIMC, PWND pWnd, DWORD dwCommand, LPVOID pData, BOOL bAnsiAPI)
Definition: keymsg.c:373
BOOL APIENTRY Imm32KHanjaConvert(HIMC hIMC)
Definition: keymsg.c:211
BOOL WINAPI ImmSimulateHotKey(HWND hWnd, DWORD dwHotKeyID)
Definition: keymsg.c:651
USHORT LANGID
Definition: mui.h:9
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
WORD vk
Definition: input.c:77
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
UINT_PTR HKL
Definition: msctf.idl:143
EXTERN_C HRESULT WINAPI CtfImeProcessCicHotkey(_In_ HIMC hIMC, _In_ UINT vKey, _In_ LPARAM lParam)
Definition: msctfime.cpp:800
unsigned int UINT
Definition: ndis.h:50
#define BOOL
Definition: nt_native.h:43
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define LOWORD(l)
Definition: pedump.c:82
#define offsetof(TYPE, MEMBER)
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define LANG_JAPANESE
Definition: nls.h:76
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define LANG_KOREAN
Definition: nls.h:84
#define _WIN32_WINNT_NT4
Definition: sdkddkver.h:20
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
IMEINFO ImeInfo
Definition: imm32_undoc.h:67
Definition: ntuser.h:694
THRDESKHEAD head
Definition: ntuser.h:695
DWORD state
Definition: ntuser.h:701
DWORD fdwProperty
Definition: immdev.h:22
HIMCC hMsgBuf
Definition: immdev.h:146
DWORD fdwConversion
Definition: immdev.h:133
DWORD fdwSentence
Definition: immdev.h:134
DWORD dwNumMsgBuf
Definition: immdev.h:145
DWORD dwCompatFlags
Definition: imm32_undoc.h:123
Definition: ntuser.h:199
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
#define MAKEWORD(a, b)
Definition: typedefs.h:248
int32_t INT
Definition: typedefs.h:58
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define IN
Definition: typedefs.h:39
#define MAKELONG(a, b)
Definition: typedefs.h:249
uint32_t * LPUINT
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
#define OUT
Definition: typedefs.h:40
#define IPHK_SKIPTHISKEY
Definition: undocuser.h:142
#define IPHK_HOTKEY
Definition: undocuser.h:139
#define IPHK_PROCESSBYIME
Definition: undocuser.h:140
#define WM_IME_SYSTEM
Definition: undocuser.h:60
int ret
_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:1083
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
BOOL WINAPI IsWindow(_In_opt_ HWND)
HKL WINAPI GetKeyboardLayout(_In_ DWORD)
#define WM_IME_REQUEST
Definition: winuser.h:1839
#define MAKELPARAM(l, h)
Definition: winuser.h:4011
#define WM_KEYUP
Definition: winuser.h:1719
#define WM_IME_NOTIFY
Definition: winuser.h:1833
#define VK_F10
Definition: winuser.h:2267
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define KF_ALTDOWN
Definition: winuser.h:2452
#define VK_PROCESSKEY
Definition: winuser.h:2330
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
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)
_Check_return_ BOOL WINAPI GetKeyboardState(_Out_writes_(256) PBYTE lpKeyState)
#define WM_IME_SETCONTEXT
Definition: winuser.h:1832
#define KF_UP
Definition: winuser.h:2454
UINT WINAPI GetKeyboardLayoutList(_In_ int nBuff, _Out_writes_to_opt_(nBuff, return) HKL FAR *lpList)
#define VK_KANJI
Definition: winuser.h:2216
#define WM_SYSKEYUP
Definition: winuser.h:1723
#define WM_IME_COMPOSITIONFULL
Definition: winuser.h:1835
#define WM_IME_SELECT
Definition: winuser.h:1836
#define WM_KEYDOWN
Definition: winuser.h:1718
int WINAPI ToAsciiEx(_In_ UINT, _In_ UINT, _In_reads_opt_(256) CONST BYTE *, _Out_ LPWORD, _In_ UINT, _In_opt_ HKL)
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SYSKEYDOWN
Definition: winuser.h:1722
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define VK_MENU
Definition: winuser.h:2207
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175
unsigned char BYTE
Definition: xxhash.c:193