ReactOS 0.4.16-dev-2491-g3dc6630
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)
 
static DWORD ImmGetGuideLineAW (_In_ HIMC hIMC, _In_ DWORD dwIndex, _Out_writes_bytes_opt_(dwBufLen) LPVOID lpBuf, _In_ DWORD dwBufLen, _In_ BOOL bAnsi)
 
DWORD WINAPI ImmGetGuideLineA (_In_ HIMC hIMC, _In_ DWORD dwIndex, _Out_writes_bytes_opt_(dwBufLen) LPSTR lpBuf, _In_ DWORD dwBufLen)
 
DWORD WINAPI ImmGetGuideLineW (_In_ HIMC hIMC, _In_ DWORD dwIndex, _Out_writes_bytes_opt_(dwBufLen) LPWSTR lpBuf, _In_ DWORD dwBufLen)
 

Function Documentation

◆ ImmGetGuideLineA()

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

Definition at line 205 of file guideline.c.

210{
211 TRACE("(%p, %lu, %p, %lu)\n", hIMC, dwIndex, lpBuf, dwBufLen);
212 return ImmGetGuideLineAW(hIMC, dwIndex, lpBuf, dwBufLen, TRUE);
213}
#define TRUE
Definition: types.h:120
static DWORD ImmGetGuideLineAW(_In_ HIMC hIMC, _In_ DWORD dwIndex, _Out_writes_bytes_opt_(dwBufLen) LPVOID lpBuf, _In_ DWORD dwBufLen, _In_ BOOL bAnsi)
Definition: guideline.c:13
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by ActiveIMMApp_GetGuideLineA().

◆ ImmGetGuideLineAW()

static DWORD ImmGetGuideLineAW ( _In_ HIMC  hIMC,
_In_ DWORD  dwIndex,
_Out_writes_bytes_opt_(dwBufLen) LPVOID  lpBuf,
_In_ DWORD  dwBufLen,
_In_ BOOL  bAnsi 
)
static

Definition at line 13 of file guideline.c.

19{
20 PCLIENTIMC pClientImc;
22 LPGUIDELINE pGuideLine;
23 DWORD cb, ret = 0;
24 LPVOID pvStr, pvPrivate;
25 BOOL bUsedDefault;
26 UINT uCodePage;
27
28 pClientImc = ImmLockClientImc(hIMC);
29 if (IS_NULL_UNEXPECTEDLY(pClientImc))
30 return 0;
31
32 uCodePage = pClientImc->uCodePage;
33
34 pIC = ImmLockIMC(hIMC);
35 if (IS_NULL_UNEXPECTEDLY(pIC))
36 {
37 ImmUnlockClientImc(pClientImc);
38 return 0;
39 }
40
41 pGuideLine = ImmLockIMCC(pIC->hGuideLine);
42 if (IS_NULL_UNEXPECTEDLY(pGuideLine))
43 {
44 ImmUnlockIMC(hIMC);
45 ImmUnlockClientImc(pClientImc);
46 return 0;
47 }
48
49 if (dwIndex == GGL_LEVEL)
50 {
51 ret = pGuideLine->dwLevel;
52 goto Quit;
53 }
54
55 if (dwIndex == GGL_INDEX)
56 {
57 ret = pGuideLine->dwIndex;
58 goto Quit;
59 }
60
61 if (dwIndex == GGL_STRING)
62 {
63 pvStr = (LPBYTE)pGuideLine + pGuideLine->dwStrOffset;
64
65 /* get size */
66 if (bAnsi)
67 {
68 if (pClientImc->dwFlags & CLIENTIMC_WIDE)
69 {
70 cb = WideCharToMultiByte(uCodePage, 0, pvStr, pGuideLine->dwStrLen,
71 NULL, 0, NULL, &bUsedDefault);
72 }
73 else
74 {
75 cb = pGuideLine->dwStrLen * sizeof(CHAR);
76 }
77 }
78 else
79 {
80 if (pClientImc->dwFlags & CLIENTIMC_WIDE)
81 {
82 cb = pGuideLine->dwStrLen * sizeof(WCHAR);
83 }
84 else
85 {
86 cb = MultiByteToWideChar(uCodePage, MB_PRECOMPOSED, pvStr, pGuideLine->dwStrLen,
87 NULL, 0) * sizeof(WCHAR);
88 }
89 }
90
91 if (dwBufLen == 0)
92 {
93 ret = cb;
94 goto Quit;
95 }
96 if (cb == 0 || lpBuf == NULL || dwBufLen < cb)
97 {
98 ret = 0; /* Error */
99 goto Quit;
100 }
101
102 /* store to buffer */
103 if (bAnsi)
104 {
105 if (pClientImc->dwFlags & CLIENTIMC_WIDE)
106 {
107 ret = WideCharToMultiByte(uCodePage, 0, pvStr, pGuideLine->dwStrLen,
108 lpBuf, dwBufLen, NULL, &bUsedDefault);
109 goto Quit;
110 }
111 }
112 else
113 {
114 if (!(pClientImc->dwFlags & CLIENTIMC_WIDE))
115 {
116 ret = MultiByteToWideChar(uCodePage, MB_PRECOMPOSED, pvStr, pGuideLine->dwStrLen,
117 lpBuf, dwBufLen) * sizeof(WCHAR);
118 goto Quit;
119 }
120 }
121
122 RtlCopyMemory(lpBuf, pvStr, cb);
123 ret = cb;
124 goto Quit;
125 }
126
127 if (dwIndex == GGL_PRIVATE)
128 {
129 pvPrivate = (LPBYTE)pGuideLine + pGuideLine->dwPrivateOffset;
130
131 /* get size */
132 if (bAnsi)
133 {
134 if ((pClientImc->dwFlags & CLIENTIMC_WIDE) &&
135 pGuideLine->dwIndex == GL_ID_REVERSECONVERSION)
136 {
137 cb = CandidateListWideToAnsi(pvPrivate, NULL, 0, uCodePage);
138 }
139 else
140 {
141 cb = pGuideLine->dwPrivateSize;
142 }
143 }
144 else
145 {
146 if (!(pClientImc->dwFlags & CLIENTIMC_WIDE) &&
147 pGuideLine->dwIndex == GL_ID_REVERSECONVERSION)
148 {
149 cb = CandidateListAnsiToWide(pvPrivate, NULL, 0, uCodePage);
150 }
151 else
152 {
153 cb = pGuideLine->dwPrivateSize;
154 }
155 }
156
157 if (dwBufLen == 0)
158 {
159 ret = cb;
160 goto Quit;
161 }
162 if (cb == 0 || lpBuf == NULL || dwBufLen < cb)
163 {
164 ret = 0; /* Error */
165 goto Quit;
166 }
167
168 /* store to buffer */
169 if (bAnsi)
170 {
171 if ((pClientImc->dwFlags & CLIENTIMC_WIDE) &&
172 pGuideLine->dwIndex == GL_ID_REVERSECONVERSION)
173 {
174 ret = CandidateListWideToAnsi(pvPrivate, lpBuf, cb, uCodePage);
175 goto Quit;
176 }
177 }
178 else
179 {
180 if (!(pClientImc->dwFlags & CLIENTIMC_WIDE) &&
181 pGuideLine->dwIndex == GL_ID_REVERSECONVERSION)
182 {
183 ret = CandidateListAnsiToWide(pvPrivate, lpBuf, cb, uCodePage);
184 goto Quit;
185 }
186 }
187
188 RtlCopyMemory(lpBuf, pvPrivate, cb);
189 ret = cb;
190 goto Quit;
191 }
192
193Quit:
195 ImmUnlockIMC(hIMC);
196 ImmUnlockClientImc(pClientImc);
197 TRACE("ret: 0x%X\n", ret);
198 return ret;
199}
#define CHAR(Char)
DWORD CandidateListAnsiToWide(const CANDIDATELIST *pAnsiCL, LPCANDIDATELIST pWideCL, DWORD dwBufLen, UINT uCodePage)
Definition: candidate.c:84
DWORD CandidateListWideToAnsi(const CANDIDATELIST *pWideCL, LPCANDIDATELIST pAnsiCL, DWORD dwBufLen, UINT uCodePage)
Definition: candidate.c:15
#define NULL
Definition: types.h:112
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
static MonoProfilerRuntimeShutdownBeginCallback cb
Definition: metahost.c:118
return ret
Definition: mutex.c:146
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
PCLIENTIMC WINAPI ImmLockClientImc(_In_ HIMC hImc)
Definition: imm.c:955
VOID WINAPI ImmUnlockClientImc(_Inout_ PCLIENTIMC pClientImc)
Definition: imm.c:1002
#define CLIENTIMC_WIDE
Definition: imm32_undoc.h:171
#define GGL_PRIVATE
Definition: imm.h:271
#define GGL_INDEX
Definition: imm.h:269
#define GL_ID_REVERSECONVERSION
Definition: imm.h:294
#define GGL_STRING
Definition: imm.h:270
#define GGL_LEVEL
Definition: imm.h:268
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
if(dx< 0)
Definition: linetemp.h:194
unsigned int UINT
Definition: ndis.h:50
HIMCC hGuideLine
Definition: immdev.h:121
DWORD dwStrOffset
Definition: immdev.h:80
DWORD dwPrivateSize
Definition: immdev.h:81
DWORD dwStrLen
Definition: immdev.h:79
DWORD dwIndex
Definition: immdev.h:78
DWORD dwLevel
Definition: immdev.h:77
DWORD dwPrivateOffset
Definition: immdev.h:82
unsigned char * LPBYTE
Definition: typedefs.h:53
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define IS_NULL_UNEXPECTEDLY(p)
Definition: precomp.h:67
#define MB_PRECOMPOSED
Definition: winnls.h:299
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by ImmGetGuideLineA(), and ImmGetGuideLineW().

◆ ImmGetGuideLineW()

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

Definition at line 219 of file guideline.c.

224{
225 TRACE("(%p, %lu, %p, %lu)\n", hIMC, dwIndex, lpBuf, dwBufLen);
226 return ImmGetGuideLineAW(hIMC, dwIndex, lpBuf, dwBufLen, FALSE);
227}
#define FALSE
Definition: types.h:117

Referenced by ActiveIMMApp_GetGuideLineW(), and ConIme_OnNotifyGuideLine().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( imm  )