ReactOS 0.4.15-dev-7674-gc0b4db1
compstr.c File Reference
#include "precomp.h"
Include dependency graph for compstr.c:

Go to the source code of this file.

Macros

#define CS_StrA(pCS, Name)   ((LPCSTR)(pCS) + (pCS)->dw##Name##Offset)
 
#define CS_StrW(pCS, Name)   ((LPCWSTR)CS_StrA(pCS, Name))
 
#define CS_Attr(pCS, Name)   ((const BYTE *)CS_StrA(pCS, Name))
 
#define CS_Clause(pCS, Name)   ((const DWORD *)CS_StrA(pCS, Name))
 
#define CS_Size(pCS, Name)   ((pCS)->dw##Name##Len)
 
#define CS_SizeA(pCS, Name)   (CS_Size(pCS, Name) * sizeof(CHAR))
 
#define CS_SizeW(pCS, Name)   (CS_Size(pCS, Name) * sizeof(WCHAR))
 
#define CS_DoStr(pCS, Name, AorW)
 
#define CS_DoStrA(pCS, Name)   CS_DoStr(pCS, Name, A)
 
#define CS_DoStrW(pCS, Name)   CS_DoStr(pCS, Name, W)
 
#define CS_DoAttr   CS_DoStrA
 
#define CS_DoClause   CS_DoStrA
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (imm)
 
BOOL APIENTRY Imm32OpenICAndCS (HIMC hIMC, LPINPUTCONTEXT *ppIC, LPCOMPOSITIONSTRING *ppCS)
 
static LONG APIENTRY Imm32CompStrAnsiToWide (LPCSTR psz, DWORD cb, LPWSTR lpBuf, DWORD dwBufLen, UINT uCodePage)
 
static LONG APIENTRY Imm32CompStrWideToAnsi (LPCWSTR psz, DWORD cb, LPSTR lpBuf, DWORD dwBufLen, UINT uCodePage)
 
static INT APIENTRY Imm32CompAttrWideToAnsi (const BYTE *src, INT src_len, LPCWSTR text, INT str_len, LPBYTE dst, INT dst_len, UINT uCodePage)
 
static INT APIENTRY Imm32CompAttrAnsiToWide (const BYTE *src, INT src_len, LPCSTR text, INT str_len, LPBYTE dst, INT dst_len, UINT uCodePage)
 
static INT APIENTRY Imm32CompClauseAnsiToWide (const DWORD *source, INT slen, LPCSTR text, LPDWORD target, INT tlen, UINT uCodePage)
 
static INT APIENTRY Imm32CompClauseWideToAnsi (const DWORD *source, INT slen, LPCWSTR text, LPDWORD target, INT tlen, UINT uCodePage)
 
LONG APIENTRY Imm32GetCompStrA (HIMC hIMC, const COMPOSITIONSTRING *pCS, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen, BOOL bAnsiClient, UINT uCodePage)
 
LONG APIENTRY Imm32GetCompStrW (HIMC hIMC, const COMPOSITIONSTRING *pCS, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen, BOOL bAnsiClient, UINT uCodePage)
 
BOOL APIENTRY ImmSetCompositionStringAW (HIMC hIMC, DWORD dwIndex, LPVOID pComp, DWORD dwCompLen, LPVOID pRead, DWORD dwReadLen, BOOL bAnsiAPI)
 
LONG WINAPI ImmGetCompositionStringA (HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
 
LONG WINAPI ImmGetCompositionStringW (HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
 
BOOL WINAPI ImmSetCompositionStringA (HIMC hIMC, DWORD dwIndex, LPVOID lpComp, DWORD dwCompLen, LPVOID lpRead, DWORD dwReadLen)
 
BOOL WINAPI ImmSetCompositionStringW (HIMC hIMC, DWORD dwIndex, LPVOID lpComp, DWORD dwCompLen, LPVOID lpRead, DWORD dwReadLen)
 

Macro Definition Documentation

◆ CS_Attr

#define CS_Attr (   pCS,
  Name 
)    ((const BYTE *)CS_StrA(pCS, Name))

Definition at line 196 of file compstr.c.

◆ CS_Clause

#define CS_Clause (   pCS,
  Name 
)    ((const DWORD *)CS_StrA(pCS, Name))

Definition at line 197 of file compstr.c.

◆ CS_DoAttr

#define CS_DoAttr   CS_DoStrA

Definition at line 214 of file compstr.c.

◆ CS_DoClause

#define CS_DoClause   CS_DoStrA

Definition at line 215 of file compstr.c.

◆ CS_DoStr

#define CS_DoStr (   pCS,
  Name,
  AorW 
)
Value:
do { \
if (dwBufLen == 0) { \
dwBufLen = CS_Size##AorW((pCS), Name); \
} else { \
if (dwBufLen > CS_Size##AorW((pCS), Name)) \
dwBufLen = CS_Size##AorW((pCS), Name); \
RtlCopyMemory(lpBuf, CS_Str##AorW((pCS), Name), dwBufLen); \
} \
} while (0)
#define AorW(a, w)
#define CS_Size(pCS, Name)
Definition: compstr.c:198
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_ DWORD _In_ DWORD dwBufLen
Definition: wincrypt.h:4246

Definition at line 202 of file compstr.c.

◆ CS_DoStrA

#define CS_DoStrA (   pCS,
  Name 
)    CS_DoStr(pCS, Name, A)

Definition at line 212 of file compstr.c.

◆ CS_DoStrW

#define CS_DoStrW (   pCS,
  Name 
)    CS_DoStr(pCS, Name, W)

Definition at line 213 of file compstr.c.

◆ CS_Size

#define CS_Size (   pCS,
  Name 
)    ((pCS)->dw##Name##Len)

Definition at line 198 of file compstr.c.

◆ CS_SizeA

#define CS_SizeA (   pCS,
  Name 
)    (CS_Size(pCS, Name) * sizeof(CHAR))

Definition at line 199 of file compstr.c.

◆ CS_SizeW

#define CS_SizeW (   pCS,
  Name 
)    (CS_Size(pCS, Name) * sizeof(WCHAR))

Definition at line 200 of file compstr.c.

◆ CS_StrA

#define CS_StrA (   pCS,
  Name 
)    ((LPCSTR)(pCS) + (pCS)->dw##Name##Offset)

Definition at line 194 of file compstr.c.

◆ CS_StrW

#define CS_StrW (   pCS,
  Name 
)    ((LPCWSTR)CS_StrA(pCS, Name))

Definition at line 195 of file compstr.c.

Function Documentation

◆ Imm32CompAttrAnsiToWide()

static INT APIENTRY Imm32CompAttrAnsiToWide ( const BYTE src,
INT  src_len,
LPCSTR  text,
INT  str_len,
LPBYTE  dst,
INT  dst_len,
UINT  uCodePage 
)
static

Definition at line 98 of file compstr.c.

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}
#define CHAR(Char)
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
BOOL WINAPI IsDBCSLeadByteEx(UINT CodePage, BYTE TestByte)
Definition: nls.c:2337
const WCHAR * text
Definition: package.c:1799
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
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 str_len
Definition: treelist.c:89
int32_t INT
Definition: typedefs.h:58
#define MB_PRECOMPOSED
Definition: winnls.h:281
unsigned char BYTE
Definition: xxhash.c:193

Referenced by Imm32GetCompStrW(), and ImmSetCompositionStringAW().

◆ Imm32CompAttrWideToAnsi()

static INT APIENTRY Imm32CompAttrWideToAnsi ( const BYTE src,
INT  src_len,
LPCWSTR  text,
INT  str_len,
LPBYTE  dst,
INT  dst_len,
UINT  uCodePage 
)
static

Definition at line 62 of file compstr.c.

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}
#define WideCharToMultiByte
Definition: compat.h:111
GLuint GLuint end
Definition: gl.h:1545
GLenum GLsizei len
Definition: glext.h:6722
int k
Definition: mpi.c:3369
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by Imm32GetCompStrA(), and ImmSetCompositionStringAW().

◆ Imm32CompClauseAnsiToWide()

static INT APIENTRY Imm32CompClauseAnsiToWide ( const DWORD source,
INT  slen,
LPCSTR  text,
LPDWORD  target,
INT  tlen,
UINT  uCodePage 
)
static

Definition at line 133 of file compstr.c.

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}
GLenum target
Definition: glext.h:7315
#define DWORD
Definition: nt_native.h:44

Referenced by Imm32GetCompStrW(), and ImmSetCompositionStringAW().

◆ Imm32CompClauseWideToAnsi()

static INT APIENTRY Imm32CompClauseWideToAnsi ( const DWORD source,
INT  slen,
LPCWSTR  text,
LPDWORD  target,
INT  tlen,
UINT  uCodePage 
)
static

Definition at line 164 of file compstr.c.

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}

Referenced by Imm32GetCompStrA(), and ImmSetCompositionStringAW().

◆ Imm32CompStrAnsiToWide()

static LONG APIENTRY Imm32CompStrAnsiToWide ( LPCSTR  psz,
DWORD  cb,
LPWSTR  lpBuf,
DWORD  dwBufLen,
UINT  uCodePage 
)
inlinestatic

Definition at line 42 of file compstr.c.

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] = 0;
48 return ret * sizeof(WCHAR);
49}
unsigned long DWORD
Definition: ntddk_ex.h:95
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
int ret
char CHAR
Definition: xmlstorage.h:175

Referenced by Imm32GetCompStrW(), and ImmSetCompositionStringAW().

◆ Imm32CompStrWideToAnsi()

static LONG APIENTRY Imm32CompStrWideToAnsi ( LPCWSTR  psz,
DWORD  cb,
LPSTR  lpBuf,
DWORD  dwBufLen,
UINT  uCodePage 
)
inlinestatic

Definition at line 52 of file compstr.c.

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] = 0;
58 return ret * sizeof(CHAR);
59}

Referenced by Imm32GetCompStrA(), and ImmSetCompositionStringAW().

◆ Imm32GetCompStrA()

LONG APIENTRY Imm32GetCompStrA ( HIMC  hIMC,
const COMPOSITIONSTRING pCS,
DWORD  dwIndex,
LPVOID  lpBuf,
DWORD  dwBufLen,
BOOL  bAnsiClient,
UINT  uCodePage 
)

Definition at line 219 of file compstr.c.

221{
222 if (bAnsiClient)
223 {
224 switch (dwIndex)
225 {
226 case GCS_COMPREADSTR:
227 CS_DoStrA(pCS, CompReadStr);
228 break;
229
230 case GCS_COMPREADATTR:
231 CS_DoAttr(pCS, CompReadAttr);
232 break;
233
235 CS_DoClause(pCS, CompReadClause);
236 break;
237
238 case GCS_COMPSTR:
239 CS_DoStrA(pCS, CompStr);
240 break;
241
242 case GCS_COMPATTR:
243 CS_DoAttr(pCS, CompAttr);
244 break;
245
246 case GCS_COMPCLAUSE:
247 CS_DoClause(pCS, CompClause);
248 break;
249
250 case GCS_CURSORPOS:
251 dwBufLen = pCS->dwCursorPos;
252 break;
253
254 case GCS_DELTASTART:
255 dwBufLen = pCS->dwDeltaStart;
256 break;
257
259 CS_DoStrA(pCS, ResultReadStr);
260 break;
261
263 CS_DoClause(pCS, ResultReadClause);
264 break;
265
266 case GCS_RESULTSTR:
267 CS_DoStrA(pCS, ResultStr);
268 break;
269
270 case GCS_RESULTCLAUSE:
271 CS_DoClause(pCS, ResultClause);
272 break;
273
274 default:
275 FIXME("0x%X\n", dwIndex);
276 return IMM_ERROR_GENERAL;
277 }
278 }
279 else /* !bAnsiClient */
280 {
281 switch (dwIndex)
282 {
283 case GCS_COMPREADSTR:
284 dwBufLen = Imm32CompStrWideToAnsi(CS_StrW(pCS, CompReadStr),
285 CS_SizeW(pCS, CompReadStr),
286 lpBuf, dwBufLen, uCodePage);
287 break;
288
289 case GCS_COMPREADATTR:
290 dwBufLen = Imm32CompAttrWideToAnsi(CS_Attr(pCS, CompReadAttr),
291 CS_Size(pCS, CompReadAttr),
292 CS_StrW(pCS, CompReadStr),
293 CS_SizeW(pCS, CompReadStr),
294 lpBuf, dwBufLen, uCodePage);
295 break;
296
298 dwBufLen = Imm32CompClauseWideToAnsi(CS_Clause(pCS, CompReadClause),
299 CS_Size(pCS, CompReadClause),
300 CS_StrW(pCS, CompReadStr),
301 lpBuf, dwBufLen, uCodePage);
302 break;
303
304 case GCS_COMPSTR:
306 CS_SizeW(pCS, CompStr),
307 lpBuf, dwBufLen, uCodePage);
308 break;
309
310 case GCS_COMPATTR:
312 CS_Size(pCS, CompAttr),
313 CS_StrW(pCS, CompStr),
314 CS_SizeW(pCS, CompStr),
315 lpBuf, dwBufLen, uCodePage);
316 break;
317
318 case GCS_COMPCLAUSE:
320 CS_Size(pCS, CompClause),
321 CS_StrW(pCS, CompStr),
322 lpBuf, dwBufLen, uCodePage);
323 break;
324
325 case GCS_CURSORPOS:
326 dwBufLen = IchAnsiFromWide(pCS->dwCursorPos, CS_StrW(pCS, CompStr), uCodePage);
327 break;
328
329 case GCS_DELTASTART:
330 dwBufLen = IchAnsiFromWide(pCS->dwDeltaStart, CS_StrW(pCS, CompStr), uCodePage);
331 break;
332
334 dwBufLen = Imm32CompStrWideToAnsi(CS_StrW(pCS, ResultReadStr),
335 CS_SizeW(pCS, ResultReadStr),
336 lpBuf, dwBufLen, uCodePage);
337 break;
338
340 dwBufLen = Imm32CompClauseWideToAnsi(CS_Clause(pCS, ResultReadClause),
341 CS_Size(pCS, ResultReadClause),
342 CS_StrW(pCS, ResultReadStr),
343 lpBuf, dwBufLen, uCodePage);
344 break;
345
346 case GCS_RESULTSTR:
347 dwBufLen = Imm32CompStrWideToAnsi(CS_StrW(pCS, ResultStr),
348 CS_SizeW(pCS, ResultStr),
349 lpBuf, dwBufLen, uCodePage);
350 break;
351
352 case GCS_RESULTCLAUSE:
353 dwBufLen = Imm32CompClauseWideToAnsi(CS_Clause(pCS, ResultClause),
354 CS_Size(pCS, ResultClause),
355 CS_StrW(pCS, ResultStr),
356 lpBuf, dwBufLen, uCodePage);
357 break;
358
359 default:
360 FIXME("0x%X\n", dwIndex);
361 return IMM_ERROR_GENERAL;
362 }
363 }
364
365 return dwBufLen;
366}
#define FIXME(fmt,...)
Definition: debug.h:111
#define CS_SizeW(pCS, Name)
Definition: compstr.c:200
#define CS_StrW(pCS, Name)
Definition: compstr.c:195
static LONG APIENTRY Imm32CompStrWideToAnsi(LPCWSTR psz, DWORD cb, LPSTR lpBuf, DWORD dwBufLen, UINT uCodePage)
Definition: compstr.c:52
static INT APIENTRY Imm32CompAttrWideToAnsi(const BYTE *src, INT src_len, LPCWSTR text, INT str_len, LPBYTE dst, INT dst_len, UINT uCodePage)
Definition: compstr.c:62
#define CS_DoClause
Definition: compstr.c:215
#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
static INT APIENTRY Imm32CompClauseWideToAnsi(const DWORD *source, INT slen, LPCWSTR text, LPDWORD target, INT tlen, UINT uCodePage)
Definition: compstr.c:164
#define CS_DoStrA(pCS, Name)
Definition: compstr.c:212
LONG APIENTRY IchAnsiFromWide(LONG cchWide, LPCWSTR pchWide, UINT uCodePage)
Definition: utils.c:273
#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 GCS_COMPREADCLAUSE
Definition: imm.h:226
#define GCS_COMPSTR
Definition: imm.h:227
#define GCS_CURSORPOS
Definition: imm.h:230
#define GCS_RESULTREADCLAUSE
Definition: imm.h:233
DWORD dwDeltaStart
Definition: immdev.h:62

Referenced by ImmGetCompositionStringA().

◆ Imm32GetCompStrW()

LONG APIENTRY Imm32GetCompStrW ( HIMC  hIMC,
const COMPOSITIONSTRING pCS,
DWORD  dwIndex,
LPVOID  lpBuf,
DWORD  dwBufLen,
BOOL  bAnsiClient,
UINT  uCodePage 
)

Definition at line 370 of file compstr.c.

372{
373 if (bAnsiClient)
374 {
375 switch (dwIndex)
376 {
377 case GCS_COMPREADSTR:
378 dwBufLen = Imm32CompStrAnsiToWide(CS_StrA(pCS, CompReadStr),
379 CS_SizeA(pCS, CompReadStr),
380 lpBuf, dwBufLen, uCodePage);
381 break;
382
383 case GCS_COMPREADATTR:
384 dwBufLen = Imm32CompAttrAnsiToWide(CS_Attr(pCS, CompReadAttr),
385 CS_Size(pCS, CompReadAttr),
386 CS_StrA(pCS, CompReadStr),
387 CS_SizeA(pCS, CompReadStr),
388 lpBuf, dwBufLen, uCodePage);
389 break;
390
392 dwBufLen = Imm32CompClauseAnsiToWide(CS_Clause(pCS, CompReadClause),
393 CS_Size(pCS, CompReadClause),
394 CS_StrA(pCS, CompReadStr),
395 lpBuf, dwBufLen, uCodePage);
396 break;
397
398 case GCS_COMPSTR:
400 CS_SizeA(pCS, CompStr),
401 lpBuf, dwBufLen, uCodePage);
402 break;
403
404 case GCS_COMPATTR:
406 CS_Size(pCS, CompAttr),
407 CS_StrA(pCS, CompStr), CS_SizeA(pCS, CompStr),
408 lpBuf, dwBufLen, uCodePage);
409 break;
410
411 case GCS_COMPCLAUSE:
413 CS_Size(pCS, CompClause),
414 CS_StrA(pCS, CompStr),
415 lpBuf, dwBufLen, uCodePage);
416 break;
417
418 case GCS_CURSORPOS:
419 dwBufLen = IchWideFromAnsi(pCS->dwCursorPos, CS_StrA(pCS, CompStr), uCodePage);
420 break;
421
422 case GCS_DELTASTART:
423 dwBufLen = IchWideFromAnsi(pCS->dwDeltaStart, CS_StrA(pCS, CompStr), uCodePage);
424 break;
425
427 dwBufLen = Imm32CompStrAnsiToWide(CS_StrA(pCS, ResultReadStr),
428 CS_SizeA(pCS, ResultReadStr),
429 lpBuf, dwBufLen, uCodePage);
430 break;
431
433 dwBufLen = Imm32CompClauseAnsiToWide(CS_Clause(pCS, ResultReadClause),
434 CS_Size(pCS, ResultReadClause),
435 CS_StrA(pCS, ResultReadStr),
436 lpBuf, dwBufLen, uCodePage);
437 break;
438
439 case GCS_RESULTSTR:
440 dwBufLen = Imm32CompStrAnsiToWide(CS_StrA(pCS, ResultStr),
441 CS_SizeA(pCS, ResultStr),
442 lpBuf, dwBufLen, uCodePage);
443 break;
444
445 case GCS_RESULTCLAUSE:
446 dwBufLen = Imm32CompClauseAnsiToWide(CS_Clause(pCS, ResultClause),
447 CS_Size(pCS, ResultClause),
448 CS_StrA(pCS, ResultStr),
449 lpBuf, dwBufLen, uCodePage);
450 break;
451
452 default:
453 FIXME("0x%X\n", dwIndex);
454 return IMM_ERROR_GENERAL;
455 }
456 }
457 else /* !bAnsiClient */
458 {
459 switch (dwIndex)
460 {
461 case GCS_COMPREADSTR:
462 CS_DoStrW(pCS, CompReadStr);
463 break;
464
465 case GCS_COMPREADATTR:
466 CS_DoAttr(pCS, CompReadAttr);
467 break;
468
470 CS_DoClause(pCS, CompReadClause);
471 break;
472
473 case GCS_COMPSTR:
474 CS_DoStrW(pCS, CompStr);
475 break;
476
477 case GCS_COMPATTR:
478 CS_DoAttr(pCS, CompAttr);
479 break;
480
481 case GCS_COMPCLAUSE:
482 CS_DoClause(pCS, CompClause);
483 break;
484
485 case GCS_CURSORPOS:
486 dwBufLen = pCS->dwCursorPos;
487 break;
488
489 case GCS_DELTASTART:
490 dwBufLen = pCS->dwDeltaStart;
491 break;
492
494 CS_DoStrW(pCS, ResultReadStr);
495 break;
496
498 CS_DoClause(pCS, ResultReadClause);
499 break;
500
501 case GCS_RESULTSTR:
502 CS_DoStrW(pCS, ResultStr);
503 break;
504
505 case GCS_RESULTCLAUSE:
506 CS_DoClause(pCS, ResultClause);
507 break;
508
509 default:
510 FIXME("0x%X\n", dwIndex);
511 return IMM_ERROR_GENERAL;
512 }
513 }
514
515 return dwBufLen;
516}
static INT APIENTRY Imm32CompAttrAnsiToWide(const BYTE *src, INT src_len, LPCSTR text, INT str_len, LPBYTE dst, INT dst_len, UINT uCodePage)
Definition: compstr.c:98
static LONG APIENTRY Imm32CompStrAnsiToWide(LPCSTR psz, DWORD cb, LPWSTR lpBuf, DWORD dwBufLen, UINT uCodePage)
Definition: compstr.c:42
#define CS_StrA(pCS, Name)
Definition: compstr.c:194
#define CS_SizeA(pCS, Name)
Definition: compstr.c:199
static INT APIENTRY Imm32CompClauseAnsiToWide(const DWORD *source, INT slen, LPCSTR text, LPDWORD target, INT tlen, UINT uCodePage)
Definition: compstr.c:133
#define CS_DoStrW(pCS, Name)
Definition: compstr.c:213
LONG APIENTRY IchWideFromAnsi(LONG cchAnsi, LPCSTR pchAnsi, UINT uCodePage)
Definition: utils.c:252

Referenced by ImmGetCompositionStringW().

◆ Imm32OpenICAndCS()

BOOL APIENTRY Imm32OpenICAndCS ( HIMC  hIMC,
LPINPUTCONTEXT ppIC,
LPCOMPOSITIONSTRING ppCS 
)

Definition at line 17 of file compstr.c.

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}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1066
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1057
#define IS_NULL_UNEXPECTEDLY(p)
Definition: precomp.h:125
LPVOID WINAPI ImmLockIMCC(HIMCC imcc)
Definition: utils.c:1198
HIMCC hCompStr
Definition: immdev.h:141

Referenced by ImmSetCompositionStringAW().

◆ ImmGetCompositionStringA()

LONG WINAPI ImmGetCompositionStringA ( HIMC  hIMC,
DWORD  dwIndex,
LPVOID  lpBuf,
DWORD  dwBufLen 
)

Definition at line 856 of file compstr.c.

857{
858 LONG ret = 0;
859 LPINPUTCONTEXT pIC;
860 PCLIENTIMC pClientImc;
862 BOOL bAnsiClient;
863 UINT uCodePage;
864
865 TRACE("(%p, %lu, %p, %lu)\n", hIMC, dwIndex, lpBuf, dwBufLen);
866
867 if (dwBufLen && IS_NULL_UNEXPECTEDLY(lpBuf))
868 return 0;
869
870 pClientImc = ImmLockClientImc(hIMC);
871 if (IS_NULL_UNEXPECTEDLY(pClientImc))
872 return 0;
873
874 bAnsiClient = !(pClientImc->dwFlags & CLIENTIMC_WIDE);
875 uCodePage = pClientImc->uCodePage;
876 ImmUnlockClientImc(pClientImc);
877
878 pIC = ImmLockIMC(hIMC);
879 if (IS_NULL_UNEXPECTEDLY(pIC))
880 return 0;
881
882 pCS = ImmLockIMCC(pIC->hCompStr);
883 if (IS_NULL_UNEXPECTEDLY(pCS))
884 {
885 ImmUnlockIMC(hIMC);
886 return 0;
887 }
888
889 ret = Imm32GetCompStrA(hIMC, pCS, dwIndex, lpBuf, dwBufLen, bAnsiClient, uCodePage);
891 ImmUnlockIMC(hIMC);
892 TRACE("ret: %ld\n", ret);
893 return ret;
894}
LONG APIENTRY Imm32GetCompStrA(HIMC hIMC, const COMPOSITIONSTRING *pCS, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen, BOOL bAnsiClient, UINT uCodePage)
Definition: compstr.c:219
VOID WINAPI ImmUnlockClientImc(PCLIENTIMC pClientImc)
Definition: imm.c:983
PCLIENTIMC WINAPI ImmLockClientImc(HIMC hImc)
Definition: imm.c:937
BOOL WINAPI ImmUnlockIMCC(HIMCC imcc)
Definition: utils.c:1208
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CLIENTIMC_WIDE
Definition: imm32_undoc.h:129
unsigned int UINT
Definition: ndis.h:50
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by ActiveIMMApp_GetCompositionStringA(), Imm32ProcessRequest(), RealDefWindowProcA(), test_ImmGetCompositionString(), test_ImmNotifyIME(), and test_InvalidIMC().

◆ ImmGetCompositionStringW()

LONG WINAPI ImmGetCompositionStringW ( HIMC  hIMC,
DWORD  dwIndex,
LPVOID  lpBuf,
DWORD  dwBufLen 
)

Definition at line 899 of file compstr.c.

900{
901 LONG ret = 0;
902 LPINPUTCONTEXT pIC;
903 PCLIENTIMC pClientImc;
905 BOOL bAnsiClient;
906 UINT uCodePage;
907
908 TRACE("(%p, %lu, %p, %lu)\n", hIMC, dwIndex, lpBuf, dwBufLen);
909
910 if (dwBufLen && IS_NULL_UNEXPECTEDLY(lpBuf))
911 return 0;
912
913 pClientImc = ImmLockClientImc(hIMC);
914 if (IS_NULL_UNEXPECTEDLY(pClientImc))
915 return 0;
916
917 bAnsiClient = !(pClientImc->dwFlags & CLIENTIMC_WIDE);
918 uCodePage = pClientImc->uCodePage;
919 ImmUnlockClientImc(pClientImc);
920
921 pIC = ImmLockIMC(hIMC);
922 if (IS_NULL_UNEXPECTEDLY(pIC))
923 return 0;
924
925 pCS = ImmLockIMCC(pIC->hCompStr);
926 if (IS_NULL_UNEXPECTEDLY(pCS))
927 {
928 ImmUnlockIMC(hIMC);
929 return 0;
930 }
931
932 ret = Imm32GetCompStrW(hIMC, pCS, dwIndex, lpBuf, dwBufLen, bAnsiClient, uCodePage);
934 ImmUnlockIMC(hIMC);
935 TRACE("ret: %ld\n", ret);
936 return ret;
937}
LONG APIENTRY Imm32GetCompStrW(HIMC hIMC, const COMPOSITIONSTRING *pCS, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen, BOOL bAnsiClient, UINT uCodePage)
Definition: compstr.c:370

Referenced by ActiveIMMApp_GetCompositionStringW(), EDIT_GetCompositionStr(), EDIT_GetResultStr(), EDIT_ImeComposition(), Imm32ProcessRequest(), ME_HandleMessage(), RealDefWindowProcW(), test_ime_wnd_proc(), and test_ImmGetCompositionString().

◆ ImmSetCompositionStringA()

BOOL WINAPI ImmSetCompositionStringA ( HIMC  hIMC,
DWORD  dwIndex,
LPVOID  lpComp,
DWORD  dwCompLen,
LPVOID  lpRead,
DWORD  dwReadLen 
)

Definition at line 943 of file compstr.c.

945{
946 TRACE("(%p, %lu, %p, %lu, %p, %lu)\n",
947 hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen);
948 return ImmSetCompositionStringAW(hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen, TRUE);
949}
BOOL APIENTRY ImmSetCompositionStringAW(HIMC hIMC, DWORD dwIndex, LPVOID pComp, DWORD dwCompLen, LPVOID pRead, DWORD dwReadLen, BOOL bAnsiAPI)
Definition: compstr.c:520

Referenced by ActiveIMMApp_SetCompositionStringA(), and test_ImmNotifyIME().

◆ ImmSetCompositionStringAW()

BOOL APIENTRY ImmSetCompositionStringAW ( HIMC  hIMC,
DWORD  dwIndex,
LPVOID  pComp,
DWORD  dwCompLen,
LPVOID  pRead,
DWORD  dwReadLen,
BOOL  bAnsiAPI 
)

Definition at line 520 of file compstr.c.

522{
523 BOOL ret = FALSE, bAnsiClient;
524 LPVOID pCompNew = NULL, pReadNew = NULL;
525 DWORD dwThreadId, cbCompNew = 0, cbReadNew = 0;
526 LPINPUTCONTEXT pIC;
528 HKL hKL;
529 PIMEDPI pImeDpi;
530 UINT uCodePage;
531 LPRECONVERTSTRING pRS;
532
535 {
536 ERR("Thread mismatch\n");
537 return FALSE;
538 }
539
541 pImeDpi = ImmLockImeDpi(hKL);
542 if (IS_NULL_UNEXPECTEDLY(pImeDpi))
543 return FALSE;
544
545 uCodePage = pImeDpi->uCodePage;
546 bAnsiClient = !ImeDpi_IsUnicode(pImeDpi);
547
548 switch (dwIndex)
549 {
551 break;
552
555 break;
556 /* FALL THROUGH */
557 default:
558 ERR("0x%X\n", dwIndex);
559 ImmUnlockImeDpi(pImeDpi);
560 return FALSE;
561 }
562
563 if (bAnsiAPI == bAnsiClient || (!pComp && !pRead)) /* No conversion needed */
564 {
565 ret = pImeDpi->ImeSetCompositionString(hIMC, dwIndex, pComp, dwCompLen,
566 pRead, dwReadLen);
567 ImmUnlockImeDpi(pImeDpi);
568 return ret;
569 }
570
571 if (!Imm32OpenICAndCS(hIMC, &pIC, &pCS))
572 {
573 ImmUnlockImeDpi(pImeDpi);
574 return FALSE;
575 }
576
577 /*
578 * This code is really too complicated. But I cannot simplify.
579 * It converts like (pComp, dwCompLen) --> (pCompNew, cbCompNew) and
580 * (pRead, dwReadLen) --> (pReadNew, cbReadNew).
581 * (1) Check bAnsiClient, (2) Get the size, (3) Allocate a buffer for conversion,
582 * (4) Store converted data into the buffer.
583 */
584 switch (dwIndex)
585 {
586 case SCS_SETSTR:
587 if (pComp)
588 {
589 if (bAnsiClient)
590 {
591 cbCompNew = Imm32CompStrWideToAnsi(pComp, dwCompLen, NULL, 0, uCodePage);
592 pCompNew = ImmLocalAlloc(0, cbCompNew);
593 if (IS_NULL_UNEXPECTEDLY(pCompNew))
594 goto Quit;
595
596 Imm32CompStrWideToAnsi(pComp, dwCompLen, pCompNew, cbCompNew, uCodePage);
597 }
598 else
599 {
600 cbCompNew = Imm32CompStrAnsiToWide(pComp, dwCompLen, NULL, 0, uCodePage);
601 pCompNew = ImmLocalAlloc(0, cbCompNew);
602 if (IS_NULL_UNEXPECTEDLY(pCompNew))
603 goto Quit;
604
605 Imm32CompStrAnsiToWide(pComp, dwCompLen, pCompNew, cbCompNew, uCodePage);
606 }
607 }
608
609 if (pRead)
610 {
611 if (bAnsiClient)
612 {
613 cbReadNew = Imm32CompStrWideToAnsi(pRead, dwReadLen, NULL, 0, uCodePage);
614 pReadNew = ImmLocalAlloc(0, cbReadNew);
615 if (IS_NULL_UNEXPECTEDLY(pReadNew))
616 goto Quit;
617
618 Imm32CompStrWideToAnsi(pRead, dwReadLen, pReadNew, cbReadNew, uCodePage);
619 }
620 else
621 {
622 cbReadNew = Imm32CompStrAnsiToWide(pRead, dwReadLen, NULL, 0, uCodePage);
623 pReadNew = ImmLocalAlloc(0, cbReadNew);
624 if (IS_NULL_UNEXPECTEDLY(pReadNew))
625 goto Quit;
626
627 Imm32CompStrAnsiToWide(pRead, dwReadLen, pReadNew, cbReadNew, uCodePage);
628 }
629 }
630 break;
631
632 case SCS_CHANGEATTR:
633 if (pComp)
634 {
635 if (bAnsiClient)
636 {
637 cbCompNew = Imm32CompAttrWideToAnsi(pComp, dwCompLen,
638 CS_StrW(pCS, CompStr),
639 CS_SizeW(pCS, CompStr),
640 NULL, 0, uCodePage);
641 pCompNew = ImmLocalAlloc(0, cbCompNew);
642 if (IS_NULL_UNEXPECTEDLY(pCompNew))
643 goto Quit;
644
645 Imm32CompAttrWideToAnsi(pComp, dwCompLen,
646 CS_StrW(pCS, CompStr), CS_SizeW(pCS, CompStr),
647 pCompNew, cbCompNew, uCodePage);
648 }
649 else
650 {
651 cbCompNew = Imm32CompAttrAnsiToWide(pComp, dwCompLen,
652 CS_StrA(pCS, CompStr),
653 CS_SizeA(pCS, CompStr),
654 NULL, 0, uCodePage);
655 pCompNew = ImmLocalAlloc(0, cbCompNew);
656 if (IS_NULL_UNEXPECTEDLY(pCompNew))
657 goto Quit;
658
659 Imm32CompAttrAnsiToWide(pComp, dwCompLen,
660 CS_StrA(pCS, CompStr), CS_SizeA(pCS, CompStr),
661 pCompNew, cbCompNew, uCodePage);
662 }
663 }
664
665 if (pRead)
666 {
667 if (bAnsiClient)
668 {
669 cbReadNew = Imm32CompAttrWideToAnsi(pRead, dwReadLen,
670 CS_StrW(pCS, CompReadStr),
671 CS_SizeW(pCS, CompReadStr),
672 NULL, 0, uCodePage);
673 pReadNew = ImmLocalAlloc(0, cbReadNew);
674 if (IS_NULL_UNEXPECTEDLY(pReadNew))
675 goto Quit;
676
677 Imm32CompAttrWideToAnsi(pRead, dwReadLen,
678 CS_StrW(pCS, CompReadStr), CS_SizeW(pCS, CompReadStr),
679 pReadNew, cbReadNew, uCodePage);
680 }
681 else
682 {
683 cbReadNew = Imm32CompAttrAnsiToWide(pRead, dwReadLen,
684 CS_StrA(pCS, CompReadStr),
685 CS_SizeA(pCS, CompReadStr),
686 NULL, 0, uCodePage);
687 pReadNew = ImmLocalAlloc(0, cbReadNew);
688 if (IS_NULL_UNEXPECTEDLY(pReadNew))
689 goto Quit;
690
691 Imm32CompAttrAnsiToWide(pRead, dwReadLen,
692 CS_StrA(pCS, CompReadStr), CS_SizeA(pCS, CompReadStr),
693 pReadNew, cbReadNew, uCodePage);
694 }
695 }
696 break;
697
698 case SCS_CHANGECLAUSE:
699 if (pComp)
700 {
701 if (bAnsiClient)
702 {
703 cbCompNew = Imm32CompClauseWideToAnsi(pComp, dwCompLen, CS_StrW(pCS, CompStr),
704 NULL, 0, uCodePage);
705 pCompNew = ImmLocalAlloc(0, cbCompNew);
706 if (IS_NULL_UNEXPECTEDLY(pCompNew))
707 goto Quit;
708
709 Imm32CompClauseWideToAnsi(pComp, dwCompLen, CS_StrW(pCS, CompStr),
710 pCompNew, cbCompNew, uCodePage);
711 }
712 else
713 {
714 cbCompNew = Imm32CompClauseAnsiToWide(pComp, dwCompLen, CS_StrA(pCS, CompStr),
715 NULL, 0, uCodePage);
716 pCompNew = ImmLocalAlloc(0, cbCompNew);
717 if (IS_NULL_UNEXPECTEDLY(pCompNew))
718 goto Quit;
719
720 Imm32CompClauseAnsiToWide(pComp, dwCompLen, CS_StrA(pCS, CompStr),
721 pCompNew, cbCompNew, uCodePage);
722 }
723 }
724
725 if (pRead)
726 {
727 if (bAnsiClient)
728 {
729 cbReadNew = Imm32CompClauseWideToAnsi(pRead, dwReadLen, CS_StrW(pCS, CompReadStr),
730 NULL, 0, uCodePage);
731 pReadNew = ImmLocalAlloc(0, cbReadNew);
732 if (IS_NULL_UNEXPECTEDLY(pReadNew))
733 goto Quit;
734
735 Imm32CompClauseWideToAnsi(pRead, dwReadLen,
736 CS_StrW(pCS, CompReadStr),
737 pReadNew, cbReadNew, uCodePage);
738 }
739 else
740 {
741 cbReadNew = Imm32CompClauseAnsiToWide(pRead, dwReadLen, CS_StrA(pCS, CompReadStr),
742 NULL, 0, uCodePage);
743 pReadNew = ImmLocalAlloc(0, cbReadNew);
744 if (IS_NULL_UNEXPECTEDLY(pReadNew))
745 goto Quit;
746
747 Imm32CompClauseAnsiToWide(pRead, dwReadLen, CS_StrA(pCS, CompReadStr),
748 pReadNew, cbReadNew, uCodePage);
749 }
750 }
751 break;
752
754 {
755 if (pComp)
756 {
757 if (bAnsiClient)
758 {
759 cbCompNew = Imm32ReconvertAnsiFromWide(NULL, pComp, uCodePage);
760 pCompNew = ImmLocalAlloc(0, cbCompNew);
761 if (IS_NULL_UNEXPECTEDLY(pCompNew))
762 goto Quit;
763
764 pRS = pCompNew;
765 pRS->dwSize = cbCompNew;
766 pRS->dwVersion = 0;
767 Imm32ReconvertAnsiFromWide(pRS, pComp, uCodePage);
768 }
769 else
770 {
771 cbCompNew = Imm32ReconvertWideFromAnsi(NULL, pComp, uCodePage);
772 pCompNew = ImmLocalAlloc(0, cbCompNew);
773 if (IS_NULL_UNEXPECTEDLY(pCompNew))
774 goto Quit;
775
776 pRS = pCompNew;
777 pRS->dwSize = cbCompNew;
778 pRS->dwVersion = 0;
779 Imm32ReconvertWideFromAnsi(pRS, pComp, uCodePage);
780 }
781 }
782
783 if (pRead)
784 {
785 if (bAnsiClient)
786 {
787 cbReadNew = Imm32ReconvertAnsiFromWide(NULL, pRead, uCodePage);
788 pReadNew = ImmLocalAlloc(0, cbReadNew);
789 if (IS_NULL_UNEXPECTEDLY(pReadNew))
790 goto Quit;
791
792 pRS = pReadNew;
793 pRS->dwSize = cbReadNew;
794 pRS->dwVersion = 0;
795 Imm32ReconvertAnsiFromWide(pRS, pRead, uCodePage);
796 }
797 else
798 {
799 cbReadNew = Imm32ReconvertWideFromAnsi(NULL, pRead, uCodePage);
800 pReadNew = ImmLocalAlloc(0, cbReadNew);
801 if (IS_NULL_UNEXPECTEDLY(pReadNew))
802 goto Quit;
803
804 pRS = pReadNew;
805 pRS->dwSize = cbReadNew;
806 pRS->dwVersion = 0;
807 Imm32ReconvertWideFromAnsi(pRS, pRead, uCodePage);
808 }
809 }
810 break;
811 }
812 }
813
815 pCS = NULL;
816 ImmUnlockIMC(hIMC);
817 pIC = NULL;
818
819 ret = pImeDpi->ImeSetCompositionString(hIMC, dwIndex, pCompNew, cbCompNew,
820 pReadNew, cbReadNew);
821
822 if (dwIndex == SCS_QUERYRECONVERTSTRING)
823 {
824 if (pComp)
825 {
826 if (bAnsiClient)
827 ret = Imm32ReconvertWideFromAnsi(pComp, pCompNew, uCodePage);
828 else
829 ret = Imm32ReconvertAnsiFromWide(pComp, pCompNew, uCodePage);
830 }
831
832 if (pRead)
833 {
834 if (bAnsiClient)
835 ret = Imm32ReconvertWideFromAnsi(pRead, pReadNew, uCodePage);
836 else
837 ret = Imm32ReconvertAnsiFromWide(pRead, pReadNew, uCodePage);
838 }
839 }
840
841Quit:
842 if (pCS)
844 if (pIC)
845 ImmUnlockIMC(hIMC);
846 ImmLocalFree(pCompNew);
847 ImmLocalFree(pReadNew);
848 ImmUnlockImeDpi(pImeDpi);
849 TRACE("ret: %d\n", ret);
850 return ret;
851}
#define ERR(fmt,...)
Definition: debug.h:110
BOOL APIENTRY Imm32OpenICAndCS(HIMC hIMC, LPINPUTCONTEXT *ppIC, LPCOMPOSITIONSTRING *ppCS)
Definition: compstr.c:17
PIMEDPI WINAPI ImmLockImeDpi(HKL hKL)
Definition: ime.c:978
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:1007
LPVOID APIENTRY ImmLocalAlloc(DWORD dwFlags, DWORD dwBytes)
Definition: utils.c:415
#define ImmLocalFree(lpData)
Definition: precomp.h:89
DWORD APIENTRY Imm32ReconvertAnsiFromWide(LPRECONVERTSTRING pDest, const RECONVERTSTRING *pSrc, UINT uCodePage)
Definition: utils.c:691
#define ImeDpi_IsUnicode(pImeDpi)
Definition: precomp.h:150
DWORD APIENTRY Imm32ReconvertWideFromAnsi(LPRECONVERTSTRING pDest, const RECONVERTSTRING *pSrc, UINT uCodePage)
Definition: utils.c:628
DWORD dwThreadId
Definition: fdebug.c:31
#define SCS_SETRECONVERTSTRING
Definition: imm.h:311
#define SCS_CHANGECLAUSE
Definition: imm.h:310
#define SCS_SETSTR
Definition: imm.h:308
#define SCS_CAP_SETRECONVERTSTRING
Definition: imm.h:261
#define SCS_CHANGEATTR
Definition: imm.h:309
#define SCS_QUERYRECONVERTSTRING
Definition: imm.h:312
DWORD_PTR NTAPI NtUserQueryInputContext(HIMC hIMC, DWORD dwType)
Definition: ime.c:1791
UINT_PTR HKL
Definition: msctf.idl:143
IMEINFO ImeInfo
Definition: imm32_undoc.h:54
UINT uCodePage
Definition: imm32_undoc.h:55
DWORD fdwSCSCaps
Definition: immdev.h:26
@ QIC_INPUTTHREADID
Definition: undocuser.h:393
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
HKL WINAPI GetKeyboardLayout(_In_ DWORD)

Referenced by ImmSetCompositionStringA(), and ImmSetCompositionStringW().

◆ ImmSetCompositionStringW()

BOOL WINAPI ImmSetCompositionStringW ( HIMC  hIMC,
DWORD  dwIndex,
LPVOID  lpComp,
DWORD  dwCompLen,
LPVOID  lpRead,
DWORD  dwReadLen 
)

Definition at line 955 of file compstr.c.

957{
958 TRACE("(%p, %lu, %p, %lu, %p, %lu)\n",
959 hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen);
960 return ImmSetCompositionStringAW(hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen, FALSE);
961}

Referenced by ActiveIMMApp_SetCompositionStringW(), test_ImmGetCompositionString(), and test_ImmSetCompositionString().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( imm  )