ReactOS 0.4.16-dev-2617-g01a0906
compstr.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 composition strings of IMM32
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-2026 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
10 */
11
12#include "precomp.h"
13
15
16BOOL
18{
21
22 *ppIC = NULL;
23 *ppCS = NULL;
24
25 pIC = ImmLockIMC(hIMC);
26 if (IS_NULL_UNEXPECTEDLY(pIC))
27 return FALSE;
28
29 pCS = ImmLockIMCC(pIC->hCompStr);
30 if (IS_NULL_UNEXPECTEDLY(pCS))
31 {
32 ImmUnlockIMC(hIMC);
33 return FALSE;
34 }
35
36 *ppIC = pIC;
37 *ppCS = pCS;
38 return TRUE;
39}
40
41static inline LONG
42Imm32CompStrAnsiToWide(LPCSTR psz, DWORD cb, LPWSTR lpBuf, DWORD dwBufLen, UINT uCodePage)
43{
44 DWORD ret = MultiByteToWideChar(uCodePage, MB_PRECOMPOSED, psz, cb / sizeof(CHAR),
45 lpBuf, dwBufLen / sizeof(WCHAR));
46 if (lpBuf && (ret + 1) * sizeof(WCHAR) <= dwBufLen)
47 lpBuf[ret] = UNICODE_NULL;
48 return ret * sizeof(WCHAR);
49}
50
51static inline LONG
52Imm32CompStrWideToAnsi(LPCWSTR psz, DWORD cb, LPSTR lpBuf, DWORD dwBufLen, UINT uCodePage)
53{
54 DWORD ret = WideCharToMultiByte(uCodePage, 0, psz, cb / sizeof(WCHAR),
55 lpBuf, dwBufLen / sizeof(CHAR), NULL, NULL);
56 if (lpBuf && (ret + 1) * sizeof(CHAR) <= dwBufLen)
57 lpBuf[ret] = ANSI_NULL;
58 return ret * sizeof(CHAR);
59}
60
61static INT
63 INT str_len, LPBYTE dst, INT dst_len, UINT uCodePage)
64{
65 INT rc;
66 INT i, j = 0, k = 0, len;
67
68 if (!src_len)
69 return 0;
70
71 str_len /= sizeof(WCHAR);
72 rc = WideCharToMultiByte(uCodePage, 0, text, str_len, NULL, 0, NULL, NULL);
73
74 if (dst_len)
75 {
76 if (dst_len > rc)
77 dst_len = rc;
78
79 for (i = 0; i < str_len; ++i, ++k)
80 {
81 len = WideCharToMultiByte(uCodePage, 0, &text[i], 1, NULL, 0, NULL, NULL);
82 for (; len > 0; --len)
83 {
84 dst[j++] = src[k];
85
86 if (dst_len <= j)
87 goto end;
88 }
89 }
90end:
91 rc = j;
92 }
93
94 return rc * sizeof(BYTE);
95}
96
97static INT
99 INT str_len, LPBYTE dst, INT dst_len, UINT uCodePage)
100{
101 INT rc;
102 INT i, j = 0;
103
104 if (!src_len)
105 return 0;
106
107 str_len /= sizeof(CHAR);
108 rc = MultiByteToWideChar(uCodePage, MB_PRECOMPOSED, text, str_len, NULL, 0);
109
110 if (dst_len)
111 {
112 if (dst_len > rc)
113 dst_len = rc;
114
115 for (i = 0; i < str_len; ++i)
116 {
117 if (IsDBCSLeadByteEx(uCodePage, text[i]) && text[i + 1])
118 continue;
119
120 dst[j++] = src[i];
121
122 if (dst_len <= j)
123 break;
124 }
125
126 rc = j;
127 }
128
129 return rc * sizeof(BYTE);
130}
131
132static INT
134 LPDWORD target, INT tlen, UINT uCodePage)
135{
136 INT rc, i;
137
138 if (!slen)
139 return 0;
140
141 if (tlen)
142 {
143 if (tlen > slen)
144 tlen = slen;
145
146 tlen /= sizeof(DWORD);
147
148 for (i = 0; i < tlen; ++i)
149 {
151 }
152
153 rc = sizeof(DWORD) * i;
154 }
155 else
156 {
157 rc = slen;
158 }
159
160 return rc;
161}
162
163static INT
165 LPDWORD target, INT tlen, UINT uCodePage)
166{
167 INT rc, i;
168
169 if (!slen)
170 return 0;
171
172 if (tlen)
173 {
174 if (tlen > slen)
175 tlen = slen;
176
177 tlen /= sizeof(DWORD);
178
179 for (i = 0; i < tlen; ++i)
180 {
181 target[i] = WideCharToMultiByte(uCodePage, 0, text, source[i], NULL, 0, NULL, NULL);
182 }
183
184 rc = sizeof(DWORD) * i;
185 }
186 else
187 {
188 rc = slen;
189 }
190
191 return rc;
192}
193
194#define CS_StrA(pCS, Name) ((LPCSTR)(pCS) + (pCS)->dw##Name##Offset)
195#define CS_StrW(pCS, Name) ((LPCWSTR)CS_StrA(pCS, Name))
196#define CS_Attr(pCS, Name) ((const BYTE *)CS_StrA(pCS, Name))
197#define CS_Clause(pCS, Name) ((const DWORD *)CS_StrA(pCS, Name))
198#define CS_Size(pCS, Name) ((pCS)->dw##Name##Len)
199#define CS_SizeA(pCS, Name) (CS_Size(pCS, Name) * sizeof(CHAR))
200#define CS_SizeW(pCS, Name) (CS_Size(pCS, Name) * sizeof(WCHAR))
201
202#define CS_DoStr(pCS, Name, AorW) do { \
203 if (dwBufLen == 0) { \
204 dwBufLen = CS_Size##AorW((pCS), Name); \
205 } else { \
206 if (dwBufLen > CS_Size##AorW((pCS), Name)) \
207 dwBufLen = CS_Size##AorW((pCS), Name); \
208 RtlCopyMemory(lpBuf, CS_Str##AorW((pCS), Name), dwBufLen); \
209 } \
210} while (0)
211
212#define CS_DoStrA(pCS, Name) CS_DoStr(pCS, Name, A)
213#define CS_DoStrW(pCS, Name) CS_DoStr(pCS, Name, W)
214#define CS_DoAttr CS_DoStrA
215#define CS_DoClause CS_DoStrA
216
217static DWORD CS_DoPrivate(HIMC hIMC, const COMPOSITIONSTRING *pCS, PVOID pBuffer, DWORD dwBufLen)
218{
219 if (!CtfImmIsGuidMapEnable(hIMC) || pCS->dwPrivateSize < sizeof(COMPSTR_PRIVATE))
220 return IMM_ERROR_GENERAL;
221
222 /* Check boundary #1 (ReactOS only) */
223 DWORD dwPrivateOffset = pCS->dwPrivateOffset;
224 if (dwPrivateOffset >= pCS->dwSize || dwPrivateOffset + pCS->dwPrivateSize > pCS->dwSize)
225 return IMM_ERROR_GENERAL;
226
227 const BYTE *pbCS = (const BYTE *)pCS;
228 const COMPSTR_PRIVATE *pPrivate = (const COMPSTR_PRIVATE *)(pbCS + dwPrivateOffset);
229 DWORD dwLen = pPrivate->dwLen, dwOffset = pPrivate->dwOffset;
230
231 /* Check boundary #2 (ReactOS only) */
232 if (dwPrivateOffset + dwOffset > pCS->dwPrivateSize ||
233 dwPrivateOffset + dwOffset + dwLen > pCS->dwPrivateSize)
234 {
235 return IMM_ERROR_GENERAL;
236 }
237
238 if (!dwBufLen)
239 return dwLen;
240
241 DWORD ret = min(dwBufLen, dwLen);
242 CopyMemory(pBuffer, (const BYTE *)pPrivate + dwOffset, ret);
243 return ret;
244}
245
246static LONG
248 LPVOID lpBuf, DWORD dwBufLen, BOOL bAnsiClient, UINT uCodePage)
249{
250 if (bAnsiClient)
251 {
252 switch (dwIndex)
253 {
254 case GCS_COMPREADSTR:
255 CS_DoStrA(pCS, CompReadStr);
256 break;
257
258 case GCS_COMPREADATTR:
259 CS_DoAttr(pCS, CompReadAttr);
260 break;
261
263 CS_DoClause(pCS, CompReadClause);
264 break;
265
266 case GCS_COMPSTR:
267 CS_DoStrA(pCS, CompStr);
268 break;
269
270 case GCS_COMPATTR:
271 CS_DoAttr(pCS, CompAttr);
272 break;
273
274 case GCS_COMPCLAUSE:
275 CS_DoClause(pCS, CompClause);
276 break;
277
278 case GCS_CURSORPOS:
279 dwBufLen = pCS->dwCursorPos;
280 break;
281
282 case GCS_DELTASTART:
283 dwBufLen = pCS->dwDeltaStart;
284 break;
285
287 CS_DoStrA(pCS, ResultReadStr);
288 break;
289
291 CS_DoClause(pCS, ResultReadClause);
292 break;
293
294 case GCS_RESULTSTR:
295 CS_DoStrA(pCS, ResultStr);
296 break;
297
298 case GCS_RESULTCLAUSE:
299 CS_DoClause(pCS, ResultClause);
300 break;
301
302 case GCS_PRIVATE:
303 return CS_DoPrivate(hIMC, pCS, lpBuf, dwBufLen);
304
305 default:
306 FIXME("0x%X\n", dwIndex);
307 return IMM_ERROR_GENERAL;
308 }
309 }
310 else /* !bAnsiClient */
311 {
312 switch (dwIndex)
313 {
314 case GCS_COMPREADSTR:
315 dwBufLen = Imm32CompStrWideToAnsi(CS_StrW(pCS, CompReadStr),
316 CS_SizeW(pCS, CompReadStr),
317 lpBuf, dwBufLen, uCodePage);
318 break;
319
320 case GCS_COMPREADATTR:
321 dwBufLen = Imm32CompAttrWideToAnsi(CS_Attr(pCS, CompReadAttr),
322 CS_Size(pCS, CompReadAttr),
323 CS_StrW(pCS, CompReadStr),
324 CS_SizeW(pCS, CompReadStr),
325 lpBuf, dwBufLen, uCodePage);
326 break;
327
329 dwBufLen = Imm32CompClauseWideToAnsi(CS_Clause(pCS, CompReadClause),
330 CS_Size(pCS, CompReadClause),
331 CS_StrW(pCS, CompReadStr),
332 lpBuf, dwBufLen, uCodePage);
333 break;
334
335 case GCS_COMPSTR:
336 dwBufLen = Imm32CompStrWideToAnsi(CS_StrW(pCS, CompStr),
337 CS_SizeW(pCS, CompStr),
338 lpBuf, dwBufLen, uCodePage);
339 break;
340
341 case GCS_COMPATTR:
342 dwBufLen = Imm32CompAttrWideToAnsi(CS_Attr(pCS, CompAttr),
343 CS_Size(pCS, CompAttr),
344 CS_StrW(pCS, CompStr),
345 CS_SizeW(pCS, CompStr),
346 lpBuf, dwBufLen, uCodePage);
347 break;
348
349 case GCS_COMPCLAUSE:
350 dwBufLen = Imm32CompClauseWideToAnsi(CS_Clause(pCS, CompClause),
351 CS_Size(pCS, CompClause),
352 CS_StrW(pCS, CompStr),
353 lpBuf, dwBufLen, uCodePage);
354 break;
355
356 case GCS_CURSORPOS:
357 dwBufLen = IchAnsiFromWide(pCS->dwCursorPos, CS_StrW(pCS, CompStr), uCodePage);
358 break;
359
360 case GCS_DELTASTART:
361 dwBufLen = IchAnsiFromWide(pCS->dwDeltaStart, CS_StrW(pCS, CompStr), uCodePage);
362 break;
363
365 dwBufLen = Imm32CompStrWideToAnsi(CS_StrW(pCS, ResultReadStr),
366 CS_SizeW(pCS, ResultReadStr),
367 lpBuf, dwBufLen, uCodePage);
368 break;
369
371 dwBufLen = Imm32CompClauseWideToAnsi(CS_Clause(pCS, ResultReadClause),
372 CS_Size(pCS, ResultReadClause),
373 CS_StrW(pCS, ResultReadStr),
374 lpBuf, dwBufLen, uCodePage);
375 break;
376
377 case GCS_RESULTSTR:
378 dwBufLen = Imm32CompStrWideToAnsi(CS_StrW(pCS, ResultStr),
379 CS_SizeW(pCS, ResultStr),
380 lpBuf, dwBufLen, uCodePage);
381 break;
382
383 case GCS_RESULTCLAUSE:
384 dwBufLen = Imm32CompClauseWideToAnsi(CS_Clause(pCS, ResultClause),
385 CS_Size(pCS, ResultClause),
386 CS_StrW(pCS, ResultStr),
387 lpBuf, dwBufLen, uCodePage);
388 break;
389
390 case GCS_PRIVATE:
391 return CS_DoPrivate(hIMC, pCS, lpBuf, dwBufLen);
392
393 default:
394 FIXME("0x%X\n", dwIndex);
395 return IMM_ERROR_GENERAL;
396 }
397 }
398
399 return dwBufLen;
400}
401
402static LONG
404 LPVOID lpBuf, DWORD dwBufLen, BOOL bAnsiClient, UINT uCodePage)
405{
406 if (bAnsiClient)
407 {
408 switch (dwIndex)
409 {
410 case GCS_COMPREADSTR:
411 dwBufLen = Imm32CompStrAnsiToWide(CS_StrA(pCS, CompReadStr),
412 CS_SizeA(pCS, CompReadStr),
413 lpBuf, dwBufLen, uCodePage);
414 break;
415
416 case GCS_COMPREADATTR:
417 dwBufLen = Imm32CompAttrAnsiToWide(CS_Attr(pCS, CompReadAttr),
418 CS_Size(pCS, CompReadAttr),
419 CS_StrA(pCS, CompReadStr),
420 CS_SizeA(pCS, CompReadStr),
421 lpBuf, dwBufLen, uCodePage);
422 break;
423
425 dwBufLen = Imm32CompClauseAnsiToWide(CS_Clause(pCS, CompReadClause),
426 CS_Size(pCS, CompReadClause),
427 CS_StrA(pCS, CompReadStr),
428 lpBuf, dwBufLen, uCodePage);
429 break;
430
431 case GCS_COMPSTR:
432 dwBufLen = Imm32CompStrAnsiToWide(CS_StrA(pCS, CompStr),
433 CS_SizeA(pCS, CompStr),
434 lpBuf, dwBufLen, uCodePage);
435 break;
436
437 case GCS_COMPATTR:
438 dwBufLen = Imm32CompAttrAnsiToWide(CS_Attr(pCS, CompAttr),
439 CS_Size(pCS, CompAttr),
440 CS_StrA(pCS, CompStr), CS_SizeA(pCS, CompStr),
441 lpBuf, dwBufLen, uCodePage);
442 break;
443
444 case GCS_COMPCLAUSE:
445 dwBufLen = Imm32CompClauseAnsiToWide(CS_Clause(pCS, CompClause),
446 CS_Size(pCS, CompClause),
447 CS_StrA(pCS, CompStr),
448 lpBuf, dwBufLen, uCodePage);
449 break;
450
451 case GCS_CURSORPOS:
452 dwBufLen = IchWideFromAnsi(pCS->dwCursorPos, CS_StrA(pCS, CompStr), uCodePage);
453 break;
454
455 case GCS_DELTASTART:
456 dwBufLen = IchWideFromAnsi(pCS->dwDeltaStart, CS_StrA(pCS, CompStr), uCodePage);
457 break;
458
460 dwBufLen = Imm32CompStrAnsiToWide(CS_StrA(pCS, ResultReadStr),
461 CS_SizeA(pCS, ResultReadStr),
462 lpBuf, dwBufLen, uCodePage);
463 break;
464
466 dwBufLen = Imm32CompClauseAnsiToWide(CS_Clause(pCS, ResultReadClause),
467 CS_Size(pCS, ResultReadClause),
468 CS_StrA(pCS, ResultReadStr),
469 lpBuf, dwBufLen, uCodePage);
470 break;
471
472 case GCS_RESULTSTR:
473 dwBufLen = Imm32CompStrAnsiToWide(CS_StrA(pCS, ResultStr),
474 CS_SizeA(pCS, ResultStr),
475 lpBuf, dwBufLen, uCodePage);
476 break;
477
478 case GCS_RESULTCLAUSE:
479 dwBufLen = Imm32CompClauseAnsiToWide(CS_Clause(pCS, ResultClause),
480 CS_Size(pCS, ResultClause),
481 CS_StrA(pCS, ResultStr),
482 lpBuf, dwBufLen, uCodePage);
483 break;
484
485 case GCS_PRIVATE:
486 return CS_DoPrivate(hIMC, pCS, lpBuf, dwBufLen);
487
488 default:
489 FIXME("0x%X\n", dwIndex);
490 return IMM_ERROR_GENERAL;
491 }
492 }
493 else /* !bAnsiClient */
494 {
495 switch (dwIndex)
496 {
497 case GCS_COMPREADSTR:
498 CS_DoStrW(pCS, CompReadStr);
499 break;
500
501 case GCS_COMPREADATTR:
502 CS_DoAttr(pCS, CompReadAttr);
503 break;
504
506 CS_DoClause(pCS, CompReadClause);
507 break;
508
509 case GCS_COMPSTR:
510 CS_DoStrW(pCS, CompStr);
511 break;
512
513 case GCS_COMPATTR:
514 CS_DoAttr(pCS, CompAttr);
515 break;
516
517 case GCS_COMPCLAUSE:
518 CS_DoClause(pCS, CompClause);
519 break;
520
521 case GCS_CURSORPOS:
522 dwBufLen = pCS->dwCursorPos;
523 break;
524
525 case GCS_DELTASTART:
526 dwBufLen = pCS->dwDeltaStart;
527 break;
528
530 CS_DoStrW(pCS, ResultReadStr);
531 break;
532
534 CS_DoClause(pCS, ResultReadClause);
535 break;
536
537 case GCS_RESULTSTR:
538 CS_DoStrW(pCS, ResultStr);
539 break;
540
541 case GCS_RESULTCLAUSE:
542 CS_DoClause(pCS, ResultClause);
543 break;
544
545 case GCS_PRIVATE:
546 return CS_DoPrivate(hIMC, pCS, lpBuf, dwBufLen);
547
548 default:
549 FIXME("0x%X\n", dwIndex);
550 return IMM_ERROR_GENERAL;
551 }
552 }
553
554 return dwBufLen;
555}
556
557static BOOL
559 _In_ HIMC hIMC,
560 _In_ DWORD dwIndex,
561 _Inout_updates_bytes_opt_(dwCompLen) LPVOID pComp,
562 _In_ DWORD dwCompLen,
563 _Inout_updates_bytes_opt_(dwReadLen) LPVOID pRead,
564 _In_ DWORD dwReadLen,
565 _In_ BOOL bAnsiAPI)
566{
567 BOOL ret = FALSE, bAnsiClient;
568 LPVOID pCompNew = NULL, pReadNew = NULL;
569 DWORD dwThreadId, cbCompNew = 0, cbReadNew = 0;
570 LPINPUTCONTEXT pIC;
572 HKL hKL;
573 PIMEDPI pImeDpi;
574 UINT uCodePage;
575 LPRECONVERTSTRING pRS;
576
579 {
580 ERR("Thread mismatch\n");
581 return FALSE;
582 }
583
585 pImeDpi = ImmLockImeDpi(hKL);
586 if (IS_NULL_UNEXPECTEDLY(pImeDpi))
587 return FALSE;
588
589 uCodePage = pImeDpi->uCodePage;
590 bAnsiClient = !ImeDpi_IsUnicode(pImeDpi);
591
592 switch (dwIndex)
593 {
595 break;
596
599 break;
600 /* FALL THROUGH */
601 default:
602 ERR("0x%X\n", dwIndex);
603 ImmUnlockImeDpi(pImeDpi);
604 return FALSE;
605 }
606
607 if (bAnsiAPI == bAnsiClient || (!pComp && !pRead)) /* No conversion needed */
608 {
609 ret = pImeDpi->ImeSetCompositionString(hIMC, dwIndex, pComp, dwCompLen,
610 pRead, dwReadLen);
611 ImmUnlockImeDpi(pImeDpi);
612 return ret;
613 }
614
615 if (!Imm32OpenICAndCS(hIMC, &pIC, &pCS))
616 {
617 ImmUnlockImeDpi(pImeDpi);
618 return FALSE;
619 }
620
621 /*
622 * This code is really too complicated. But I cannot simplify.
623 * It converts like (pComp, dwCompLen) --> (pCompNew, cbCompNew) and
624 * (pRead, dwReadLen) --> (pReadNew, cbReadNew).
625 * (1) Check bAnsiClient, (2) Get the size, (3) Allocate a buffer for conversion,
626 * (4) Store converted data into the buffer.
627 */
628 switch (dwIndex)
629 {
630 case SCS_SETSTR:
631 if (pComp)
632 {
633 if (bAnsiClient)
634 {
635 cbCompNew = Imm32CompStrWideToAnsi(pComp, dwCompLen, NULL, 0, uCodePage);
636 pCompNew = ImmLocalAlloc(0, cbCompNew);
637 if (IS_NULL_UNEXPECTEDLY(pCompNew))
638 goto Quit;
639
640 Imm32CompStrWideToAnsi(pComp, dwCompLen, pCompNew, cbCompNew, uCodePage);
641 }
642 else
643 {
644 cbCompNew = Imm32CompStrAnsiToWide(pComp, dwCompLen, NULL, 0, uCodePage);
645 pCompNew = ImmLocalAlloc(0, cbCompNew);
646 if (IS_NULL_UNEXPECTEDLY(pCompNew))
647 goto Quit;
648
649 Imm32CompStrAnsiToWide(pComp, dwCompLen, pCompNew, cbCompNew, uCodePage);
650 }
651 }
652
653 if (pRead)
654 {
655 if (bAnsiClient)
656 {
657 cbReadNew = Imm32CompStrWideToAnsi(pRead, dwReadLen, NULL, 0, uCodePage);
658 pReadNew = ImmLocalAlloc(0, cbReadNew);
659 if (IS_NULL_UNEXPECTEDLY(pReadNew))
660 goto Quit;
661
662 Imm32CompStrWideToAnsi(pRead, dwReadLen, pReadNew, cbReadNew, uCodePage);
663 }
664 else
665 {
666 cbReadNew = Imm32CompStrAnsiToWide(pRead, dwReadLen, NULL, 0, uCodePage);
667 pReadNew = ImmLocalAlloc(0, cbReadNew);
668 if (IS_NULL_UNEXPECTEDLY(pReadNew))
669 goto Quit;
670
671 Imm32CompStrAnsiToWide(pRead, dwReadLen, pReadNew, cbReadNew, uCodePage);
672 }
673 }
674 break;
675
676 case SCS_CHANGEATTR:
677 if (pComp)
678 {
679 if (bAnsiClient)
680 {
681 cbCompNew = Imm32CompAttrWideToAnsi(pComp, dwCompLen,
682 CS_StrW(pCS, CompStr),
683 CS_SizeW(pCS, CompStr),
684 NULL, 0, uCodePage);
685 pCompNew = ImmLocalAlloc(0, cbCompNew);
686 if (IS_NULL_UNEXPECTEDLY(pCompNew))
687 goto Quit;
688
689 Imm32CompAttrWideToAnsi(pComp, dwCompLen,
690 CS_StrW(pCS, CompStr), CS_SizeW(pCS, CompStr),
691 pCompNew, cbCompNew, uCodePage);
692 }
693 else
694 {
695 cbCompNew = Imm32CompAttrAnsiToWide(pComp, dwCompLen,
696 CS_StrA(pCS, CompStr),
697 CS_SizeA(pCS, CompStr),
698 NULL, 0, uCodePage);
699 pCompNew = ImmLocalAlloc(0, cbCompNew);
700 if (IS_NULL_UNEXPECTEDLY(pCompNew))
701 goto Quit;
702
703 Imm32CompAttrAnsiToWide(pComp, dwCompLen,
704 CS_StrA(pCS, CompStr), CS_SizeA(pCS, CompStr),
705 pCompNew, cbCompNew, uCodePage);
706 }
707 }
708
709 if (pRead)
710 {
711 if (bAnsiClient)
712 {
713 cbReadNew = Imm32CompAttrWideToAnsi(pRead, dwReadLen,
714 CS_StrW(pCS, CompReadStr),
715 CS_SizeW(pCS, CompReadStr),
716 NULL, 0, uCodePage);
717 pReadNew = ImmLocalAlloc(0, cbReadNew);
718 if (IS_NULL_UNEXPECTEDLY(pReadNew))
719 goto Quit;
720
721 Imm32CompAttrWideToAnsi(pRead, dwReadLen,
722 CS_StrW(pCS, CompReadStr), CS_SizeW(pCS, CompReadStr),
723 pReadNew, cbReadNew, uCodePage);
724 }
725 else
726 {
727 cbReadNew = Imm32CompAttrAnsiToWide(pRead, dwReadLen,
728 CS_StrA(pCS, CompReadStr),
729 CS_SizeA(pCS, CompReadStr),
730 NULL, 0, uCodePage);
731 pReadNew = ImmLocalAlloc(0, cbReadNew);
732 if (IS_NULL_UNEXPECTEDLY(pReadNew))
733 goto Quit;
734
735 Imm32CompAttrAnsiToWide(pRead, dwReadLen,
736 CS_StrA(pCS, CompReadStr), CS_SizeA(pCS, CompReadStr),
737 pReadNew, cbReadNew, uCodePage);
738 }
739 }
740 break;
741
742 case SCS_CHANGECLAUSE:
743 if (pComp)
744 {
745 if (bAnsiClient)
746 {
747 cbCompNew = Imm32CompClauseWideToAnsi(pComp, dwCompLen, CS_StrW(pCS, CompStr),
748 NULL, 0, uCodePage);
749 pCompNew = ImmLocalAlloc(0, cbCompNew);
750 if (IS_NULL_UNEXPECTEDLY(pCompNew))
751 goto Quit;
752
753 Imm32CompClauseWideToAnsi(pComp, dwCompLen, CS_StrW(pCS, CompStr),
754 pCompNew, cbCompNew, uCodePage);
755 }
756 else
757 {
758 cbCompNew = Imm32CompClauseAnsiToWide(pComp, dwCompLen, CS_StrA(pCS, CompStr),
759 NULL, 0, uCodePage);
760 pCompNew = ImmLocalAlloc(0, cbCompNew);
761 if (IS_NULL_UNEXPECTEDLY(pCompNew))
762 goto Quit;
763
764 Imm32CompClauseAnsiToWide(pComp, dwCompLen, CS_StrA(pCS, CompStr),
765 pCompNew, cbCompNew, uCodePage);
766 }
767 }
768
769 if (pRead)
770 {
771 if (bAnsiClient)
772 {
773 cbReadNew = Imm32CompClauseWideToAnsi(pRead, dwReadLen, CS_StrW(pCS, CompReadStr),
774 NULL, 0, uCodePage);
775 pReadNew = ImmLocalAlloc(0, cbReadNew);
776 if (IS_NULL_UNEXPECTEDLY(pReadNew))
777 goto Quit;
778
779 Imm32CompClauseWideToAnsi(pRead, dwReadLen,
780 CS_StrW(pCS, CompReadStr),
781 pReadNew, cbReadNew, uCodePage);
782 }
783 else
784 {
785 cbReadNew = Imm32CompClauseAnsiToWide(pRead, dwReadLen, CS_StrA(pCS, CompReadStr),
786 NULL, 0, uCodePage);
787 pReadNew = ImmLocalAlloc(0, cbReadNew);
788 if (IS_NULL_UNEXPECTEDLY(pReadNew))
789 goto Quit;
790
791 Imm32CompClauseAnsiToWide(pRead, dwReadLen, CS_StrA(pCS, CompReadStr),
792 pReadNew, cbReadNew, uCodePage);
793 }
794 }
795 break;
796
798 {
799 if (pComp)
800 {
801 if (bAnsiClient)
802 {
803 cbCompNew = Imm32ReconvertAnsiFromWide(NULL, pComp, uCodePage);
804 pCompNew = ImmLocalAlloc(0, cbCompNew);
805 if (IS_NULL_UNEXPECTEDLY(pCompNew))
806 goto Quit;
807
808 pRS = pCompNew;
809 pRS->dwSize = cbCompNew;
810 pRS->dwVersion = 0;
811 Imm32ReconvertAnsiFromWide(pRS, pComp, uCodePage);
812 }
813 else
814 {
815 cbCompNew = Imm32ReconvertWideFromAnsi(NULL, pComp, uCodePage);
816 pCompNew = ImmLocalAlloc(0, cbCompNew);
817 if (IS_NULL_UNEXPECTEDLY(pCompNew))
818 goto Quit;
819
820 pRS = pCompNew;
821 pRS->dwSize = cbCompNew;
822 pRS->dwVersion = 0;
823 Imm32ReconvertWideFromAnsi(pRS, pComp, uCodePage);
824 }
825 }
826
827 if (pRead)
828 {
829 if (bAnsiClient)
830 {
831 cbReadNew = Imm32ReconvertAnsiFromWide(NULL, pRead, uCodePage);
832 pReadNew = ImmLocalAlloc(0, cbReadNew);
833 if (IS_NULL_UNEXPECTEDLY(pReadNew))
834 goto Quit;
835
836 pRS = pReadNew;
837 pRS->dwSize = cbReadNew;
838 pRS->dwVersion = 0;
839 Imm32ReconvertAnsiFromWide(pRS, pRead, uCodePage);
840 }
841 else
842 {
843 cbReadNew = Imm32ReconvertWideFromAnsi(NULL, pRead, uCodePage);
844 pReadNew = ImmLocalAlloc(0, cbReadNew);
845 if (IS_NULL_UNEXPECTEDLY(pReadNew))
846 goto Quit;
847
848 pRS = pReadNew;
849 pRS->dwSize = cbReadNew;
850 pRS->dwVersion = 0;
851 Imm32ReconvertWideFromAnsi(pRS, pRead, uCodePage);
852 }
853 }
854 break;
855 }
856 }
857
859 pCS = NULL;
860 ImmUnlockIMC(hIMC);
861 pIC = NULL;
862
863 ret = pImeDpi->ImeSetCompositionString(hIMC, dwIndex, pCompNew, cbCompNew,
864 pReadNew, cbReadNew);
865
866 if (dwIndex == SCS_QUERYRECONVERTSTRING)
867 {
868 if (pComp)
869 {
870 if (bAnsiClient)
871 ret = Imm32ReconvertWideFromAnsi(pComp, pCompNew, uCodePage);
872 else
873 ret = Imm32ReconvertAnsiFromWide(pComp, pCompNew, uCodePage);
874 }
875
876 if (pRead)
877 {
878 if (bAnsiClient)
879 ret = Imm32ReconvertWideFromAnsi(pRead, pReadNew, uCodePage);
880 else
881 ret = Imm32ReconvertAnsiFromWide(pRead, pReadNew, uCodePage);
882 }
883 }
884
885Quit:
886 if (pCS)
888 if (pIC)
889 ImmUnlockIMC(hIMC);
890 ImmLocalFree(pCompNew);
891 ImmLocalFree(pReadNew);
892 ImmUnlockImeDpi(pImeDpi);
893 TRACE("ret: %d\n", ret);
894 return ret;
895}
896
897/***********************************************************************
898 * ImmGetCompositionStringA (IMM32.@)
899 */
902 _In_ HIMC hIMC,
903 _In_ DWORD dwIndex,
904 _Out_writes_bytes_opt_(dwBufLen) LPVOID lpBuf,
905 _In_ DWORD dwBufLen)
906{
907 LONG ret = 0;
908 LPINPUTCONTEXT pIC;
909 PCLIENTIMC pClientImc;
911 BOOL bAnsiClient;
912 UINT uCodePage;
913
914 TRACE("(%p, %lu, %p, %lu)\n", hIMC, dwIndex, lpBuf, dwBufLen);
915
916 if (dwBufLen && IS_NULL_UNEXPECTEDLY(lpBuf))
917 return 0;
918
919 pClientImc = ImmLockClientImc(hIMC);
920 if (IS_NULL_UNEXPECTEDLY(pClientImc))
921 return 0;
922
923 bAnsiClient = !(pClientImc->dwFlags & CLIENTIMC_WIDE);
924 uCodePage = pClientImc->uCodePage;
925 ImmUnlockClientImc(pClientImc);
926
927 pIC = ImmLockIMC(hIMC);
928 if (IS_NULL_UNEXPECTEDLY(pIC))
929 return 0;
930
931 pCS = ImmLockIMCC(pIC->hCompStr);
932 if (IS_NULL_UNEXPECTEDLY(pCS))
933 {
934 ImmUnlockIMC(hIMC);
935 return 0;
936 }
937
938 ret = Imm32GetCompStrA(hIMC, pCS, dwIndex, lpBuf, dwBufLen, bAnsiClient, uCodePage);
940 ImmUnlockIMC(hIMC);
941 TRACE("ret: %ld\n", ret);
942 return ret;
943}
944
945/***********************************************************************
946 * ImmGetCompositionStringW (IMM32.@)
947 */
950 _In_ HIMC hIMC,
951 _In_ DWORD dwIndex,
952 _Out_writes_bytes_opt_(dwBufLen) LPVOID lpBuf,
953 _In_ DWORD dwBufLen)
954{
955 LONG ret = 0;
956 LPINPUTCONTEXT pIC;
957 PCLIENTIMC pClientImc;
959 BOOL bAnsiClient;
960 UINT uCodePage;
961
962 TRACE("(%p, %lu, %p, %lu)\n", hIMC, dwIndex, lpBuf, dwBufLen);
963
964 if (dwBufLen && IS_NULL_UNEXPECTEDLY(lpBuf))
965 return 0;
966
967 pClientImc = ImmLockClientImc(hIMC);
968 if (IS_NULL_UNEXPECTEDLY(pClientImc))
969 return 0;
970
971 bAnsiClient = !(pClientImc->dwFlags & CLIENTIMC_WIDE);
972 uCodePage = pClientImc->uCodePage;
973 ImmUnlockClientImc(pClientImc);
974
975 pIC = ImmLockIMC(hIMC);
976 if (IS_NULL_UNEXPECTEDLY(pIC))
977 return 0;
978
979 pCS = ImmLockIMCC(pIC->hCompStr);
980 if (IS_NULL_UNEXPECTEDLY(pCS))
981 {
982 ImmUnlockIMC(hIMC);
983 return 0;
984 }
985
986 ret = Imm32GetCompStrW(hIMC, pCS, dwIndex, lpBuf, dwBufLen, bAnsiClient, uCodePage);
988 ImmUnlockIMC(hIMC);
989 TRACE("ret: %ld\n", ret);
990 return ret;
991}
992
993/***********************************************************************
994 * ImmSetCompositionStringA (IMM32.@)
995 */
998 _In_ HIMC hIMC,
999 _In_ DWORD dwIndex,
1000 _Inout_updates_bytes_opt_(dwCompLen) LPVOID lpComp,
1001 _In_ DWORD dwCompLen,
1002 _Inout_updates_bytes_opt_(dwReadLen) LPVOID lpRead,
1003 _In_ DWORD dwReadLen)
1004{
1005 TRACE("(%p, %lu, %p, %lu, %p, %lu)\n",
1006 hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen);
1007 return ImmSetCompositionStringAW(hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen, TRUE);
1008}
1009
1010/***********************************************************************
1011 * ImmSetCompositionStringW (IMM32.@)
1012 */
1015 _In_ HIMC hIMC,
1016 _In_ DWORD dwIndex,
1017 _Inout_updates_bytes_opt_(dwCompLen) LPVOID lpComp,
1018 _In_ DWORD dwCompLen,
1019 _Inout_updates_bytes_opt_(dwReadLen) LPVOID lpRead,
1020 _In_ DWORD dwReadLen)
1021{
1022 TRACE("(%p, %lu, %p, %lu, %p, %lu)\n",
1023 hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen);
1024 return ImmSetCompositionStringAW(hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen, FALSE);
1025}
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define CHAR(Char)
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERR(fmt,...)
Definition: precomp.h:57
BOOL WINAPI ImmSetCompositionStringW(_In_ HIMC hIMC, _In_ DWORD dwIndex, _Inout_updates_bytes_opt_(dwCompLen) LPVOID lpComp, _In_ DWORD dwCompLen, _Inout_updates_bytes_opt_(dwReadLen) LPVOID lpRead, _In_ DWORD dwReadLen)
Definition: compstr.c:1014
static BOOL ImmSetCompositionStringAW(_In_ HIMC hIMC, _In_ DWORD dwIndex, _Inout_updates_bytes_opt_(dwCompLen) LPVOID pComp, _In_ DWORD dwCompLen, _Inout_updates_bytes_opt_(dwReadLen) LPVOID pRead, _In_ DWORD dwReadLen, _In_ BOOL bAnsiAPI)
Definition: compstr.c:558
BOOL WINAPI ImmSetCompositionStringA(_In_ HIMC hIMC, _In_ DWORD dwIndex, _Inout_updates_bytes_opt_(dwCompLen) LPVOID lpComp, _In_ DWORD dwCompLen, _Inout_updates_bytes_opt_(dwReadLen) LPVOID lpRead, _In_ DWORD dwReadLen)
Definition: compstr.c:997
static INT Imm32CompClauseWideToAnsi(const DWORD *source, INT slen, LPCWSTR text, LPDWORD target, INT tlen, UINT uCodePage)
Definition: compstr.c:164
static LONG Imm32CompStrWideToAnsi(LPCWSTR psz, DWORD cb, LPSTR lpBuf, DWORD dwBufLen, UINT uCodePage)
Definition: compstr.c:52
static LONG Imm32CompStrAnsiToWide(LPCSTR psz, DWORD cb, LPWSTR lpBuf, DWORD dwBufLen, UINT uCodePage)
Definition: compstr.c:42
#define CS_SizeW(pCS, Name)
Definition: compstr.c:200
#define CS_StrW(pCS, Name)
Definition: compstr.c:195
static INT Imm32CompAttrWideToAnsi(const BYTE *src, INT src_len, LPCWSTR text, INT str_len, LPBYTE dst, INT dst_len, UINT uCodePage)
Definition: compstr.c:62
static LONG Imm32GetCompStrW(HIMC hIMC, const COMPOSITIONSTRING *pCS, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen, BOOL bAnsiClient, UINT uCodePage)
Definition: compstr.c:403
#define CS_StrA(pCS, Name)
Definition: compstr.c:194
LONG WINAPI ImmGetCompositionStringA(_In_ HIMC hIMC, _In_ DWORD dwIndex, _Out_writes_bytes_opt_(dwBufLen) LPVOID lpBuf, _In_ DWORD dwBufLen)
Definition: compstr.c:901
#define CS_SizeA(pCS, Name)
Definition: compstr.c:199
static DWORD CS_DoPrivate(HIMC hIMC, const COMPOSITIONSTRING *pCS, PVOID pBuffer, DWORD dwBufLen)
Definition: compstr.c:217
#define CS_DoStrW(pCS, Name)
Definition: compstr.c:213
BOOL Imm32OpenICAndCS(HIMC hIMC, LPINPUTCONTEXT *ppIC, LPCOMPOSITIONSTRING *ppCS)
Definition: compstr.c:17
static LONG Imm32GetCompStrA(HIMC hIMC, const COMPOSITIONSTRING *pCS, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen, BOOL bAnsiClient, UINT uCodePage)
Definition: compstr.c:247
#define CS_DoClause
Definition: compstr.c:215
static INT Imm32CompAttrAnsiToWide(const BYTE *src, INT src_len, LPCSTR text, INT str_len, LPBYTE dst, INT dst_len, UINT uCodePage)
Definition: compstr.c:98
#define CS_Attr(pCS, Name)
Definition: compstr.c:196
#define CS_Clause(pCS, Name)
Definition: compstr.c:197
#define CS_DoAttr
Definition: compstr.c:214
#define CS_Size(pCS, Name)
Definition: compstr.c:198
LONG WINAPI ImmGetCompositionStringW(_In_ HIMC hIMC, _In_ DWORD dwIndex, _Out_writes_bytes_opt_(dwBufLen) LPVOID lpBuf, _In_ DWORD dwBufLen)
Definition: compstr.c:949
#define CS_DoStrA(pCS, Name)
Definition: compstr.c:212
static INT Imm32CompClauseAnsiToWide(const DWORD *source, INT slen, LPCSTR text, LPDWORD target, INT tlen, UINT uCodePage)
Definition: compstr.c:133
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 WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
BOOL WINAPI IsDBCSLeadByteEx(UINT codepage, BYTE testchar)
Definition: locale.c:2106
static MonoProfilerRuntimeShutdownBeginCallback cb
Definition: metahost.c:118
const WCHAR * text
Definition: package.c:1794
return ret
Definition: mutex.c:146
DWORD dwThreadId
Definition: fdebug.c:31
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint end
Definition: gl.h:1545
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define GCS_PRIVATE
Definition: imm32_undoc.h:35
PCLIENTIMC WINAPI ImmLockClientImc(_In_ HIMC hImc)
Definition: imm.c:955
BOOL WINAPI CtfImmIsGuidMapEnable(_In_ HIMC hIMC)
Definition: ctf.c:1435
PIMEDPI WINAPI ImmLockImeDpi(_In_ HKL hKL)
Definition: ime.c:532
VOID WINAPI ImmUnlockImeDpi(_Inout_opt_ PIMEDPI pImeDpi)
Definition: ime.c:562
VOID WINAPI ImmUnlockClientImc(_Inout_ PCLIENTIMC pClientImc)
Definition: imm.c:1002
#define CLIENTIMC_WIDE
Definition: imm32_undoc.h:183
#define SCS_SETRECONVERTSTRING
Definition: imm.h:311
#define SCS_CHANGECLAUSE
Definition: imm.h:310
#define GCS_COMPATTR
Definition: imm.h:228
#define GCS_COMPREADATTR
Definition: imm.h:225
#define GCS_COMPREADSTR
Definition: imm.h:224
#define GCS_RESULTSTR
Definition: imm.h:234
#define GCS_DELTASTART
Definition: imm.h:231
#define GCS_RESULTCLAUSE
Definition: imm.h:235
#define GCS_COMPCLAUSE
Definition: imm.h:229
#define GCS_RESULTREADSTR
Definition: imm.h:232
#define IMM_ERROR_GENERAL
Definition: imm.h:402
#define SCS_SETSTR
Definition: imm.h:308
#define GCS_COMPREADCLAUSE
Definition: imm.h:226
#define SCS_CAP_SETRECONVERTSTRING
Definition: imm.h:261
#define GCS_COMPSTR
Definition: imm.h:227
#define GCS_CURSORPOS
Definition: imm.h:230
#define GCS_RESULTREADCLAUSE
Definition: imm.h:233
#define SCS_CHANGEATTR
Definition: imm.h:309
#define SCS_QUERYRECONVERTSTRING
Definition: imm.h:312
BOOL WINAPI ImmUnlockIMCC(_In_ HIMCC imcc)
Definition: utils.c:613
LPINPUTCONTEXT WINAPI ImmLockIMC(_In_ HIMC hIMC)
Definition: imm.c:1080
BOOL WINAPI ImmUnlockIMC(_In_ HIMC hIMC)
Definition: imm.c:1090
LPVOID WINAPI ImmLockIMCC(_In_ HIMCC imcc)
Definition: utils.c:602
DWORD_PTR NTAPI NtUserQueryInputContext(HIMC hIMC, DWORD dwType)
Definition: ime.c:1894
#define CopyMemory
Definition: minwinbase.h:29
#define min(a, b)
Definition: monoChain.cc:55
int k
Definition: mpi.c:3369
UINT_PTR HKL
Definition: msctf.idl:125
unsigned int UINT
Definition: ndis.h:50
#define _Inout_updates_bytes_opt_(s)
Definition: no_sal2.h:234
#define _Out_writes_bytes_opt_(s)
Definition: no_sal2.h:228
#define _In_
Definition: no_sal2.h:158
#define DWORD
Definition: nt_native.h:44
#define UNICODE_NULL
#define ANSI_NULL
_In_ DWORD _In_ DWORD dwOffset
Definition: ntgdi.h:2033
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
char CHAR
Definition: pedump.c:57
PVOID pBuffer
#define TRACE(s)
Definition: solgame.cpp:4
IMEINFO ImeInfo
Definition: imm32_undoc.h:108
UINT uCodePage
Definition: imm32_undoc.h:109
DWORD fdwSCSCaps
Definition: immdev.h:26
HIMCC hCompStr
Definition: immdev.h:119
DWORD dwPrivateSize
Definition: immdev.h:71
DWORD dwDeltaStart
Definition: immdev.h:62
DWORD dwPrivateOffset
Definition: immdev.h:72
Definition: tools.h:99
#define str_len
Definition: treelist.c:89
const char * LPCSTR
Definition: typedefs.h:52
const uint16_t * LPCWSTR
Definition: typedefs.h:57
unsigned char * LPBYTE
Definition: typedefs.h:53
uint16_t * LPWSTR
Definition: typedefs.h:56
uint32_t * LPDWORD
Definition: typedefs.h:59
char * LPSTR
Definition: typedefs.h:51
int32_t INT
Definition: typedefs.h:58
@ QIC_INPUTTHREADID
Definition: undocuser.h:413
LONG IchAnsiFromWide(LONG cchWide, LPCWSTR pchWide, UINT uCodePage)
Definition: utils.c:140
DWORD Imm32ReconvertWideFromAnsi(LPRECONVERTSTRING pDest, const RECONVERTSTRING *pSrc, UINT uCodePage)
Definition: utils.c:450
#define ImmLocalFree(lpData)
Definition: precomp.h:102
LONG IchWideFromAnsi(LONG cchAnsi, LPCSTR pchAnsi, UINT uCodePage)
Definition: utils.c:120
#define IS_NULL_UNEXPECTEDLY(p)
Definition: precomp.h:67
DWORD Imm32ReconvertAnsiFromWide(LPRECONVERTSTRING pDest, const RECONVERTSTRING *pSrc, UINT uCodePage)
Definition: utils.c:512
LPVOID ImmLocalAlloc(_In_ DWORD dwFlags, _In_ DWORD dwBytes)
Definition: utils.c:275
#define ImeDpi_IsUnicode(pImeDpi)
Definition: precomp.h:117
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
#define WINAPI
Definition: msvc.h:6
#define MB_PRECOMPOSED
Definition: winnls.h:299
HKL WINAPI GetKeyboardLayout(_In_ DWORD)
unsigned char BYTE
Definition: xxhash.c:193