ReactOS 0.4.16-dev-1264-g92ff994
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 195 of file guideline.c.

200{
201 TRACE("(%p, %lu, %p, %lu)\n", hIMC, dwIndex, lpBuf, dwBufLen);
202 return ImmGetGuideLineAW(hIMC, dwIndex, lpBuf, dwBufLen, TRUE);
203}
#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
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_ DWORD _In_ DWORD dwBufLen
Definition: wincrypt.h:4246

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 || cb == 0 || lpBuf == NULL || dwBufLen < cb)
92 {
93 ret = cb;
94 goto Quit;
95 }
96
97 /* store to buffer */
98 if (bAnsi)
99 {
100 if (pClientImc->dwFlags & CLIENTIMC_WIDE)
101 {
102 ret = WideCharToMultiByte(uCodePage, 0, pvStr, pGuideLine->dwStrLen,
103 lpBuf, dwBufLen, NULL, &bUsedDefault);
104 goto Quit;
105 }
106 }
107 else
108 {
109 if (!(pClientImc->dwFlags & CLIENTIMC_WIDE))
110 {
111 ret = MultiByteToWideChar(uCodePage, MB_PRECOMPOSED, pvStr, pGuideLine->dwStrLen,
112 lpBuf, dwBufLen) * sizeof(WCHAR);
113 goto Quit;
114 }
115 }
116
117 RtlCopyMemory(lpBuf, pvStr, cb);
118 ret = cb;
119 goto Quit;
120 }
121
122 if (dwIndex == GGL_PRIVATE)
123 {
124 pvPrivate = (LPBYTE)pGuideLine + pGuideLine->dwPrivateOffset;
125
126 /* get size */
127 if (bAnsi)
128 {
129 if ((pClientImc->dwFlags & CLIENTIMC_WIDE) &&
130 pGuideLine->dwIndex == GL_ID_REVERSECONVERSION)
131 {
132 cb = CandidateListWideToAnsi(pvPrivate, NULL, 0, uCodePage);
133 }
134 else
135 {
136 cb = pGuideLine->dwPrivateSize;
137 }
138 }
139 else
140 {
141 if (!(pClientImc->dwFlags & CLIENTIMC_WIDE) &&
142 pGuideLine->dwIndex == GL_ID_REVERSECONVERSION)
143 {
144 cb = CandidateListAnsiToWide(pvPrivate, NULL, 0, uCodePage);
145 }
146 else
147 {
148 cb = pGuideLine->dwPrivateSize;
149 }
150 }
151
152 if (dwBufLen == 0 || cb == 0 || lpBuf == NULL || dwBufLen < cb)
153 {
154 ret = cb;
155 goto Quit;
156 }
157
158 /* store to buffer */
159 if (bAnsi)
160 {
161 if ((pClientImc->dwFlags & CLIENTIMC_WIDE) &&
162 pGuideLine->dwIndex == GL_ID_REVERSECONVERSION)
163 {
164 ret = CandidateListWideToAnsi(pvPrivate, lpBuf, cb, uCodePage);
165 goto Quit;
166 }
167 }
168 else
169 {
170 if (!(pClientImc->dwFlags & CLIENTIMC_WIDE) &&
171 pGuideLine->dwIndex == GL_ID_REVERSECONVERSION)
172 {
173 ret = CandidateListAnsiToWide(pvPrivate, lpBuf, cb, uCodePage);
174 goto Quit;
175 }
176 }
177
178 RtlCopyMemory(lpBuf, pvPrivate, cb);
179 ret = cb;
180 goto Quit;
181 }
182
183Quit:
185 ImmUnlockIMC(hIMC);
186 ImmUnlockClientImc(pClientImc);
187 TRACE("ret: 0x%X\n", ret);
188 return ret;
189}
#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
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:954
VOID WINAPI ImmUnlockClientImc(_Inout_ PCLIENTIMC pClientImc)
Definition: imm.c:1001
#define CLIENTIMC_WIDE
Definition: imm32_undoc.h:169
#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:615
LPINPUTCONTEXT WINAPI ImmLockIMC(_In_ HIMC hIMC)
Definition: imm.c:1079
BOOL WINAPI ImmUnlockIMC(_In_ HIMC hIMC)
Definition: imm.c:1089
LPVOID WINAPI ImmLockIMCC(_In_ HIMCC imcc)
Definition: utils.c:604
if(dx< 0)
Definition: linetemp.h:194
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
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
int ret
#define IS_NULL_UNEXPECTEDLY(p)
Definition: precomp.h:66
#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 209 of file guideline.c.

214{
215 TRACE("(%p, %lu, %p, %lu)\n", hIMC, dwIndex, lpBuf, dwBufLen);
216 return ImmGetGuideLineAW(hIMC, dwIndex, lpBuf, dwBufLen, FALSE);
217}
#define FALSE
Definition: types.h:117

Referenced by ActiveIMMApp_GetGuideLineW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( imm  )