ReactOS  0.4.15-dev-4603-gb922b6d
guideline.c File Reference
#include "precomp.h"
Include dependency graph for guideline.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (imm)
 
DWORD APIENTRY ImmGetGuideLineAW (HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen, BOOL bAnsi)
 
DWORD WINAPI ImmGetGuideLineA (HIMC hIMC, DWORD dwIndex, LPSTR lpBuf, DWORD dwBufLen)
 
DWORD WINAPI ImmGetGuideLineW (HIMC hIMC, DWORD dwIndex, LPWSTR lpBuf, DWORD dwBufLen)
 

Function Documentation

◆ ImmGetGuideLineA()

DWORD WINAPI ImmGetGuideLineA ( HIMC  hIMC,
DWORD  dwIndex,
LPSTR  lpBuf,
DWORD  dwBufLen 
)

Definition at line 186 of file guideline.c.

187 {
188  TRACE("(%p, %lu, %p, %lu)\n", hIMC, dwIndex, lpBuf, dwBufLen);
189  return ImmGetGuideLineAW(hIMC, dwIndex, lpBuf, dwBufLen, TRUE);
190 }
#define TRUE
Definition: types.h:120
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_ DWORD _In_ DWORD dwBufLen
Definition: wincrypt.h:4245
DWORD APIENTRY ImmGetGuideLineAW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen, BOOL bAnsi)
Definition: guideline.c:14
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by ActiveIMMApp_GetGuideLineA().

◆ ImmGetGuideLineAW()

DWORD APIENTRY ImmGetGuideLineAW ( HIMC  hIMC,
DWORD  dwIndex,
LPVOID  lpBuf,
DWORD  dwBufLen,
BOOL  bAnsi 
)

Definition at line 14 of file guideline.c.

15 {
16  PCLIENTIMC pClientImc;
17  LPINPUTCONTEXT pIC;
18  LPGUIDELINE pGuideLine;
19  DWORD cb, ret = 0;
20  LPVOID pvStr, pvPrivate;
21  BOOL bUsedDefault;
22 
23  pClientImc = ImmLockClientImc(hIMC);
24  if (!pClientImc)
25  return 0;
26 
27  pIC = ImmLockIMC(hIMC);
28  if (!pIC)
29  {
30  ImmUnlockClientImc(pClientImc);
31  return 0;
32  }
33 
34  pGuideLine = ImmLockIMCC(pIC->hGuideLine);
35  if (!pGuideLine)
36  {
37  ImmUnlockIMC(hIMC);
38  ImmUnlockClientImc(pClientImc);
39  return 0;
40  }
41 
42  if (dwIndex == GGL_LEVEL)
43  {
44  ret = pGuideLine->dwLevel;
45  goto Quit;
46  }
47 
48  if (dwIndex == GGL_INDEX)
49  {
50  ret = pGuideLine->dwIndex;
51  goto Quit;
52  }
53 
54  if (dwIndex == GGL_STRING)
55  {
56  pvStr = (LPBYTE)pGuideLine + pGuideLine->dwStrOffset;
57 
58  /* get size */
59  if (bAnsi)
60  {
61  if (pClientImc->dwFlags & CLIENTIMC_WIDE)
62  {
63  cb = WideCharToMultiByte(CP_ACP, 0, pvStr, pGuideLine->dwStrLen,
64  NULL, 0, NULL, &bUsedDefault);
65  }
66  else
67  {
68  cb = pGuideLine->dwStrLen * sizeof(CHAR);
69  }
70  }
71  else
72  {
73  if (pClientImc->dwFlags & CLIENTIMC_WIDE)
74  {
75  cb = pGuideLine->dwStrLen * sizeof(WCHAR);
76  }
77  else
78  {
79  cb = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pvStr, pGuideLine->dwStrLen,
80  NULL, 0) * sizeof(WCHAR);
81  }
82  }
83 
84  if (dwBufLen == 0 || cb == 0 || lpBuf == NULL || dwBufLen < cb)
85  {
86  ret = cb;
87  goto Quit;
88  }
89 
90  /* store to buffer */
91  if (bAnsi)
92  {
93  if (pClientImc->dwFlags & CLIENTIMC_WIDE)
94  {
95  ret = WideCharToMultiByte(CP_ACP, 0, pvStr, pGuideLine->dwStrLen,
96  lpBuf, dwBufLen, NULL, &bUsedDefault);
97  goto Quit;
98  }
99  }
100  else
101  {
102  if (!(pClientImc->dwFlags & CLIENTIMC_WIDE))
103  {
104  ret = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pvStr, pGuideLine->dwStrLen,
105  lpBuf, dwBufLen) * sizeof(WCHAR);
106  goto Quit;
107  }
108  }
109 
110  RtlCopyMemory(lpBuf, pvStr, cb);
111  ret = cb;
112  goto Quit;
113  }
114 
115  if (dwIndex == GGL_PRIVATE)
116  {
117  pvPrivate = (LPBYTE)pGuideLine + pGuideLine->dwPrivateOffset;
118 
119  /* get size */
120  if (bAnsi)
121  {
122  if ((pClientImc->dwFlags & CLIENTIMC_WIDE) &&
123  pGuideLine->dwIndex == GL_ID_REVERSECONVERSION)
124  {
125  cb = CandidateListWideToAnsi(pvPrivate, NULL, 0, CP_ACP);
126  }
127  else
128  {
129  cb = pGuideLine->dwPrivateSize;
130  }
131  }
132  else
133  {
134  if (!(pClientImc->dwFlags & CLIENTIMC_WIDE) &&
135  pGuideLine->dwIndex == GL_ID_REVERSECONVERSION)
136  {
137  cb = CandidateListAnsiToWide(pvPrivate, NULL, 0, CP_ACP);
138  }
139  else
140  {
141  cb = pGuideLine->dwPrivateSize;
142  }
143  }
144 
145  if (dwBufLen == 0 || cb == 0 || lpBuf == NULL || dwBufLen < cb)
146  {
147  ret = cb;
148  goto Quit;
149  }
150 
151  /* store to buffer */
152  if (bAnsi)
153  {
154  if ((pClientImc->dwFlags & CLIENTIMC_WIDE) &&
155  pGuideLine->dwIndex == GL_ID_REVERSECONVERSION)
156  {
157  ret = CandidateListWideToAnsi(pvPrivate, lpBuf, cb, CP_ACP);
158  goto Quit;
159  }
160  }
161  else
162  {
163  if (!(pClientImc->dwFlags & CLIENTIMC_WIDE) &&
164  pGuideLine->dwIndex == GL_ID_REVERSECONVERSION)
165  {
166  ret = CandidateListAnsiToWide(pvPrivate, lpBuf, cb, CP_ACP);
167  goto Quit;
168  }
169  }
170 
171  RtlCopyMemory(lpBuf, pvPrivate, cb);
172  ret = cb;
173  goto Quit;
174  }
175 
176 Quit:
178  ImmUnlockIMC(hIMC);
179  ImmUnlockClientImc(pClientImc);
180  return ret;
181 }
DWORD APIENTRY CandidateListAnsiToWide(const CANDIDATELIST *pAnsiCL, LPCANDIDATELIST pWideCL, DWORD dwBufLen, UINT uCodePage)
Definition: candidate.c:84
DWORD dwStrOffset
Definition: imm.h:199
#define WideCharToMultiByte
Definition: compat.h:111
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1023
#define CP_ACP
Definition: compat.h:109
#define MB_PRECOMPOSED
Definition: winnls.h:281
LPVOID WINAPI ImmLockIMCC(HIMCC imcc)
Definition: utils.c:986
#define GGL_PRIVATE
Definition: imm.h:416
DWORD dwIndex
Definition: imm.h:197
#define GGL_LEVEL
Definition: imm.h:413
if(dx==0 &&dy==0)
Definition: linetemp.h:174
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_ DWORD _In_ DWORD dwBufLen
Definition: wincrypt.h:4245
#define CLIENTIMC_WIDE
Definition: ntuser.h:1325
DWORD APIENTRY CandidateListWideToAnsi(const CANDIDATELIST *pWideCL, LPCANDIDATELIST pAnsiCL, DWORD dwBufLen, UINT uCodePage)
Definition: candidate.c:14
unsigned char * LPBYTE
Definition: typedefs.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
PCLIENTIMC WINAPI ImmLockClientImc(HIMC hImc)
Definition: imm.c:909
DWORD dwPrivateSize
Definition: imm.h:200
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GL_ID_REVERSECONVERSION
Definition: imm.h:439
#define GGL_STRING
Definition: imm.h:415
BOOL WINAPI ImmUnlockIMCC(HIMCC imcc)
Definition: utils.c:996
int ret
DWORD dwLevel
Definition: imm.h:196
HIMCC hGuideLine
Definition: immdev.h:53
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
DWORD dwPrivateOffset
Definition: imm.h:201
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
DWORD dwFlags
Definition: ntuser.h:1305
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define CHAR(Char)
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1032
DWORD dwStrLen
Definition: imm.h:198
#define GGL_INDEX
Definition: imm.h:414
VOID WINAPI ImmUnlockClientImc(PCLIENTIMC pClientImc)
Definition: imm.c:954

Referenced by ImmGetGuideLineA(), and ImmGetGuideLineW().

◆ ImmGetGuideLineW()

DWORD WINAPI ImmGetGuideLineW ( HIMC  hIMC,
DWORD  dwIndex,
LPWSTR  lpBuf,
DWORD  dwBufLen 
)

Definition at line 195 of file guideline.c.

196 {
197  TRACE("(%p, %lu, %p, %lu)\n", hIMC, dwIndex, lpBuf, dwBufLen);
198  return ImmGetGuideLineAW(hIMC, dwIndex, lpBuf, dwBufLen, FALSE);
199 }
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_ DWORD _In_ DWORD dwBufLen
Definition: wincrypt.h:4245
#define FALSE
Definition: types.h:117
DWORD APIENTRY ImmGetGuideLineAW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen, BOOL bAnsi)
Definition: guideline.c:14
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by ActiveIMMApp_GetGuideLineW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( imm  )