ReactOS  0.4.15-dev-4614-ga5a6101
ime.c File Reference
#include "precomp.h"
#include "imetable.h"
Include dependency graph for ime.c:

Go to the source code of this file.

Macros

#define VALID_IME_PROP
 
#define VALID_CMODE_CAPS
 
#define VALID_SMODE_CAPS
 
#define VALID_UI_CAPS
 
#define VALID_SCS_CAPS
 
#define VALID_SELECT_CAPS   (SELECT_CAP_CONVERSION | SELECT_CAP_SENTENCE)
 
#define DEFINE_IME_ENTRY(type, name, params, optional)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (imm)
 
PIMEDPI APIENTRY Imm32FindImeDpi (HKL hKL)
 
VOID APIENTRY Imm32FreeIME (PIMEDPI pImeDpi, BOOL bDestroy)
 
BOOL APIENTRY Imm32InquireIme (PIMEDPI pImeDpi)
 
BOOL APIENTRY Imm32LoadIME (PIMEINFOEX pImeInfoEx, PIMEDPI pImeDpi)
 
PIMEDPI APIENTRY Ime32LoadImeDpi (HKL hKL, BOOL bLock)
 
PIMEDPI APIENTRY Imm32FindOrLoadImeDpi (HKL hKL)
 
static LRESULT APIENTRY ImeDpi_Escape (PIMEDPI pImeDpi, HIMC hIMC, UINT uSubFunc, LPVOID lpData, HKL hKL)
 
BOOL APIENTRY Imm32ReleaseIME (HKL hKL)
 
DWORD APIENTRY Imm32GetImeMenuItemWCrossProcess (HIMC hIMC, DWORD dwFlags, DWORD dwType, LPVOID lpImeParentMenu, LPVOID lpImeMenu, DWORD dwSize)
 
DWORD APIENTRY ImmGetImeMenuItemsAW (HIMC hIMC, DWORD dwFlags, DWORD dwType, LPVOID lpImeParentMenu, LPVOID lpImeMenu, DWORD dwSize, BOOL bTargetIsAnsi)
 
HKL WINAPI ImmInstallIMEA (LPCSTR lpszIMEFileName, LPCSTR lpszLayoutText)
 
HKL WINAPI ImmInstallIMEW (LPCWSTR lpszIMEFileName, LPCWSTR lpszLayoutText)
 
BOOL WINAPI ImmIsIME (HKL hKL)
 
HWND WINAPI ImmGetDefaultIMEWnd (HWND hWnd)
 
BOOL WINAPI ImmNotifyIME (HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
 
BOOL WINAPI ImmDisableLegacyIME (void)
 
BOOL WINAPI ImmGetImeInfoEx (PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey)
 
PIMEDPI WINAPI ImmLockImeDpi (HKL hKL)
 
VOID WINAPI ImmUnlockImeDpi (PIMEDPI pImeDpi)
 
BOOL WINAPI ImmLoadIME (HKL hKL)
 
BOOL WINAPI ImmDisableIME (DWORD dwThreadId)
 
UINT WINAPI ImmGetDescriptionA (HKL hKL, LPSTR lpszDescription, UINT uBufLen)
 
UINT WINAPI ImmGetDescriptionW (HKL hKL, LPWSTR lpszDescription, UINT uBufLen)
 
UINT WINAPI ImmGetIMEFileNameA (HKL hKL, LPSTR lpszFileName, UINT uBufLen)
 
UINT WINAPI ImmGetIMEFileNameW (HKL hKL, LPWSTR lpszFileName, UINT uBufLen)
 
DWORD WINAPI ImmGetProperty (HKL hKL, DWORD fdwIndex)
 
LRESULT WINAPI ImmEscapeA (HKL hKL, HIMC hIMC, UINT uSubFunc, LPVOID lpData)
 
LRESULT WINAPI ImmEscapeW (HKL hKL, HIMC hIMC, UINT uSubFunc, LPVOID lpData)
 
BOOL WINAPI ImmGetOpenStatus (HIMC hIMC)
 
BOOL WINAPI ImmSetOpenStatus (HIMC hIMC, BOOL fOpen)
 
BOOL WINAPI ImmGetStatusWindowPos (HIMC hIMC, LPPOINT lpptPos)
 
BOOL WINAPI ImmSetStatusWindowPos (HIMC hIMC, LPPOINT lpptPos)
 
BOOL WINAPI ImmGetCompositionWindow (HIMC hIMC, LPCOMPOSITIONFORM lpCompForm)
 
BOOL WINAPI ImmSetCompositionWindow (HIMC hIMC, LPCOMPOSITIONFORM lpCompForm)
 
BOOL WINAPI ImmGetCompositionFontA (HIMC hIMC, LPLOGFONTA lplf)
 
BOOL WINAPI ImmGetCompositionFontW (HIMC hIMC, LPLOGFONTW lplf)
 
BOOL WINAPI ImmSetCompositionFontA (HIMC hIMC, LPLOGFONTA lplf)
 
BOOL WINAPI ImmSetCompositionFontW (HIMC hIMC, LPLOGFONTW lplf)
 
DWORD WINAPI ImmGetConversionListA (HKL hKL, HIMC hIMC, LPCSTR pSrc, LPCANDIDATELIST lpDst, DWORD dwBufLen, UINT uFlag)
 
DWORD WINAPI ImmGetConversionListW (HKL hKL, HIMC hIMC, LPCWSTR pSrc, LPCANDIDATELIST lpDst, DWORD dwBufLen, UINT uFlag)
 
BOOL WINAPI ImmGetConversionStatus (HIMC hIMC, LPDWORD lpfdwConversion, LPDWORD lpfdwSentence)
 
BOOL WINAPI ImmSetConversionStatus (HIMC hIMC, DWORD fdwConversion, DWORD fdwSentence)
 
BOOL WINAPI ImmConfigureIMEA (HKL hKL, HWND hWnd, DWORD dwMode, LPVOID lpData)
 
BOOL WINAPI ImmConfigureIMEW (HKL hKL, HWND hWnd, DWORD dwMode, LPVOID lpData)
 
DWORD WINAPI ImmGetImeMenuItemsA (HIMC hIMC, DWORD dwFlags, DWORD dwType, LPIMEMENUITEMINFOA lpImeParentMenu, LPIMEMENUITEMINFOA lpImeMenu, DWORD dwSize)
 
DWORD WINAPI ImmGetImeMenuItemsW (HIMC hIMC, DWORD dwFlags, DWORD dwType, LPIMEMENUITEMINFOW lpImeParentMenu, LPIMEMENUITEMINFOW lpImeMenu, DWORD dwSize)
 

Variables

RTL_CRITICAL_SECTION gcsImeDpi
 
PIMEDPI gpImeDpiList = NULL
 

Macro Definition Documentation

◆ DEFINE_IME_ENTRY

#define DEFINE_IME_ENTRY (   type,
  name,
  params,
  optional 
)
Value:
do { \
fn = GetProcAddress(hIME, #name); \
if (fn) pImeDpi->name = (FN_##name)fn; \
else if (!(optional)) { \
ERR("'%s' not found in the IME module '%s'.\n", #name, debugstr_w(szPath)); \
goto Failed; \
} \
} while (0);
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
#define debugstr_w
Definition: kernel32.h:32
Definition: msg.h:41
Definition: arc.h:79
LPCWSTR szPath
Definition: env.c:37
Definition: name.c:38
#define GetProcAddress(x, y)
Definition: compat.h:612
GLuint const GLchar * name
Definition: glext.h:6031

◆ VALID_CMODE_CAPS

#define VALID_CMODE_CAPS
Value:
IME_CMODE_NATIVE | \
IME_CMODE_KATAKANA | \
IME_CMODE_LANGUAGE | \
IME_CMODE_FULLSHAPE | \
IME_CMODE_ROMAN | \
IME_CMODE_CHARCODE | \
IME_CMODE_HANJACONVERT | \
IME_CMODE_SOFTKBD | \
IME_CMODE_NOCONVERSION | \
IME_CMODE_EUDC | \
IME_CMODE_SYMBOL | \
IME_CMODE_FIXED)
#define IME_CMODE_ALPHANUMERIC
Definition: imm.h:484

◆ VALID_IME_PROP

#define VALID_IME_PROP
Value:
IME_PROP_SPECIAL_UI | \
IME_PROP_CANDLIST_START_FROM_1 | \
IME_PROP_UNICODE | \
IME_PROP_COMPLETE_ON_UNSELECT | \
IME_PROP_END_UNLOAD | \
IME_PROP_KBD_CHAR_FIRST | \
IME_PROP_IGNORE_UPKEYS | \
IME_PROP_NEED_ALTKEY | \
IME_PROP_NO_KEYS_ON_CLOSE | \
IME_PROP_ACCEPT_WIDE_VKEY)
#define IME_PROP_AT_CARET
Definition: imm.h:390

◆ VALID_SCS_CAPS

#define VALID_SCS_CAPS
Value:
SCS_CAP_MAKEREAD | \
SCS_CAP_SETRECONVERTSTRING)
#define SCS_CAP_COMPSTR
Definition: imm.h:403

◆ VALID_SELECT_CAPS

#define VALID_SELECT_CAPS   (SELECT_CAP_CONVERSION | SELECT_CAP_SENTENCE)

◆ VALID_SMODE_CAPS

#define VALID_SMODE_CAPS
Value:
IME_SMODE_PLAURALCLAUSE | \
IME_SMODE_SINGLECONVERT | \
IME_SMODE_AUTOMATIC | \
IME_SMODE_PHRASEPREDICT | \
IME_SMODE_CONVERSATION)
#define IME_SMODE_NONE
Definition: imm.h:504

◆ VALID_UI_CAPS

#define VALID_UI_CAPS
Value:
UI_CAP_ROT90 | \
UI_CAP_ROTANY | \
UI_CAP_SOFTKBD)
#define UI_CAP_2700
Definition: imm.h:397

Function Documentation

◆ Ime32LoadImeDpi()

PIMEDPI APIENTRY Ime32LoadImeDpi ( HKL  hKL,
BOOL  bLock 
)

Definition at line 222 of file ime.c.

223 {
224  IMEINFOEX ImeInfoEx;
225  CHARSETINFO ci;
226  PIMEDPI pImeDpiNew, pImeDpiFound;
227  UINT uCodePage;
228  LCID lcid;
229 
230  if (!ImmGetImeInfoEx(&ImeInfoEx, ImeInfoExKeyboardLayout, &hKL) ||
231  ImeInfoEx.fLoadFlag == 1)
232  {
233  return NULL;
234  }
235 
236  pImeDpiNew = ImmLocalAlloc(HEAP_ZERO_MEMORY, sizeof(IMEDPI));
237  if (pImeDpiNew == NULL)
238  return NULL;
239 
240  pImeDpiNew->hKL = hKL;
241 
242  lcid = LOWORD(hKL);
244  uCodePage = ci.ciACP;
245  else
246  uCodePage = CP_ACP;
247  pImeDpiNew->uCodePage = uCodePage;
248 
249  if (!Imm32LoadIME(&ImeInfoEx, pImeDpiNew))
250  {
251  ImmLocalFree(pImeDpiNew);
252  return FALSE;
253  }
254 
256 
257  pImeDpiFound = Imm32FindImeDpi(hKL);
258  if (pImeDpiFound)
259  {
260  if (!bLock)
261  pImeDpiFound->dwFlags &= ~IMEDPI_FLAG_LOCKED;
262 
264  Imm32FreeIME(pImeDpiNew, FALSE);
265  ImmLocalFree(pImeDpiNew);
266  return pImeDpiFound;
267  }
268  else
269  {
270  if (bLock)
271  {
272  pImeDpiNew->dwFlags |= IMEDPI_FLAG_LOCKED;
273  pImeDpiNew->cLockObj = 1;
274  }
275 
276  pImeDpiNew->pNext = gpImeDpiList;
277  gpImeDpiList = pImeDpiNew;
278 
280  return pImeDpiNew;
281  }
282 }
UINT uCodePage
Definition: ntuser.h:1254
#define TCI_SRCLOCALE
Definition: wingdi.h:964
#define CP_ACP
Definition: compat.h:109
LPVOID APIENTRY ImmLocalAlloc(DWORD dwFlags, DWORD dwBytes)
Definition: utils.c:234
BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey)
Definition: ime.c:686
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
DWORD LCID
Definition: nls.h:13
PIMEDPI gpImeDpiList
Definition: ime.c:17
#define FALSE
Definition: types.h:117
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
DWORD cLockObj
Definition: ntuser.h:1256
BOOL WINAPI TranslateCharsetInfo(_Inout_ PDWORD, _Out_ LPCHARSETINFO, _In_ DWORD)
RTL_CRITICAL_SECTION gcsImeDpi
Definition: ime.c:16
#define ImmLocalFree(lpData)
Definition: precomp.h:89
struct IMEDPI * pNext
Definition: ntuser.h:1250
BOOL APIENTRY Imm32LoadIME(PIMEINFOEX pImeInfoEx, PIMEDPI pImeDpi)
Definition: ime.c:153
DWORD dwFlags
Definition: ntuser.h:1257
uint32_t DWORD_PTR
Definition: typedefs.h:65
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
INT fLoadFlag
Definition: ntuser.h:1183
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
PIMEDPI APIENTRY Imm32FindImeDpi(HKL hKL)
Definition: ime.c:20
VOID APIENTRY Imm32FreeIME(PIMEDPI pImeDpi, BOOL bDestroy)
Definition: ime.c:36
uint32_t * LPDWORD
Definition: typedefs.h:59
#define IMEDPI_FLAG_LOCKED
Definition: ntuser.h:1298
#define LOWORD(l)
Definition: pedump.c:82
HKL hKL
Definition: ntuser.h:1252

Referenced by Imm32FindOrLoadImeDpi(), and ImmLoadIME().

◆ ImeDpi_Escape()

static LRESULT APIENTRY ImeDpi_Escape ( PIMEDPI  pImeDpi,
HIMC  hIMC,
UINT  uSubFunc,
LPVOID  lpData,
HKL  hKL 
)
static

Definition at line 299 of file ime.c.

300 {
301  if (IS_IME_HKL(hKL))
302  return pImeDpi->ImeEscape(hIMC, uSubFunc, lpData);
303 
304  if (Imm32IsCiceroMode() && pImeDpi->CtfImeEscapeEx)
305  return pImeDpi->CtfImeEscapeEx(hIMC, uSubFunc, lpData, hKL);
306 
307  return 0;
308 }
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1203
#define Imm32IsCiceroMode()
Definition: precomp.h:118

Referenced by ImmEscapeA(), and ImmEscapeW().

◆ Imm32FindImeDpi()

PIMEDPI APIENTRY Imm32FindImeDpi ( HKL  hKL)

Definition at line 20 of file ime.c.

21 {
22  PIMEDPI pImeDpi;
23 
25  for (pImeDpi = gpImeDpiList; pImeDpi != NULL; pImeDpi = pImeDpi->pNext)
26  {
27  if (pImeDpi->hKL == hKL)
28  break;
29  }
31 
32  return pImeDpi;
33 }
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
PIMEDPI gpImeDpiList
Definition: ime.c:17
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
RTL_CRITICAL_SECTION gcsImeDpi
Definition: ime.c:16
struct IMEDPI * pNext
Definition: ntuser.h:1250
#define NULL
Definition: types.h:112
HKL hKL
Definition: ntuser.h:1252

Referenced by Ime32LoadImeDpi(), and ImmLoadIME().

◆ Imm32FindOrLoadImeDpi()

PIMEDPI APIENTRY Imm32FindOrLoadImeDpi ( HKL  hKL)

Definition at line 285 of file ime.c.

286 {
287  PIMEDPI pImeDpi;
288 
289  if (!IS_IME_HKL(hKL) && (!Imm32IsCiceroMode() || Imm32Is16BitMode()))
290  return NULL;
291 
292  pImeDpi = ImmLockImeDpi(hKL);
293  if (pImeDpi == NULL)
294  pImeDpi = Ime32LoadImeDpi(hKL, TRUE);
295  return pImeDpi;
296 }
#define TRUE
Definition: types.h:120
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1203
PIMEDPI WINAPI ImmLockImeDpi(HKL hKL)
Definition: ime.c:729
PIMEDPI APIENTRY Ime32LoadImeDpi(HKL hKL, BOOL bLock)
Definition: ime.c:222
#define NULL
Definition: types.h:112
#define Imm32Is16BitMode()
Definition: precomp.h:119
#define Imm32IsCiceroMode()
Definition: precomp.h:118

Referenced by Imm32InternalLockIMC(), ImmConfigureIMEA(), ImmConfigureIMEW(), ImmEnumRegisterWordA(), ImmEnumRegisterWordW(), ImmEscapeA(), ImmEscapeW(), ImmGetConversionListA(), ImmGetConversionListW(), ImmGetProperty(), ImmGetRegisterWordStyleA(), ImmGetRegisterWordStyleW(), ImmRegisterWordA(), ImmRegisterWordW(), ImmUnregisterWordA(), and ImmUnregisterWordW().

◆ Imm32FreeIME()

VOID APIENTRY Imm32FreeIME ( PIMEDPI  pImeDpi,
BOOL  bDestroy 
)

Definition at line 36 of file ime.c.

37 {
38  if (pImeDpi->hInst == NULL)
39  return;
40  if (bDestroy)
41  pImeDpi->ImeDestroy(0);
42  FreeLibrary(pImeDpi->hInst);
43  pImeDpi->hInst = NULL;
44 }
HINSTANCE hInst
Definition: ntuser.h:1251
#define FreeLibrary(x)
Definition: compat.h:607
#define NULL
Definition: types.h:112

Referenced by Ime32LoadImeDpi(), Imm32ReleaseIME(), and ImmUnlockImeDpi().

◆ Imm32GetImeMenuItemWCrossProcess()

DWORD APIENTRY Imm32GetImeMenuItemWCrossProcess ( HIMC  hIMC,
DWORD  dwFlags,
DWORD  dwType,
LPVOID  lpImeParentMenu,
LPVOID  lpImeMenu,
DWORD  dwSize 
)

Definition at line 360 of file ime.c.

362 {
363  FIXME("We have to do something\n");
364  return 0;
365 }
#define FIXME(fmt,...)
Definition: debug.h:111

Referenced by ImmGetImeMenuItemsAW().

◆ Imm32InquireIme()

BOOL APIENTRY Imm32InquireIme ( PIMEDPI  pImeDpi)

Definition at line 47 of file ime.c.

48 {
49  WCHAR szUIClass[64];
50  WNDCLASSW wcW;
51  DWORD dwSysInfoFlags = 0;
52  LPIMEINFO pImeInfo = &pImeDpi->ImeInfo;
53 
55  dwSysInfoFlags |= IME_SYSINFO_WINLOGON;
56 
57  if (IS_IME_HKL(pImeDpi->hKL))
58  {
59  if (!pImeDpi->ImeInquire(pImeInfo, szUIClass, dwSysInfoFlags))
60  return FALSE;
61  }
62  else if (Imm32IsCiceroMode() && pImeDpi->CtfImeInquireExW)
63  {
64  if (!pImeDpi->CtfImeInquireExW(pImeInfo, szUIClass, dwSysInfoFlags, pImeDpi->hKL))
65  return FALSE;
66  }
67  else
68  {
69  return FALSE;
70  }
71 
72  szUIClass[_countof(szUIClass) - 1] = 0;
73 
74  if (pImeInfo->dwPrivateDataSize == 0)
75  pImeInfo->dwPrivateDataSize = sizeof(DWORD);
76 
77 #define VALID_IME_PROP (IME_PROP_AT_CARET | \
78  IME_PROP_SPECIAL_UI | \
79  IME_PROP_CANDLIST_START_FROM_1 | \
80  IME_PROP_UNICODE | \
81  IME_PROP_COMPLETE_ON_UNSELECT | \
82  IME_PROP_END_UNLOAD | \
83  IME_PROP_KBD_CHAR_FIRST | \
84  IME_PROP_IGNORE_UPKEYS | \
85  IME_PROP_NEED_ALTKEY | \
86  IME_PROP_NO_KEYS_ON_CLOSE | \
87  IME_PROP_ACCEPT_WIDE_VKEY)
88 #define VALID_CMODE_CAPS (IME_CMODE_ALPHANUMERIC | \
89  IME_CMODE_NATIVE | \
90  IME_CMODE_KATAKANA | \
91  IME_CMODE_LANGUAGE | \
92  IME_CMODE_FULLSHAPE | \
93  IME_CMODE_ROMAN | \
94  IME_CMODE_CHARCODE | \
95  IME_CMODE_HANJACONVERT | \
96  IME_CMODE_SOFTKBD | \
97  IME_CMODE_NOCONVERSION | \
98  IME_CMODE_EUDC | \
99  IME_CMODE_SYMBOL | \
100  IME_CMODE_FIXED)
101 #define VALID_SMODE_CAPS (IME_SMODE_NONE | \
102  IME_SMODE_PLAURALCLAUSE | \
103  IME_SMODE_SINGLECONVERT | \
104  IME_SMODE_AUTOMATIC | \
105  IME_SMODE_PHRASEPREDICT | \
106  IME_SMODE_CONVERSATION)
107 #define VALID_UI_CAPS (UI_CAP_2700 | \
108  UI_CAP_ROT90 | \
109  UI_CAP_ROTANY | \
110  UI_CAP_SOFTKBD)
111 #define VALID_SCS_CAPS (SCS_CAP_COMPSTR | \
112  SCS_CAP_MAKEREAD | \
113  SCS_CAP_SETRECONVERTSTRING)
114 #define VALID_SELECT_CAPS (SELECT_CAP_CONVERSION | SELECT_CAP_SENTENCE)
115 
116  if (pImeInfo->fdwProperty & ~VALID_IME_PROP)
117  return FALSE;
118  if (pImeInfo->fdwConversionCaps & ~VALID_CMODE_CAPS)
119  return FALSE;
120  if (pImeInfo->fdwSentenceCaps & ~VALID_SMODE_CAPS)
121  return FALSE;
122  if (pImeInfo->fdwUICaps & ~VALID_UI_CAPS)
123  return FALSE;
124  if (pImeInfo->fdwSCSCaps & ~VALID_SCS_CAPS)
125  return FALSE;
126  if (pImeInfo->fdwSelectCaps & ~VALID_SELECT_CAPS)
127  return FALSE;
128 
129 #undef VALID_IME_PROP
130 #undef VALID_CMODE_CAPS
131 #undef VALID_SMODE_CAPS
132 #undef VALID_UI_CAPS
133 #undef VALID_SCS_CAPS
134 #undef VALID_SELECT_CAPS
135 
136  if (pImeInfo->fdwProperty & IME_PROP_UNICODE)
137  {
138  StringCchCopyW(pImeDpi->szUIClass, _countof(pImeDpi->szUIClass), szUIClass);
139  }
140  else
141  {
142  if (pImeDpi->uCodePage != GetACP() && pImeDpi->uCodePage)
143  return FALSE;
144 
146  pImeDpi->szUIClass, _countof(pImeDpi->szUIClass));
147  }
148 
149  return GetClassInfoW(pImeDpi->hInst, pImeDpi->szUIClass, &wcW);
150 }
UINT uCodePage
Definition: ntuser.h:1254
IMEINFO ImeInfo
Definition: ntuser.h:1253
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:232
#define VALID_SMODE_CAPS
#define VALID_IME_PROP
#define CP_ACP
Definition: compat.h:109
#define MB_PRECOMPOSED
Definition: winnls.h:281
char * LPSTR
Definition: xmlstorage.h:182
#define DWORD
Definition: nt_native.h:44
#define IME_SYSINFO_WINLOGON
Definition: imm.h:238
#define FALSE
Definition: types.h:117
HINSTANCE hInst
Definition: ntuser.h:1251
DWORD fdwUICaps
Definition: imm.h:161
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
BOOL WINAPI GetClassInfoW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _Out_ LPWNDCLASSW)
UINT WINAPI GetACP(VOID)
Definition: nls.c:2218
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1203
#define IME_PROP_UNICODE
Definition: imm.h:393
DWORD fdwSelectCaps
Definition: imm.h:163
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD fdwProperty
Definition: imm.h:158
#define _countof(array)
Definition: sndvol32.h:68
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD fdwConversionCaps
Definition: imm.h:159
WCHAR szUIClass[16]
Definition: ntuser.h:1255
DWORD dwPrivateDataSize
Definition: imm.h:157
DWORD fdwSCSCaps
Definition: imm.h:162
#define VALID_CMODE_CAPS
#define MultiByteToWideChar
Definition: compat.h:110
#define VALID_SCS_CAPS
DWORD fdwSentenceCaps
Definition: imm.h:160
#define VALID_UI_CAPS
#define Imm32IsCiceroMode()
Definition: precomp.h:118
#define VALID_SELECT_CAPS
HKL hKL
Definition: ntuser.h:1252

Referenced by Imm32LoadIME().

◆ Imm32LoadIME()

BOOL APIENTRY Imm32LoadIME ( PIMEINFOEX  pImeInfoEx,
PIMEDPI  pImeDpi 
)

Definition at line 153 of file ime.c.

154 {
156  HINSTANCE hIME;
157  FARPROC fn;
158  BOOL ret = FALSE;
159 
161  return FALSE;
162 
163  hIME = GetModuleHandleW(szPath);
164  if (hIME == NULL)
165  {
166  hIME = LoadLibraryW(szPath);
167  if (hIME == NULL)
168  {
169  ERR("Imm32LoadIME: LoadLibraryW(%S) failed\n", szPath);
170  return FALSE;
171  }
172  }
173  pImeDpi->hInst = hIME;
174 
175 #define DEFINE_IME_ENTRY(type, name, params, optional) \
176  do { \
177  fn = GetProcAddress(hIME, #name); \
178  if (fn) pImeDpi->name = (FN_##name)fn; \
179  else if (!(optional)) { \
180  ERR("'%s' not found in the IME module '%s'.\n", #name, debugstr_w(szPath)); \
181  goto Failed; \
182  } \
183  } while (0);
184 #include "imetable.h"
185 #undef DEFINE_IME_ENTRY
186 
187  if (Imm32InquireIme(pImeDpi))
188  {
189  ret = TRUE;
190  }
191  else
192  {
193  ERR("Imm32InquireIme failed\n");
194 Failed:
195  ret = FALSE;
196  FreeLibrary(pImeDpi->hInst);
197  pImeDpi->hInst = NULL;
198  }
199 
200  if (pImeInfoEx->fLoadFlag == 0)
201  {
202  if (ret)
203  {
204  C_ASSERT(sizeof(pImeInfoEx->wszUIClass) == sizeof(pImeDpi->szUIClass));
205  pImeInfoEx->ImeInfo = pImeDpi->ImeInfo;
206  RtlCopyMemory(pImeInfoEx->wszUIClass, pImeDpi->szUIClass,
207  sizeof(pImeInfoEx->wszUIClass));
208  pImeInfoEx->fLoadFlag = 2;
209  }
210  else
211  {
212  pImeInfoEx->fLoadFlag = 1;
213  }
214 
215  NtUserSetImeInfoEx(pImeInfoEx);
216  }
217 
218  return ret;
219 }
IMEINFO ImeInfo
Definition: ntuser.h:1253
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HINSTANCE hInst
Definition: ntuser.h:1251
unsigned int BOOL
Definition: ntddk_ex.h:94
#define LoadLibraryW(x)
Definition: compat.h:606
#define C_ASSERT(e)
Definition: intsafe.h:73
Definition: arc.h:79
#define FreeLibrary(x)
Definition: compat.h:607
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
WCHAR wszUIClass[16]
Definition: ntuser.h:1180
BOOL APIENTRY Imm32InquireIme(PIMEDPI pImeDpi)
Definition: ime.c:47
int ret
WCHAR szUIClass[16]
Definition: ntuser.h:1255
BOOL Imm32GetSystemLibraryPath(LPWSTR pszPath, DWORD cchPath, LPCWSTR pszFileName)
Definition: utils.c:122
#define ERR(fmt,...)
Definition: debug.h:110
WCHAR wszImeFile[80]
Definition: ntuser.h:1187
IMEINFO ImeInfo
Definition: ntuser.h:1179
LPCWSTR szPath
Definition: env.c:37
#define NULL
Definition: types.h:112
INT fLoadFlag
Definition: ntuser.h:1183
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
int(* FARPROC)()
Definition: compat.h:36
BOOL NTAPI NtUserSetImeInfoEx(PIMEINFOEX pImeInfoEx)
Definition: ime.c:1111

Referenced by Ime32LoadImeDpi().

◆ Imm32ReleaseIME()

BOOL APIENTRY Imm32ReleaseIME ( HKL  hKL)

Definition at line 311 of file ime.c.

312 {
313  BOOL ret = TRUE;
314  PIMEDPI pImeDpi0, pImeDpi1;
315 
317 
318  for (pImeDpi0 = gpImeDpiList; pImeDpi0; pImeDpi0 = pImeDpi0->pNext)
319  {
320  if (pImeDpi0->hKL == hKL)
321  break;
322  }
323 
324  if (!pImeDpi0)
325  goto Quit;
326 
327  if (pImeDpi0->cLockObj)
328  {
329  pImeDpi0->dwFlags |= IMEDPI_FLAG_UNKNOWN;
330  ret = FALSE;
331  goto Quit;
332  }
333 
334  if (gpImeDpiList == pImeDpi0)
335  {
336  gpImeDpiList = pImeDpi0->pNext;
337  }
338  else if (gpImeDpiList)
339  {
340  for (pImeDpi1 = gpImeDpiList; pImeDpi1; pImeDpi1 = pImeDpi1->pNext)
341  {
342  if (pImeDpi1->pNext == pImeDpi0)
343  {
344  pImeDpi1->pNext = pImeDpi0->pNext;
345  break;
346  }
347  }
348  }
349 
350  Imm32FreeIME(pImeDpi0, TRUE);
351  ImmLocalFree(pImeDpi0);
352 
353 Quit:
355  return ret;
356 }
#define TRUE
Definition: types.h:120
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
PIMEDPI gpImeDpiList
Definition: ime.c:17
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
DWORD cLockObj
Definition: ntuser.h:1256
RTL_CRITICAL_SECTION gcsImeDpi
Definition: ime.c:16
#define ImmLocalFree(lpData)
Definition: precomp.h:89
int ret
struct IMEDPI * pNext
Definition: ntuser.h:1250
DWORD dwFlags
Definition: ntuser.h:1257
VOID APIENTRY Imm32FreeIME(PIMEDPI pImeDpi, BOOL bDestroy)
Definition: ime.c:36
#define IMEDPI_FLAG_UNKNOWN
Definition: ntuser.h:1297
HKL hKL
Definition: ntuser.h:1252

Referenced by ImmFreeLayout().

◆ ImmConfigureIMEA()

BOOL WINAPI ImmConfigureIMEA ( HKL  hKL,
HWND  hWnd,
DWORD  dwMode,
LPVOID  lpData 
)

Definition at line 1686 of file ime.c.

1687 {
1688  BOOL ret = FALSE;
1689  PIMEDPI pImeDpi;
1690  REGISTERWORDW RegWordW;
1691  LPREGISTERWORDA pRegWordA;
1692 
1693  TRACE("(%p, %p, 0x%lX, %p)\n", hKL, hWnd, dwMode, lpData);
1694 
1696  return FALSE;
1697 
1698  pImeDpi = Imm32FindOrLoadImeDpi(hKL);
1699  if (!pImeDpi)
1700  return FALSE;
1701 
1702  RtlZeroMemory(&RegWordW, sizeof(RegWordW));
1703 
1704  if (!ImeDpi_IsUnicode(pImeDpi) || !lpData || dwMode != IME_CONFIG_REGISTERWORD)
1705  goto DoIt;
1706 
1707  pRegWordA = lpData;
1708 
1709  if (pRegWordA->lpReading)
1710  {
1711  RegWordW.lpReading = Imm32WideFromAnsi(pRegWordA->lpReading);
1712  if (!RegWordW.lpReading)
1713  goto Quit;
1714  }
1715 
1716  if (pRegWordA->lpWord)
1717  {
1718  RegWordW.lpWord = Imm32WideFromAnsi(pRegWordA->lpWord);
1719  if (!RegWordW.lpWord)
1720  goto Quit;
1721  }
1722 
1723  lpData = &RegWordW;
1724 
1725 DoIt:
1726  SendMessageW(hWnd, WM_IME_SYSTEM, 0x1B, 0);
1727  ret = pImeDpi->ImeConfigure(hKL, hWnd, dwMode, lpData);
1728  SendMessageW(hWnd, WM_IME_SYSTEM, 0x1A, 0);
1729 
1730 Quit:
1731  ImmLocalFree(RegWordW.lpReading);
1732  ImmLocalFree(RegWordW.lpWord);
1733  ImmUnlockImeDpi(pImeDpi);
1734  return ret;
1735 }
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:758
HWND hWnd
Definition: settings.c:17
#define FALSE
Definition: types.h:117
LPWSTR lpReading
Definition: dimm.idl:35
#define IME_CONFIG_REGISTERWORD
Definition: imm.h:554
unsigned int BOOL
Definition: ntddk_ex.h:94
LPSTR lpReading
Definition: imm.h:38
#define WM_IME_SYSTEM
Definition: undocuser.h:59
#define TRACE(s)
Definition: solgame.cpp:4
#define ImeDpi_IsUnicode(pImeDpi)
Definition: precomp.h:116
#define ImmLocalFree(lpData)
Definition: precomp.h:89
LPSTR lpWord
Definition: imm.h:39
int ret
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPWSTR lpWord
Definition: dimm.idl:36
PIMEDPI APIENTRY Imm32FindOrLoadImeDpi(HKL hKL)
Definition: ime.c:285
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
static BOOL Imm32IsCrossProcessAccess(HWND hWnd)
Definition: precomp.h:108
LPWSTR APIENTRY Imm32WideFromAnsi(LPCSTR pszA)
Definition: utils.c:65
#define ValidateHwnd(hwnd)
Definition: precomp.h:85

Referenced by ActiveIMMApp_ConfigureIMEA(), and test_ImmIME().

◆ ImmConfigureIMEW()

BOOL WINAPI ImmConfigureIMEW ( HKL  hKL,
HWND  hWnd,
DWORD  dwMode,
LPVOID  lpData 
)

Definition at line 1740 of file ime.c.

1741 {
1742  BOOL ret = FALSE;
1743  PIMEDPI pImeDpi;
1744  REGISTERWORDA RegWordA;
1745  LPREGISTERWORDW pRegWordW;
1746 
1747  TRACE("(%p, %p, 0x%lX, %p)\n", hKL, hWnd, dwMode, lpData);
1748 
1750  return FALSE;
1751 
1752  pImeDpi = Imm32FindOrLoadImeDpi(hKL);
1753  if (!pImeDpi)
1754  return FALSE;
1755 
1756  RtlZeroMemory(&RegWordA, sizeof(RegWordA));
1757 
1758  if (ImeDpi_IsUnicode(pImeDpi) || !lpData || dwMode != IME_CONFIG_REGISTERWORD)
1759  goto DoIt;
1760 
1761  pRegWordW = lpData;
1762 
1763  if (pRegWordW->lpReading)
1764  {
1765  RegWordA.lpReading = Imm32AnsiFromWide(pRegWordW->lpReading);
1766  if (!RegWordA.lpReading)
1767  goto Quit;
1768  }
1769 
1770  if (pRegWordW->lpWord)
1771  {
1772  RegWordA.lpWord = Imm32AnsiFromWide(pRegWordW->lpWord);
1773  if (!RegWordA.lpWord)
1774  goto Quit;
1775  }
1776 
1777  lpData = &RegWordA;
1778 
1779 DoIt:
1780  SendMessageW(hWnd, WM_IME_SYSTEM, 0x1B, 0);
1781  ret = pImeDpi->ImeConfigure(hKL, hWnd, dwMode, lpData);
1782  SendMessageW(hWnd, WM_IME_SYSTEM, 0x1A, 0);
1783 
1784 Quit:
1785  ImmLocalFree(RegWordA.lpReading);
1786  ImmLocalFree(RegWordA.lpWord);
1787  ImmUnlockImeDpi(pImeDpi);
1788  return ret;
1789 }
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:758
HWND hWnd
Definition: settings.c:17
LPSTR APIENTRY Imm32AnsiFromWide(LPCWSTR pszW)
Definition: utils.c:76
#define FALSE
Definition: types.h:117
#define IME_CONFIG_REGISTERWORD
Definition: imm.h:554
unsigned int BOOL
Definition: ntddk_ex.h:94
LPSTR lpWord
Definition: dimm.idl:31
LPSTR lpReading
Definition: dimm.idl:30
#define WM_IME_SYSTEM
Definition: undocuser.h:59
LPWSTR lpWord
Definition: imm.h:44
#define TRACE(s)
Definition: solgame.cpp:4
LPWSTR lpReading
Definition: imm.h:43
#define ImeDpi_IsUnicode(pImeDpi)
Definition: precomp.h:116
#define ImmLocalFree(lpData)
Definition: precomp.h:89
int ret
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
PIMEDPI APIENTRY Imm32FindOrLoadImeDpi(HKL hKL)
Definition: ime.c:285
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
static BOOL Imm32IsCrossProcessAccess(HWND hWnd)
Definition: precomp.h:108
#define ValidateHwnd(hwnd)
Definition: precomp.h:85

Referenced by ActiveIMMApp_ConfigureIMEW(), ImeWnd_OnImeSystem(), and test_ImmIME().

◆ ImmDisableIME()

BOOL WINAPI ImmDisableIME ( DWORD  dwThreadId)

Definition at line 822 of file ime.c.

823 {
825 }
BOOL NTAPI NtUserDisableThreadIme(DWORD dwThreadID)
Definition: ime.c:858
DWORD dwThreadId
Definition: fdebug.c:31

Referenced by ActiveIMMApp_DisableIME(), and test_default_ime_disabled_cb().

◆ ImmDisableLegacyIME()

BOOL WINAPI ImmDisableLegacyIME ( void  )

Definition at line 676 of file ime.c.

677 {
678  FIXME("stub\n");
679  return TRUE;
680 }
#define TRUE
Definition: types.h:120
#define FIXME(fmt,...)
Definition: debug.h:111

◆ ImmEscapeA()

LRESULT WINAPI ImmEscapeA ( HKL  hKL,
HIMC  hIMC,
UINT  uSubFunc,
LPVOID  lpData 
)

Definition at line 980 of file ime.c.

981 {
982  LRESULT ret;
983  PIMEDPI pImeDpi;
984  INT cch;
985  CHAR szA[MAX_IMM_FILENAME];
986  WCHAR szW[MAX_IMM_FILENAME];
987 
988  TRACE("(%p, %p, %u, %p)\n", hKL, hIMC, uSubFunc, lpData);
989 
990  pImeDpi = Imm32FindOrLoadImeDpi(hKL);
991  if (!pImeDpi)
992  return 0;
993 
994  if (!ImeDpi_IsUnicode(pImeDpi) || !lpData)
995  {
996  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
997  ImmUnlockImeDpi(pImeDpi);
998  return ret;
999  }
1000 
1001  switch (uSubFunc)
1002  {
1004  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
1005 
1006  cch = 0;
1007  if (HIWORD(ret))
1008  szW[cch++] = HIWORD(ret);
1009  if (LOWORD(ret))
1010  szW[cch++] = LOWORD(ret);
1011 
1012  cch = WideCharToMultiByte(pImeDpi->uCodePage, 0, szW, cch, szA, _countof(szA),
1013  NULL, NULL);
1014  switch (cch)
1015  {
1016  case 1:
1017  ret = MAKEWORD(szA[0], 0);
1018  break;
1019  case 2:
1020  ret = MAKEWORD(szA[1], szA[0]);
1021  break;
1022  case 3:
1023  ret = MAKELONG(MAKEWORD(szA[2], szA[1]), MAKEWORD(szA[0], 0));
1024  break;
1025  case 4:
1026  ret = MAKELONG(MAKEWORD(szA[3], szA[2]), MAKEWORD(szA[1], szA[0]));
1027  break;
1028  default:
1029  ret = 0;
1030  break;
1031  }
1032  break;
1033 
1035  case IME_ESC_IME_NAME:
1037  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, szW, hKL);
1038  if (ret)
1039  {
1040  szW[_countof(szW) - 1] = 0;
1041  WideCharToMultiByte(pImeDpi->uCodePage, 0, szW, -1,
1042  lpData, MAX_IMM_FILENAME, NULL, NULL);
1043  ((LPSTR)lpData)[MAX_IMM_FILENAME - 1] = 0;
1044  }
1045  break;
1046 
1048  case IME_ESC_HANJA_MODE:
1050  lpData, -1, szW, _countof(szW));
1051  szW[_countof(szW) - 1] = 0;
1052  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, szW, hKL);
1053  break;
1054 
1055  default:
1056  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
1057  break;
1058  }
1059 
1060  ImmUnlockImeDpi(pImeDpi);
1061  return ret;
1062 }
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:758
UINT uCodePage
Definition: ntuser.h:1254
#define IME_ESC_SEQUENCE_TO_INTERNAL
Definition: imm.h:563
#define WideCharToMultiByte
Definition: compat.h:111
#define IME_ESC_HANJA_MODE
Definition: imm.h:569
#define MAKEWORD(a, b)
Definition: typedefs.h:248
char CHAR
Definition: xmlstorage.h:175
#define MB_PRECOMPOSED
Definition: winnls.h:281
#define IME_ESC_SET_EUDC_DICTIONARY
Definition: imm.h:565
char * LPSTR
Definition: xmlstorage.h:182
#define IME_ESC_IME_NAME
Definition: imm.h:567
int32_t INT
Definition: typedefs.h:58
#define IME_ESC_GET_EUDC_DICTIONARY
Definition: imm.h:564
static LRESULT APIENTRY ImeDpi_Escape(PIMEDPI pImeDpi, HIMC hIMC, UINT uSubFunc, LPVOID lpData, HKL hKL)
Definition: ime.c:299
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define IME_ESC_GETHELPFILENAME
Definition: imm.h:572
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define ImeDpi_IsUnicode(pImeDpi)
Definition: precomp.h:116
#define MAX_IMM_FILENAME
Definition: precomp.h:54
int ret
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
PIMEDPI APIENTRY Imm32FindOrLoadImeDpi(HKL hKL)
Definition: ime.c:285
#define HIWORD(l)
Definition: typedefs.h:247
LONG_PTR LRESULT
Definition: windef.h:209
IN PCTCH IN DWORD cch
Definition: pager.h:36
#define LOWORD(l)
Definition: pedump.c:82

Referenced by ActiveIMMApp_EscapeA().

◆ ImmEscapeW()

LRESULT WINAPI ImmEscapeW ( HKL  hKL,
HIMC  hIMC,
UINT  uSubFunc,
LPVOID  lpData 
)

Definition at line 1067 of file ime.c.

1068 {
1069  LRESULT ret;
1070  PIMEDPI pImeDpi;
1071  INT cch;
1072  CHAR szA[MAX_IMM_FILENAME];
1073  WCHAR szW[MAX_IMM_FILENAME];
1074  WORD word;
1075 
1076  TRACE("(%p, %p, %u, %p)\n", hKL, hIMC, uSubFunc, lpData);
1077 
1078  pImeDpi = Imm32FindOrLoadImeDpi(hKL);
1079  if (!pImeDpi)
1080  return 0;
1081 
1082  if (ImeDpi_IsUnicode(pImeDpi) || !lpData)
1083  {
1084  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
1085  ImmUnlockImeDpi(pImeDpi);
1086  return ret;
1087  }
1088 
1089  switch (uSubFunc)
1090  {
1092  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
1093 
1094  word = LOWORD(ret);
1095  cch = 0;
1096  if (HIBYTE(word))
1097  szA[cch++] = HIBYTE(word);
1098  if (LOBYTE(word))
1099  szA[cch++] = LOBYTE(word);
1100 
1102  szA, cch, szW, _countof(szW));
1103  switch (cch)
1104  {
1105  case 1: ret = szW[0]; break;
1106  case 2: ret = MAKELONG(szW[1], szW[0]); break;
1107  default: ret = 0; break;
1108  }
1109  break;
1110 
1112  case IME_ESC_IME_NAME:
1114  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, szA, hKL);
1115  if (ret)
1116  {
1117  szA[_countof(szA) - 1] = 0;
1119  szA, -1, lpData, MAX_IMM_FILENAME);
1120  ((LPWSTR)lpData)[MAX_IMM_FILENAME - 1] = 0;
1121  }
1122  break;
1123 
1125  case IME_ESC_HANJA_MODE:
1126  WideCharToMultiByte(pImeDpi->uCodePage, 0,
1127  lpData, -1, szA, _countof(szA), NULL, NULL);
1128  szA[_countof(szA) - 1] = 0;
1129  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, szA, hKL);
1130  break;
1131 
1132  default:
1133  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
1134  break;
1135  }
1136 
1137  ImmUnlockImeDpi(pImeDpi);
1138  return ret;
1139 }
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:758
UINT uCodePage
Definition: ntuser.h:1254
#define IME_ESC_SEQUENCE_TO_INTERNAL
Definition: imm.h:563
#define WideCharToMultiByte
Definition: compat.h:111
#define IME_ESC_HANJA_MODE
Definition: imm.h:569
#define LOBYTE(W)
Definition: jmemdos.c:487
char CHAR
Definition: xmlstorage.h:175
#define MB_PRECOMPOSED
Definition: winnls.h:281
#define HIBYTE(W)
Definition: jmemdos.c:486
#define IME_ESC_SET_EUDC_DICTIONARY
Definition: imm.h:565
#define IME_ESC_IME_NAME
Definition: imm.h:567
int32_t INT
Definition: typedefs.h:58
#define IME_ESC_GET_EUDC_DICTIONARY
Definition: imm.h:564
static LRESULT APIENTRY ImeDpi_Escape(PIMEDPI pImeDpi, HIMC hIMC, UINT uSubFunc, LPVOID lpData, HKL hKL)
Definition: ime.c:299
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define IME_ESC_GETHELPFILENAME
Definition: imm.h:572
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
unsigned short WORD
Definition: ntddk_ex.h:93
#define ImeDpi_IsUnicode(pImeDpi)
Definition: precomp.h:116
#define MAX_IMM_FILENAME
Definition: precomp.h:54
int ret
#define NULL
Definition: types.h:112
const WCHAR * word
Definition: lex.c:36
#define MultiByteToWideChar
Definition: compat.h:110
PIMEDPI APIENTRY Imm32FindOrLoadImeDpi(HKL hKL)
Definition: ime.c:285
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LONG_PTR LRESULT
Definition: windef.h:209
IN PCTCH IN DWORD cch
Definition: pager.h:36
#define LOWORD(l)
Definition: pedump.c:82

Referenced by ActiveIMMApp_EscapeW().

◆ ImmGetCompositionFontA()

BOOL WINAPI ImmGetCompositionFontA ( HIMC  hIMC,
LPLOGFONTA  lplf 
)

Definition at line 1307 of file ime.c.

1308 {
1309  PCLIENTIMC pClientImc;
1310  BOOL ret = FALSE, bWide;
1311  LPINPUTCONTEXT pIC;
1312 
1313  TRACE("(%p, %p)\n", hIMC, lplf);
1314 
1315  pClientImc = ImmLockClientImc(hIMC);
1316  if (pClientImc == NULL)
1317  return FALSE;
1318 
1319  bWide = (pClientImc->dwFlags & CLIENTIMC_WIDE);
1320  ImmUnlockClientImc(pClientImc);
1321 
1322  pIC = ImmLockIMC(hIMC);
1323  if (pIC == NULL)
1324  return FALSE;
1325 
1326  if (pIC->fdwInit & INIT_LOGFONT)
1327  {
1328  if (bWide)
1329  LogFontWideToAnsi(&pIC->lfFont.W, lplf);
1330  else
1331  *lplf = pIC->lfFont.A;
1332 
1333  ret = TRUE;
1334  }
1335 
1336  ImmUnlockIMC(hIMC);
1337  return ret;
1338 }
LOGFONTA A
Definition: immdev.h:46
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1023
#define CLIENTIMC_WIDE
Definition: ntuser.h:1325
union _tagINPUTCONTEXT::@2000 lfFont
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define INIT_LOGFONT
Definition: immdev.h:129
PCLIENTIMC WINAPI ImmLockClientImc(HIMC hImc)
Definition: imm.c:909
#define TRACE(s)
Definition: solgame.cpp:4
VOID APIENTRY LogFontWideToAnsi(const LOGFONTW *plfW, LPLOGFONTA plfA)
Definition: utils.c:145
int ret
DWORD fdwInit
Definition: immdev.h:57
#define NULL
Definition: types.h:112
DWORD dwFlags
Definition: ntuser.h:1305
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1032
LOGFONTW W
Definition: immdev.h:47
VOID WINAPI ImmUnlockClientImc(PCLIENTIMC pClientImc)
Definition: imm.c:954

Referenced by ActiveIMMApp_GetCompositionFontA(), ImeWnd_OnImeControl(), test_ImmThreads(), and test_InvalidIMC().

◆ ImmGetCompositionFontW()

BOOL WINAPI ImmGetCompositionFontW ( HIMC  hIMC,
LPLOGFONTW  lplf 
)

Definition at line 1343 of file ime.c.

1344 {
1345  PCLIENTIMC pClientImc;
1346  BOOL bWide;
1347  LPINPUTCONTEXT pIC;
1348  BOOL ret = FALSE;
1349 
1350  TRACE("(%p, %p)\n", hIMC, lplf);
1351 
1352  pClientImc = ImmLockClientImc(hIMC);
1353  if (pClientImc == NULL)
1354  return FALSE;
1355 
1356  bWide = (pClientImc->dwFlags & CLIENTIMC_WIDE);
1357  ImmUnlockClientImc(pClientImc);
1358 
1359  pIC = ImmLockIMC(hIMC);
1360  if (pIC == NULL)
1361  return FALSE;
1362 
1363  if (pIC->fdwInit & INIT_LOGFONT)
1364  {
1365  if (bWide)
1366  *lplf = pIC->lfFont.W;
1367  else
1368  LogFontAnsiToWide(&pIC->lfFont.A, lplf);
1369 
1370  ret = TRUE;
1371  }
1372 
1373  ImmUnlockIMC(hIMC);
1374  return ret;
1375 }
LOGFONTA A
Definition: immdev.h:46
VOID APIENTRY LogFontAnsiToWide(const LOGFONTA *plfA, LPLOGFONTW plfW)
Definition: utils.c:132
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1023
#define CLIENTIMC_WIDE
Definition: ntuser.h:1325
union _tagINPUTCONTEXT::@2000 lfFont
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define INIT_LOGFONT
Definition: immdev.h:129
PCLIENTIMC WINAPI ImmLockClientImc(HIMC hImc)
Definition: imm.c:909
#define TRACE(s)
Definition: solgame.cpp:4
int ret
DWORD fdwInit
Definition: immdev.h:57
#define NULL
Definition: types.h:112
DWORD dwFlags
Definition: ntuser.h:1305
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1032
LOGFONTW W
Definition: immdev.h:47
VOID WINAPI ImmUnlockClientImc(PCLIENTIMC pClientImc)
Definition: imm.c:954

Referenced by ActiveIMMApp_GetCompositionFontW(), and ImeWnd_OnImeControl().

◆ ImmGetCompositionWindow()

BOOL WINAPI ImmGetCompositionWindow ( HIMC  hIMC,
LPCOMPOSITIONFORM  lpCompForm 
)

Definition at line 1256 of file ime.c.

1257 {
1258  LPINPUTCONTEXT pIC;
1259  BOOL ret = FALSE;
1260 
1261  TRACE("(%p, %p)\n", hIMC, lpCompForm);
1262 
1263  pIC = ImmLockIMC(hIMC);
1264  if (!pIC)
1265  return FALSE;
1266 
1267  if (pIC->fdwInit & INIT_COMPFORM)
1268  {
1269  *lpCompForm = pIC->cfCompForm;
1270  ret = TRUE;
1271  }
1272 
1273  ImmUnlockIMC(hIMC);
1274  return ret;
1275 }
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1023
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
COMPOSITIONFORM cfCompForm
Definition: immdev.h:49
int ret
DWORD fdwInit
Definition: immdev.h:57
#define INIT_COMPFORM
Definition: immdev.h:130
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1032

Referenced by ActiveIMMApp_GetCompositionWindow(), ImeWnd_OnImeSystem(), test_ImmThreads(), and test_InvalidIMC().

◆ ImmGetConversionListA()

DWORD WINAPI ImmGetConversionListA ( HKL  hKL,
HIMC  hIMC,
LPCSTR  pSrc,
LPCANDIDATELIST  lpDst,
DWORD  dwBufLen,
UINT  uFlag 
)

Definition at line 1496 of file ime.c.

1498 {
1499  DWORD ret = 0;
1500  UINT cb;
1501  LPWSTR pszSrcW = NULL;
1502  LPCANDIDATELIST pCL = NULL;
1503  PIMEDPI pImeDpi;
1504 
1505  TRACE("(%p, %p, %s, %p, %lu, 0x%lX)\n", hKL, hIMC, debugstr_a(pSrc),
1506  lpDst, dwBufLen, uFlag);
1507 
1508  pImeDpi = Imm32FindOrLoadImeDpi(hKL);
1509  if (pImeDpi == NULL)
1510  return 0;
1511 
1512  if (!ImeDpi_IsUnicode(pImeDpi))
1513  {
1514  ret = pImeDpi->ImeConversionList(hIMC, pSrc, lpDst, dwBufLen, uFlag);
1515  ImmUnlockImeDpi(pImeDpi);
1516  return ret;
1517  }
1518 
1519  if (pSrc)
1520  {
1521  pszSrcW = Imm32WideFromAnsi(pSrc);
1522  if (pszSrcW == NULL)
1523  goto Quit;
1524  }
1525 
1526  cb = pImeDpi->ImeConversionList(hIMC, pszSrcW, NULL, 0, uFlag);
1527  if (cb == 0)
1528  goto Quit;
1529 
1530  pCL = ImmLocalAlloc(0, cb);
1531  if (pCL == NULL)
1532  goto Quit;
1533 
1534  cb = pImeDpi->ImeConversionList(hIMC, pszSrcW, pCL, cb, uFlag);
1535  if (cb == 0)
1536  goto Quit;
1537 
1538  ret = CandidateListWideToAnsi(pCL, lpDst, dwBufLen, CP_ACP);
1539 
1540 Quit:
1541  ImmLocalFree(pszSrcW);
1542  ImmLocalFree(pCL);
1543  ImmUnlockImeDpi(pImeDpi);
1544  return ret;
1545 }
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:758
#define CP_ACP
Definition: compat.h:109
LPVOID APIENTRY ImmLocalAlloc(DWORD dwFlags, DWORD dwBytes)
Definition: utils.c:234
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_ DWORD _In_ DWORD dwBufLen
Definition: wincrypt.h:4245
DWORD APIENTRY CandidateListWideToAnsi(const CANDIDATELIST *pWideCL, LPCANDIDATELIST pAnsiCL, DWORD dwBufLen, UINT uCodePage)
Definition: candidate.c:14
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ImeDpi_IsUnicode(pImeDpi)
Definition: precomp.h:116
#define ImmLocalFree(lpData)
Definition: precomp.h:89
int ret
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
PIMEDPI APIENTRY Imm32FindOrLoadImeDpi(HKL hKL)
Definition: ime.c:285
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPWSTR APIENTRY Imm32WideFromAnsi(LPCSTR pszA)
Definition: utils.c:65

Referenced by ActiveIMMApp_GetConversionListA().

◆ ImmGetConversionListW()

DWORD WINAPI ImmGetConversionListW ( HKL  hKL,
HIMC  hIMC,
LPCWSTR  pSrc,
LPCANDIDATELIST  lpDst,
DWORD  dwBufLen,
UINT  uFlag 
)

Definition at line 1551 of file ime.c.

1553 {
1554  DWORD ret = 0;
1555  INT cb;
1556  PIMEDPI pImeDpi;
1557  LPCANDIDATELIST pCL = NULL;
1558  LPSTR pszSrcA = NULL;
1559 
1560  TRACE("(%p, %p, %s, %p, %lu, 0x%lX)\n", hKL, hIMC, debugstr_w(pSrc),
1561  lpDst, dwBufLen, uFlag);
1562 
1563  pImeDpi = Imm32FindOrLoadImeDpi(hKL);
1564  if (!pImeDpi)
1565  return 0;
1566 
1567  if (ImeDpi_IsUnicode(pImeDpi))
1568  {
1569  ret = pImeDpi->ImeConversionList(hIMC, pSrc, lpDst, dwBufLen, uFlag);
1570  ImmUnlockImeDpi(pImeDpi);
1571  return ret;
1572  }
1573 
1574  if (pSrc)
1575  {
1576  pszSrcA = Imm32AnsiFromWide(pSrc);
1577  if (pszSrcA == NULL)
1578  goto Quit;
1579  }
1580 
1581  cb = pImeDpi->ImeConversionList(hIMC, pszSrcA, NULL, 0, uFlag);
1582  if (cb == 0)
1583  goto Quit;
1584 
1585  pCL = ImmLocalAlloc(0, cb);
1586  if (!pCL)
1587  goto Quit;
1588 
1589  cb = pImeDpi->ImeConversionList(hIMC, pszSrcA, pCL, cb, uFlag);
1590  if (!cb)
1591  goto Quit;
1592 
1593  ret = CandidateListAnsiToWide(pCL, lpDst, dwBufLen, CP_ACP);
1594 
1595 Quit:
1596  ImmLocalFree(pszSrcA);
1597  ImmLocalFree(pCL);
1598  ImmUnlockImeDpi(pImeDpi);
1599  return ret;
1600 }
DWORD APIENTRY CandidateListAnsiToWide(const CANDIDATELIST *pAnsiCL, LPCANDIDATELIST pWideCL, DWORD dwBufLen, UINT uCodePage)
Definition: candidate.c:84
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:758
#define CP_ACP
Definition: compat.h:109
LPVOID APIENTRY ImmLocalAlloc(DWORD dwFlags, DWORD dwBytes)
Definition: utils.c:234
char * LPSTR
Definition: xmlstorage.h:182
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_ DWORD _In_ DWORD dwBufLen
Definition: wincrypt.h:4245
int32_t INT
Definition: typedefs.h:58
LPSTR APIENTRY Imm32AnsiFromWide(LPCWSTR pszW)
Definition: utils.c:76
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ImeDpi_IsUnicode(pImeDpi)
Definition: precomp.h:116
#define ImmLocalFree(lpData)
Definition: precomp.h:89
int ret
#define NULL
Definition: types.h:112
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
PIMEDPI APIENTRY Imm32FindOrLoadImeDpi(HKL hKL)
Definition: ime.c:285

Referenced by ActiveIMMApp_GetConversionListW().

◆ ImmGetConversionStatus()

BOOL WINAPI ImmGetConversionStatus ( HIMC  hIMC,
LPDWORD  lpfdwConversion,
LPDWORD  lpfdwSentence 
)

Definition at line 1605 of file ime.c.

1606 {
1607  LPINPUTCONTEXT pIC;
1608 
1609  TRACE("(%p %p %p)\n", hIMC, lpfdwConversion, lpfdwSentence);
1610 
1611  pIC = ImmLockIMC(hIMC);
1612  if (!pIC)
1613  return FALSE;
1614 
1615  if (lpfdwConversion)
1616  *lpfdwConversion = pIC->fdwConversion;
1617  if (lpfdwSentence)
1618  *lpfdwSentence = pIC->fdwSentence;
1619 
1620  ImmUnlockIMC(hIMC);
1621  return TRUE;
1622 }
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1023
DWORD fdwConversion
Definition: immdev.h:43
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
DWORD fdwSentence
Definition: immdev.h:44
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1032

Referenced by ActiveIMMApp_GetConversionStatus(), ImeWnd_OnImeControl(), ImeWnd_OnImeSystem(), and test_ImmThreads().

◆ ImmGetDefaultIMEWnd()

HWND WINAPI ImmGetDefaultIMEWnd ( HWND  hWnd)

◆ ImmGetDescriptionA()

UINT WINAPI ImmGetDescriptionA ( HKL  hKL,
LPSTR  lpszDescription,
UINT  uBufLen 
)

Definition at line 830 of file ime.c.

831 {
832  IMEINFOEX info;
833  size_t cch;
834 
835  TRACE("(%p,%p,%d)\n", hKL, lpszDescription, uBufLen);
836 
838  return 0;
839 
840  StringCchLengthW(info.wszImeDescription, _countof(info.wszImeDescription), &cch);
841  cch = WideCharToMultiByte(CP_ACP, 0, info.wszImeDescription, (INT)cch,
842  lpszDescription, uBufLen, NULL, NULL);
843  if (uBufLen)
844  lpszDescription[cch] = 0;
845  return (UINT)cch;
846 }
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey)
Definition: ime.c:686
int32_t INT
Definition: typedefs.h:58
static struct _test_info info[]
Definition: SetCursorPos.c:19
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1203
#define TRACE(s)
Definition: solgame.cpp:4
#define _countof(array)
Definition: sndvol32.h:68
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
STRSAFEAPI StringCchLengthW(STRSAFE_LPCWSTR psz, size_t cchMax, size_t *pcchLength)
Definition: strsafe.h:842
IN PCTCH IN DWORD cch
Definition: pager.h:36

Referenced by ActiveIMMApp_GetDescriptionA(), and test_ImmGetDescription().

◆ ImmGetDescriptionW()

UINT WINAPI ImmGetDescriptionW ( HKL  hKL,
LPWSTR  lpszDescription,
UINT  uBufLen 
)

Definition at line 851 of file ime.c.

852 {
853  IMEINFOEX info;
854  size_t cch;
855 
856  TRACE("(%p, %p, %d)\n", hKL, lpszDescription, uBufLen);
857 
859  return 0;
860 
861  if (uBufLen != 0)
862  StringCchCopyW(lpszDescription, uBufLen, info.wszImeDescription);
863 
864  StringCchLengthW(info.wszImeDescription, _countof(info.wszImeDescription), &cch);
865  return (UINT)cch;
866 }
BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey)
Definition: ime.c:686
static struct _test_info info[]
Definition: SetCursorPos.c:19
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1203
#define TRACE(s)
Definition: solgame.cpp:4
#define _countof(array)
Definition: sndvol32.h:68
unsigned int UINT
Definition: ndis.h:50
STRSAFEAPI StringCchLengthW(STRSAFE_LPCWSTR psz, size_t cchMax, size_t *pcchLength)
Definition: strsafe.h:842
IN PCTCH IN DWORD cch
Definition: pager.h:36

Referenced by ActiveIMMApp_GetDescriptionW(), and test_ImmGetDescription().

◆ ImmGetIMEFileNameA()

UINT WINAPI ImmGetIMEFileNameA ( HKL  hKL,
LPSTR  lpszFileName,
UINT  uBufLen 
)

Definition at line 871 of file ime.c.

872 {
873  BOOL bDefUsed;
874  IMEINFOEX info;
875  size_t cch;
876 
877  TRACE("(%p, %p, %u)\n", hKL, lpszFileName, uBufLen);
878 
880  {
881  if (uBufLen > 0)
882  lpszFileName[0] = 0;
883  return 0;
884  }
885 
886  StringCchLengthW(info.wszImeFile, _countof(info.wszImeFile), &cch);
887 
888  cch = WideCharToMultiByte(CP_ACP, 0, info.wszImeFile, (INT)cch,
889  lpszFileName, uBufLen, NULL, &bDefUsed);
890  if (uBufLen == 0)
891  return (UINT)cch;
892 
893  if (cch > uBufLen - 1)
894  cch = uBufLen - 1;
895 
896  lpszFileName[cch] = 0;
897  return (UINT)cch;
898 }
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey)
Definition: ime.c:686
int32_t INT
Definition: typedefs.h:58
unsigned int BOOL
Definition: ntddk_ex.h:94
static struct _test_info info[]
Definition: SetCursorPos.c:19
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1203
#define TRACE(s)
Definition: solgame.cpp:4
#define _countof(array)
Definition: sndvol32.h:68
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
STRSAFEAPI StringCchLengthW(STRSAFE_LPCWSTR psz, size_t cchMax, size_t *pcchLength)
Definition: strsafe.h:842
IN PCTCH IN DWORD cch
Definition: pager.h:36

Referenced by ActiveIMMApp_GetIMEFileNameA().

◆ ImmGetIMEFileNameW()

UINT WINAPI ImmGetIMEFileNameW ( HKL  hKL,
LPWSTR  lpszFileName,
UINT  uBufLen 
)

Definition at line 903 of file ime.c.

904 {
905  IMEINFOEX info;
906  size_t cch;
907 
908  TRACE("(%p, %p, %u)\n", hKL, lpszFileName, uBufLen);
909 
911  {
912  if (uBufLen > 0)
913  lpszFileName[0] = 0;
914  return 0;
915  }
916 
917  StringCchLengthW(info.wszImeFile, _countof(info.wszImeFile), &cch);
918  if (uBufLen == 0)
919  return (UINT)cch;
920 
921  StringCchCopyNW(lpszFileName, uBufLen, info.wszImeFile, cch);
922 
923  if (cch > uBufLen - 1)
924  cch = uBufLen - 1;
925 
926  lpszFileName[cch] = 0;
927  return (UINT)cch;
928 }
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236
BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey)
Definition: ime.c:686
static struct _test_info info[]
Definition: SetCursorPos.c:19
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1203
#define TRACE(s)
Definition: solgame.cpp:4
#define _countof(array)
Definition: sndvol32.h:68
unsigned int UINT
Definition: ndis.h:50
STRSAFEAPI StringCchLengthW(STRSAFE_LPCWSTR psz, size_t cchMax, size_t *pcchLength)
Definition: strsafe.h:842
IN PCTCH IN DWORD cch
Definition: pager.h:36

Referenced by ActiveIMMApp_GetIMEFileNameW().

◆ ImmGetImeInfoEx()

BOOL WINAPI ImmGetImeInfoEx ( PIMEINFOEX  pImeInfoEx,
IMEINFOEXCLASS  SearchType,
PVOID  pvSearchKey 
)

Definition at line 686 of file ime.c.

687 {
688  HKL hKL;
689  if (SearchType == ImeInfoExKeyboardLayout || SearchType == ImeInfoExKeyboardLayoutTFS)
690  {
691  hKL = *(HKL*)pvSearchKey;
692  pImeInfoEx->hkl = hKL;
693 
694  if (SearchType == ImeInfoExKeyboardLayoutTFS)
695  {
696  if (!IS_IME_HKL(hKL))
697  {
700  {
701  return FALSE;
702  }
703  }
704 
705  SearchType = ImeInfoExKeyboardLayout;
706  }
707  else
708  {
709  if (!IS_IME_HKL(hKL))
710  return FALSE;
711  }
712  }
713  else if (SearchType == ImeInfoExImeFileName)
714  {
715  StringCchCopyW(pImeInfoEx->wszImeFile, _countof(pImeInfoEx->wszImeFile),
716  pvSearchKey);
717  }
718  else
719  {
720  return FALSE;
721  }
722 
723  return NtUserGetImeInfoEx(pImeInfoEx, SearchType);
724 }
BOOL WINAPI CtfImmIsTextFrameServiceDisabled(VOID)
Definition: ctf.c:59
#define FALSE
Definition: types.h:117
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1203
BOOL NTAPI NtUserGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType)
Definition: ime.c:1007
#define _countof(array)
Definition: sndvol32.h:68
UINT_PTR HKL
Definition: msctf.idl:101
WCHAR wszImeFile[80]
Definition: ntuser.h:1187
#define Imm32Is16BitMode()
Definition: precomp.h:119
#define Imm32IsCiceroMode()
Definition: precomp.h:118

Referenced by Ime32LoadImeDpi(), ImmGetDescriptionA(), ImmGetDescriptionW(), ImmGetIMEFileNameA(), ImmGetIMEFileNameW(), ImmGetProperty(), ImmInstallIMEW(), ImmIsIME(), and User32CreateImeUIWindow().

◆ ImmGetImeMenuItemsA()

DWORD WINAPI ImmGetImeMenuItemsA ( HIMC  hIMC,
DWORD  dwFlags,
DWORD  dwType,
LPIMEMENUITEMINFOA  lpImeParentMenu,
LPIMEMENUITEMINFOA  lpImeMenu,
DWORD  dwSize 
)

Definition at line 1795 of file ime.c.

1798 {
1799  TRACE("(%p, 0x%lX, 0x%lX, %p, %p, 0x%lX)\n",
1800  hIMC, dwFlags, dwType, lpImeParentMenu, lpImeMenu, dwSize);
1801  return ImmGetImeMenuItemsAW(hIMC, dwFlags, dwType, lpImeParentMenu, lpImeMenu, dwSize, TRUE);
1802 }
#define TRUE
Definition: types.h:120
#define TRACE(s)
Definition: solgame.cpp:4
DWORD APIENTRY ImmGetImeMenuItemsAW(HIMC hIMC, DWORD dwFlags, DWORD dwType, LPVOID lpImeParentMenu, LPVOID lpImeMenu, DWORD dwSize, BOOL bTargetIsAnsi)
Definition: ime.c:369
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56

Referenced by ActiveIMMApp_GetImeMenuItemsA(), and test_InvalidIMC().

◆ ImmGetImeMenuItemsAW()

DWORD APIENTRY ImmGetImeMenuItemsAW ( HIMC  hIMC,
DWORD  dwFlags,
DWORD  dwType,
LPVOID  lpImeParentMenu,
LPVOID  lpImeMenu,
DWORD  dwSize,
BOOL  bTargetIsAnsi 
)

Definition at line 369 of file ime.c.

371 {
372  DWORD ret = 0, cbTotal, dwProcessId, dwThreadId, iItem;
373  LPINPUTCONTEXT pIC;
374  PIMEDPI pImeDpi = NULL;
375  IMEMENUITEMINFOA ParentA;
376  IMEMENUITEMINFOW ParentW;
377  LPIMEMENUITEMINFOA pItemA;
378  LPIMEMENUITEMINFOW pItemW;
379  LPVOID pNewItems = NULL, pNewParent = NULL;
380  BOOL bImcIsAnsi;
381  HKL hKL;
382 
383  if (!hIMC)
384  return 0;
385 
386  dwProcessId = (DWORD)NtUserQueryInputContext(hIMC, QIC_INPUTPROCESSID);
387  if (dwProcessId == 0)
388  return 0;
389 
390  if (dwProcessId != GetCurrentProcessId())
391  {
392  if (bTargetIsAnsi)
393  return 0;
394  return Imm32GetImeMenuItemWCrossProcess(hIMC, dwFlags, dwType, lpImeParentMenu,
395  lpImeMenu, dwSize);
396  }
397 
398  pIC = ImmLockIMC(hIMC);
399  if (pIC == NULL)
400  return 0;
401 
403  if (dwThreadId == 0)
404  {
405  ImmUnlockIMC(hIMC);
406  return 0;
407  }
408 
410  pImeDpi = ImmLockImeDpi(hKL);
411  if (!pImeDpi)
412  {
413  ImmUnlockIMC(hIMC);
414  return 0;
415  }
416 
417  if (pImeDpi->ImeGetImeMenuItems == NULL)
418  goto Quit;
419 
420  bImcIsAnsi = Imm32IsImcAnsi(hIMC);
421 
422  if (bImcIsAnsi != bTargetIsAnsi)
423  {
424  if (bTargetIsAnsi)
425  {
426  if (lpImeParentMenu)
427  pNewParent = &ParentW;
428 
429  if (lpImeMenu)
430  {
431  cbTotal = ((dwSize / sizeof(IMEMENUITEMINFOA)) * sizeof(IMEMENUITEMINFOW));
432  pNewItems = ImmLocalAlloc(0, cbTotal);
433  if (!pNewItems)
434  goto Quit;
435  }
436  }
437  else
438  {
439  if (lpImeParentMenu)
440  pNewParent = &ParentA;
441 
442  if (lpImeMenu)
443  {
444  cbTotal = ((dwSize / sizeof(IMEMENUITEMINFOW)) * sizeof(IMEMENUITEMINFOA));
445  pNewItems = ImmLocalAlloc(0, cbTotal);
446  if (!pNewItems)
447  goto Quit;
448  }
449  }
450  }
451  else
452  {
453  pNewItems = lpImeMenu;
454  pNewParent = lpImeParentMenu;
455  }
456 
457  ret = pImeDpi->ImeGetImeMenuItems(hIMC, dwFlags, dwType, pNewParent, pNewItems, dwSize);
458  if (!ret || !lpImeMenu)
459  goto Quit;
460 
461  if (bImcIsAnsi != bTargetIsAnsi)
462  {
463  if (bTargetIsAnsi)
464  {
465  if (pNewParent)
466  Imm32ImeMenuWideToAnsi(pNewParent, lpImeParentMenu, CP_ACP);
467 
468  pItemW = pNewItems;
469  pItemA = lpImeMenu;
470  for (iItem = 0; iItem < ret; ++iItem, ++pItemW, ++pItemA)
471  {
472  if (!Imm32ImeMenuWideToAnsi(pItemW, pItemA, CP_ACP))
473  {
474  ret = 0;
475  break;
476  }
477  }
478  }
479  else
480  {
481  if (pNewParent)
482  Imm32ImeMenuAnsiToWide(pNewParent, lpImeParentMenu, pImeDpi->uCodePage, TRUE);
483 
484  pItemA = pNewItems;
485  pItemW = lpImeMenu;
486  for (iItem = 0; iItem < dwSize; ++iItem, ++pItemA, ++pItemW)
487  {
488  if (!Imm32ImeMenuAnsiToWide(pItemA, pItemW, pImeDpi->uCodePage, TRUE))
489  {
490  ret = 0;
491  break;
492  }
493  }
494  }
495  }
496 
497 Quit:
498  if (pNewItems != lpImeMenu)
499  ImmLocalFree(pNewItems);
500  ImmUnlockImeDpi(pImeDpi);
501  ImmUnlockIMC(hIMC);
502  return ret;
503 }
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:758
UINT uCodePage
Definition: ntuser.h:1254
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1023
#define CP_ACP
Definition: compat.h:109
LPVOID APIENTRY ImmLocalAlloc(DWORD dwFlags, DWORD dwBytes)
Definition: utils.c:234
#define DWORD
Definition: nt_native.h:44
INT APIENTRY Imm32ImeMenuAnsiToWide(const IMEMENUITEMINFOA *pItemA, LPIMEMENUITEMINFOW pItemW, UINT uCodePage, BOOL bBitmap)
Definition: utils.c:319
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI Imm32IsImcAnsi(HIMC hIMC)
Definition: utils.c:54
struct tagIMEMENUITEMINFOW IMEMENUITEMINFOW
PIMEDPI WINAPI ImmLockImeDpi(HKL hKL)
Definition: ime.c:729
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ImmLocalFree(lpData)
Definition: precomp.h:89
int ret
DWORD dwThreadId
Definition: fdebug.c:31
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
UINT_PTR HKL
Definition: msctf.idl:101
PKEYBOARD_LAYOUT GetKeyboardLayout()
Definition: utils.c:194
DWORD APIENTRY Imm32GetImeMenuItemWCrossProcess(HIMC hIMC, DWORD dwFlags, DWORD dwType, LPVOID lpImeParentMenu, LPVOID lpImeMenu, DWORD dwSize)
Definition: ime.c:360
#define NULL
Definition: types.h:112
DWORD_PTR NTAPI NtUserQueryInputContext(HIMC hIMC, DWORD dwType)
Definition: ime.c:1773
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1032
INT APIENTRY Imm32ImeMenuWideToAnsi(const IMEMENUITEMINFOW *pItemW, LPIMEMENUITEMINFOA pItemA, UINT uCodePage)
Definition: utils.c:346
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1158
struct tagIMEMENUITEMINFOA IMEMENUITEMINFOA

Referenced by ImmGetImeMenuItemsA(), and ImmGetImeMenuItemsW().

◆ ImmGetImeMenuItemsW()

DWORD WINAPI ImmGetImeMenuItemsW ( HIMC  hIMC,
DWORD  dwFlags,
DWORD  dwType,
LPIMEMENUITEMINFOW  lpImeParentMenu,
LPIMEMENUITEMINFOW  lpImeMenu,
DWORD  dwSize 
)

Definition at line 1808 of file ime.c.

1811 {
1812  TRACE("(%p, 0x%lX, 0x%lX, %p, %p, 0x%lX)\n",
1813  hIMC, dwFlags, dwType, lpImeParentMenu, lpImeMenu, dwSize);
1814  return ImmGetImeMenuItemsAW(hIMC, dwFlags, dwType, lpImeParentMenu, lpImeMenu, dwSize, FALSE);
1815 }
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
DWORD APIENTRY ImmGetImeMenuItemsAW(HIMC hIMC, DWORD dwFlags, DWORD dwType, LPVOID lpImeParentMenu, LPVOID lpImeMenu, DWORD dwSize, BOOL bTargetIsAnsi)
Definition: ime.c:369
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56

Referenced by ActiveIMMApp_GetImeMenuItemsW().

◆ ImmGetOpenStatus()

BOOL WINAPI ImmGetOpenStatus ( HIMC  hIMC)

Definition at line 1144 of file ime.c.

1145 {
1146  BOOL ret;
1147  LPINPUTCONTEXT pIC;
1148 
1149  TRACE("(%p)\n", hIMC);
1150 
1151  if (!hIMC)
1152  return FALSE;
1153 
1154  pIC = ImmLockIMC(hIMC);
1155  if (!pIC)
1156  return FALSE;
1157 
1158  ret = pIC->fOpen;
1159 
1160  ImmUnlockIMC(hIMC);
1161  return ret;
1162 }
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1023
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
int ret
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1032

Referenced by ActiveIMMApp_GetOpenStatus(), ImeWnd_OnImeControl(), Imm32JCloseOpen(), test_ImmThreads(), and test_InvalidIMC().

◆ ImmGetProperty()

DWORD WINAPI ImmGetProperty ( HKL  hKL,
DWORD  fdwIndex 
)

Definition at line 933 of file ime.c.

934 {
935  IMEINFOEX ImeInfoEx;
936  LPIMEINFO pImeInfo;
937  DWORD dwValue;
938  PIMEDPI pImeDpi = NULL;
939 
940  TRACE("(%p, %lu)\n", hKL, fdwIndex);
941 
942  if (!ImmGetImeInfoEx(&ImeInfoEx, ImeInfoExKeyboardLayout, &hKL))
943  return FALSE;
944 
945  if (fdwIndex == IGP_GETIMEVERSION)
946  return ImeInfoEx.dwImeWinVersion;
947 
948  if (ImeInfoEx.fLoadFlag != 2)
949  {
950  pImeDpi = Imm32FindOrLoadImeDpi(hKL);
951  if (pImeDpi == NULL)
952  return FALSE;
953 
954  pImeInfo = &pImeDpi->ImeInfo;
955  }
956  else
957  {
958  pImeInfo = &ImeInfoEx.ImeInfo;
959  }
960 
961  switch (fdwIndex)
962  {
963  case IGP_PROPERTY: dwValue = pImeInfo->fdwProperty; break;
964  case IGP_CONVERSION: dwValue = pImeInfo->fdwConversionCaps; break;
965  case IGP_SENTENCE: dwValue = pImeInfo->fdwSentenceCaps; break;
966  case IGP_UI: dwValue = pImeInfo->fdwUICaps; break;
967  case IGP_SETCOMPSTR: dwValue = pImeInfo->fdwSCSCaps; break;
968  case IGP_SELECT: dwValue = pImeInfo->fdwSelectCaps; break;
969  default: dwValue = 0; break;
970  }
971 
972  if (pImeDpi)
973  ImmUnlockImeDpi(pImeDpi);
974  return dwValue;
975 }
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:758
IMEINFO ImeInfo
Definition: ntuser.h:1253
BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey)
Definition: ime.c:686
#define IGP_UI
Definition: imm.h:448
#define IGP_SELECT
Definition: imm.h:450
#define FALSE
Definition: types.h:117
DWORD fdwUICaps
Definition: imm.h:161
DWORD fdwSelectCaps
Definition: imm.h:163
#define TRACE(s)
Definition: solgame.cpp:4
DWORD fdwProperty
Definition: imm.h:158
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD fdwConversionCaps
Definition: imm.h:159
#define IGP_SETCOMPSTR
Definition: imm.h:449
DWORD fdwSCSCaps
Definition: imm.h:162
IMEINFO ImeInfo
Definition: ntuser.h:1179
#define IGP_CONVERSION
Definition: imm.h:446
#define IGP_PROPERTY
Definition: imm.h:445
#define NULL
Definition: types.h:112
INT fLoadFlag
Definition: ntuser.h:1183
PIMEDPI APIENTRY Imm32FindOrLoadImeDpi(HKL hKL)
Definition: ime.c:285
DWORD fdwSentenceCaps
Definition: imm.h:160
DWORD dwImeWinVersion
Definition: ntuser.h:1185
#define IGP_SENTENCE
Definition: imm.h:447
#define IGP_GETIMEVERSION
Definition: imm.h:444

Referenced by ActiveIMMApp_GetProperty(), and test_ImmGetCompositionString().

◆ ImmGetStatusWindowPos()

BOOL WINAPI ImmGetStatusWindowPos ( HIMC  hIMC,
LPPOINT  lpptPos 
)

Definition at line 1206 of file ime.c.

1207 {
1208  LPINPUTCONTEXT pIC;
1209  BOOL ret;
1210 
1211  TRACE("(%p, %p)\n", hIMC, lpptPos);
1212 
1213  pIC = ImmLockIMC(hIMC);
1214  if (pIC == NULL)
1215  return FALSE;
1216 
1217  ret = !!(pIC->fdwInit & INIT_STATUSWNDPOS);
1218  if (ret)
1219  *lpptPos = pIC->ptStatusWndPos;
1220 
1221  ImmUnlockIMC(hIMC);
1222  return ret;
1223 }
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1023
#define INIT_STATUSWNDPOS
Definition: immdev.h:126
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
POINT ptStatusWndPos
Definition: immdev.h:41
#define TRACE(s)
Definition: solgame.cpp:4
int ret
DWORD fdwInit
Definition: immdev.h:57
#define NULL
Definition: types.h:112
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1032

Referenced by ActiveIMMApp_GetStatusWindowPos(), test_ImmThreads(), and test_InvalidIMC().

◆ ImmInstallIMEA()

HKL WINAPI ImmInstallIMEA ( LPCSTR  lpszIMEFileName,
LPCSTR  lpszLayoutText 
)

Definition at line 508 of file ime.c.

509 {
510  HKL hKL = NULL;
511  LPWSTR pszFileNameW = NULL, pszLayoutTextW = NULL;
512 
513  TRACE("(%s, %s)\n", debugstr_a(lpszIMEFileName), debugstr_a(lpszLayoutText));
514 
515  pszFileNameW = Imm32WideFromAnsi(lpszIMEFileName);
516  if (!pszFileNameW)
517  goto Quit;
518 
519  pszLayoutTextW = Imm32WideFromAnsi(lpszLayoutText);
520  if (!pszLayoutTextW)
521  goto Quit;
522 
523  hKL = ImmInstallIMEW(pszFileNameW, pszLayoutTextW);
524 
525 Quit:
526  ImmLocalFree(pszFileNameW);
527  ImmLocalFree(pszLayoutTextW);
528  return hKL;
529 }
#define TRACE(s)
Definition: solgame.cpp:4
HKL WINAPI ImmInstallIMEW(LPCWSTR lpszIMEFileName, LPCWSTR lpszLayoutText)
Definition: ime.c:534
#define debugstr_a
Definition: kernel32.h:31
#define ImmLocalFree(lpData)
Definition: precomp.h:89
UINT_PTR HKL
Definition: msctf.idl:101
#define NULL
Definition: types.h:112
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPWSTR APIENTRY Imm32WideFromAnsi(LPCSTR pszA)
Definition: utils.c:65

Referenced by ActiveIMMApp_InstallIMEA().

◆ ImmInstallIMEW()

HKL WINAPI ImmInstallIMEW ( LPCWSTR  lpszIMEFileName,
LPCWSTR  lpszLayoutText 
)

Definition at line 534 of file ime.c.

535 {
536  WCHAR szImeFileName[MAX_PATH], szImeDestPath[MAX_PATH], szImeKey[20];
537  IMEINFOEX InfoEx;
538  LPWSTR pchFilePart;
539  UINT iLayout, cLayouts;
540  HKL hNewKL;
541  WORD wLangID;
542  PREG_IME pLayouts = NULL;
543 
544  TRACE("(%s, %s)\n", debugstr_w(lpszIMEFileName), debugstr_w(lpszLayoutText));
545 
546  GetFullPathNameW(lpszIMEFileName, _countof(szImeFileName), szImeFileName, &pchFilePart);
547  CharUpperW(szImeFileName);
548  if (!pchFilePart)
549  return NULL;
550 
551  /* Load the IME version info */
552  InfoEx.hkl = hNewKL = NULL;
553  StringCchCopyW(InfoEx.wszImeFile, _countof(InfoEx.wszImeFile), pchFilePart);
554  if (Imm32LoadImeVerInfo(&InfoEx) && InfoEx.hkl)
555  wLangID = LOWORD(InfoEx.hkl);
556  else
557  return NULL;
558 
559  /* Get the IME layouts from registry */
560  cLayouts = Imm32GetImeLayout(NULL, 0);
561  if (cLayouts)
562  {
563  pLayouts = ImmLocalAlloc(0, cLayouts * sizeof(REG_IME));
564  if (!pLayouts || !Imm32GetImeLayout(pLayouts, cLayouts))
565  {
566  ImmLocalFree(pLayouts);
567  return NULL;
568  }
569 
570  for (iLayout = 0; iLayout < cLayouts; ++iLayout)
571  {
572  if (lstrcmpiW(pLayouts[iLayout].szFileName, pchFilePart) == 0)
573  {
574  if (wLangID != LOWORD(pLayouts[iLayout].hKL))
575  goto Quit; /* The language is different */
576 
577  hNewKL = pLayouts[iLayout].hKL; /* Found */
578  break;
579  }
580  }
581  }
582 
583  /* If the IME for the specified filename is valid, then unload it now */
584  if (ImmGetImeInfoEx(&InfoEx, ImeInfoExImeFileName, pchFilePart) &&
585  !UnloadKeyboardLayout(InfoEx.hkl))
586  {
587  hNewKL = NULL;
588  goto Quit;
589  }
590 
591  Imm32GetSystemLibraryPath(szImeDestPath, _countof(szImeDestPath), pchFilePart);
592  CharUpperW(szImeDestPath);
593 
594  /* If the source and the destination pathnames were different, then copy the IME file */
595  if (lstrcmpiW(szImeFileName, szImeDestPath) != 0 &&
596  !Imm32CopyImeFile(szImeFileName, szImeDestPath))
597  {
598  hNewKL = NULL;
599  goto Quit;
600  }
601 
602  if (hNewKL == NULL)
603  hNewKL = Imm32AssignNewLayout(cLayouts, pLayouts, wLangID);
604 
605  if (hNewKL)
606  {
607  /* Write the IME layout to registry */
608  if (Imm32WriteImeLayout(hNewKL, pchFilePart, lpszLayoutText))
609  {
610  /* Load the keyboard layout */
611  Imm32UIntToStr((DWORD)(DWORD_PTR)hNewKL, 16, szImeKey, _countof(szImeKey));
612  hNewKL = LoadKeyboardLayoutW(szImeKey, KLF_REPLACELANG);
613  }
614  else
615  {
616  hNewKL = NULL;
617  }
618  }
619 
620 Quit:
621  ImmLocalFree(pLayouts);
622  return hNewKL;
623 }
HRESULT APIENTRY Imm32UIntToStr(DWORD dwValue, ULONG nBase, LPWSTR pszBuff, USHORT cchBuff)
Definition: utils.c:33
BOOL APIENTRY Imm32LoadImeVerInfo(PIMEINFOEX pImeInfoEx)
Definition: utils.c:642
BOOL APIENTRY Imm32WriteImeLayout(HKL hKL, LPCWSTR pchFilePart, LPCWSTR pszLayout)
Definition: utils.c:811
LPVOID APIENTRY ImmLocalAlloc(DWORD dwFlags, DWORD dwBytes)
Definition: utils.c:234
BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey)
Definition: ime.c:686
UINT APIENTRY Imm32GetImeLayout(PREG_IME pLayouts, UINT cLayouts)
Definition: utils.c:743
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
HKL hKL
Definition: precomp.h:67
LPWSTR WINAPI CharUpperW(_Inout_ LPWSTR)
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
#define debugstr_w
Definition: kernel32.h:32
HKL APIENTRY Imm32AssignNewLayout(UINT cKLs, const REG_IME *pLayouts, WORD wLangID)
Definition: utils.c:697
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI UnloadKeyboardLayout(_In_ HKL)
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL APIENTRY Imm32CopyImeFile(LPWSTR pszOldFile, LPCWSTR pszNewFile)
Definition: utils.c:908
#define ImmLocalFree(lpData)
Definition: precomp.h:89
UINT_PTR HKL
Definition: msctf.idl:101
uint32_t DWORD_PTR
Definition: typedefs.h:65
BOOL Imm32GetSystemLibraryPath(LPWSTR pszPath, DWORD cchPath, LPCWSTR pszFileName)
Definition: utils.c:122
#define KLF_REPLACELANG
Definition: winuser.h:115
WCHAR wszImeFile[80]
Definition: ntuser.h:1187
HKL WINAPI LoadKeyboardLayoutW(_In_ LPCWSTR, _In_ UINT)
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define LOWORD(l)
Definition: pedump.c:82

Referenced by ActiveIMMApp_InstallIMEW(), and ImmInstallIMEA().

◆ ImmIsIME()

BOOL WINAPI ImmIsIME ( HKL  hKL)

Definition at line 628 of file ime.c.

629 {
630  IMEINFOEX info;
631  TRACE("(%p)\n", hKL);
633 }
BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey)
Definition: ime.c:686
static struct _test_info info[]
Definition: SetCursorPos.c:19
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by ActiveIMMApp_IsIME(), and Imm32JCloseOpen().

◆ ImmLoadIME()

BOOL WINAPI ImmLoadIME ( HKL  hKL)

Definition at line 806 of file ime.c.

807 {
808  PIMEDPI pImeDpi;
809 
810  if (!IS_IME_HKL(hKL) && (!Imm32IsCiceroMode() || Imm32Is16BitMode()))
811  return FALSE;
812 
813  pImeDpi = Imm32FindImeDpi(hKL);
814  if (pImeDpi == NULL)
815  pImeDpi = Ime32LoadImeDpi(hKL, FALSE);
816  return (pImeDpi != NULL);
817 }
#define FALSE
Definition: types.h:117
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1203
PIMEDPI APIENTRY Ime32LoadImeDpi(HKL hKL, BOOL bLock)
Definition: ime.c:222
#define NULL
Definition: types.h:112
#define Imm32Is16BitMode()
Definition: precomp.h:119
PIMEDPI APIENTRY Imm32FindImeDpi(HKL hKL)
Definition: ime.c:20
#define Imm32IsCiceroMode()
Definition: precomp.h:118

Referenced by ImeWnd_OnCreate(), and ImmActivateLayout().

◆ ImmLockImeDpi()

PIMEDPI WINAPI ImmLockImeDpi ( HKL  hKL)

Definition at line 729 of file ime.c.

730 {
731  PIMEDPI pImeDpi = NULL;
732 
733  TRACE("(%p)\n", hKL);
734 
736 
737  /* Find by hKL */
738  for (pImeDpi = gpImeDpiList; pImeDpi; pImeDpi = pImeDpi->pNext)
739  {
740  if (pImeDpi->hKL == hKL) /* found */
741  {
742  /* lock if possible */
743  if (pImeDpi->dwFlags & IMEDPI_FLAG_UNKNOWN)
744  pImeDpi = NULL;
745  else
746  ++(pImeDpi->cLockObj);
747  break;
748  }
749  }
750 
752  return pImeDpi;
753 }
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
PIMEDPI gpImeDpiList
Definition: ime.c:17
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
DWORD cLockObj
Definition: ntuser.h:1256
#define TRACE(s)
Definition: solgame.cpp:4
RTL_CRITICAL_SECTION gcsImeDpi
Definition: ime.c:16
struct IMEDPI * pNext
Definition: ntuser.h:1250
DWORD dwFlags
Definition: ntuser.h:1257
#define NULL
Definition: types.h:112
#define IMEDPI_FLAG_UNKNOWN
Definition: ntuser.h:1297
HKL hKL
Definition: ntuser.h:1252

Referenced by Imm32CreateInputContext(), Imm32DestroyInputContext(), Imm32FindOrLoadImeDpi(), Imm32MakeIMENotify(), Imm32ProcessHotKey(), Imm32SelectInputContext(), ImmActivateLayout(), ImmGetImeMenuItemsAW(), ImmNotifyIME(), ImmProcessKey(), ImmSetActiveContext(), ImmSetCompositionStringAW(), ImmTranslateMessage(), and User32CreateImeUIWindow().

◆ ImmNotifyIME()

BOOL WINAPI ImmNotifyIME ( HIMC  hIMC,
DWORD  dwAction,
DWORD  dwIndex,
DWORD  dwValue 
)

Definition at line 652 of file ime.c.

653 {
654  HKL hKL;
655  PIMEDPI pImeDpi;
656  BOOL ret;
657 
658  TRACE("(%p, %lu, %lu, %lu)\n", hIMC, dwAction, dwIndex, dwValue);
659 
660  if (hIMC && Imm32IsCrossThreadAccess(hIMC))
661  return FALSE;
662 
663  hKL = GetKeyboardLayout(0);
664  pImeDpi = ImmLockImeDpi(hKL);
665  if (pImeDpi == NULL)
666  return FALSE;
667 
668  ret = pImeDpi->NotifyIME(hIMC, dwAction, dwIndex, dwValue);
669  ImmUnlockImeDpi(pImeDpi);
670  return ret;
671 }
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:758
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
PIMEDPI WINAPI ImmLockImeDpi(HKL hKL)
Definition: ime.c:729
static BOOL Imm32IsCrossThreadAccess(HIMC hIMC)
Definition: precomp.h:100
int ret
UINT_PTR HKL
Definition: msctf.idl:101
PKEYBOARD_LAYOUT GetKeyboardLayout()
Definition: utils.c:194
#define NULL
Definition: types.h:112

Referenced by ActiveIMMApp_NotifyIME(), Imm32NotifyIMEProc(), ImmSystemHandler(), test_ImmGetCompositionString(), and test_ImmNotifyIME().

◆ ImmSetCompositionFontA()

BOOL WINAPI ImmSetCompositionFontA ( HIMC  hIMC,
LPLOGFONTA  lplf 
)

Definition at line 1380 of file ime.c.

1381 {
1382  LOGFONTW lfW;
1383  PCLIENTIMC pClientImc;
1384  BOOL bWide;
1385  LPINPUTCONTEXTDX pIC;
1386  LCID lcid;
1387  HWND hWnd;
1388  PTEB pTeb;
1389 
1390  TRACE("(%p, %p)\n", hIMC, lplf);
1391 
1392  if (Imm32IsCrossThreadAccess(hIMC))
1393  return FALSE;
1394 
1395  pClientImc = ImmLockClientImc(hIMC);
1396  if (pClientImc == NULL)
1397  return FALSE;
1398 
1399  bWide = (pClientImc->dwFlags & CLIENTIMC_WIDE);
1400  ImmUnlockClientImc(pClientImc);
1401 
1402  if (bWide)
1403  {
1404  LogFontAnsiToWide(lplf, &lfW);
1405  return ImmSetCompositionFontW(hIMC, &lfW);
1406  }
1407 
1408  pIC = (LPINPUTCONTEXTDX)ImmLockIMC(hIMC);
1409  if (pIC == NULL)
1410  return FALSE;
1411 
1412  pTeb = NtCurrentTeb();
1413  if (pTeb->Win32ClientInfo[2] < 0x400)
1414  {
1415  lcid = GetSystemDefaultLCID();
1416  if (PRIMARYLANGID(lcid) == LANG_JAPANESE && !(pIC->dwUIFlags & 2) &&
1417  pIC->cfCompForm.dwStyle != CFS_DEFAULT)
1418  {
1420  }
1421  }
1422 
1423  pIC->lfFont.A = *lplf;
1424  pIC->fdwInit |= INIT_LOGFONT;
1425  hWnd = pIC->hWnd;
1426 
1427  ImmUnlockIMC(hIMC);
1428 
1431  return TRUE;
1432 }
ULONG Win32ClientInfo[31]
Definition: compat.h:706
DWORD dwUIFlags
Definition: immdev.h:109
BOOL APIENTRY Imm32MakeIMENotify(HIMC hIMC, HWND hwnd, DWORD dwAction, DWORD_PTR dwIndex, DWORD_PTR dwValue, DWORD_PTR dwCommand, DWORD_PTR dwData)
Definition: utils.c:247
VOID APIENTRY LogFontAnsiToWide(const LOGFONTA *plfA, LPLOGFONTW plfW)
Definition: utils.c:132
#define TRUE
Definition: types.h:120
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IMC_SETCOMPOSITIONFONT
Definition: imm.h:281
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1023
#define IR_CHANGECONVERT
Definition: immdev.h:147
#define CFS_DEFAULT
Definition: imm.h:470
HWND hWnd
Definition: settings.c:17
#define IMN_SETCOMPOSITIONFONT
Definition: imm.h:530
DWORD LCID
Definition: nls.h:13
#define NI_CONTEXTUPDATED
Definition: imm.h:226
#define CLIENTIMC_WIDE
Definition: ntuser.h:1325
BOOL WINAPI ImmSetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf)
Definition: ime.c:1437
#define LANG_JAPANESE
Definition: nls.h:76
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WM_IME_REPORT
Definition: immdev.h:140
#define INIT_LOGFONT
Definition: immdev.h:129
LCID WINAPI GetSystemDefaultLCID(void)
Definition: lang.c:791
PCLIENTIMC WINAPI ImmLockClientImc(HIMC hImc)
Definition: imm.c:909
#define TRACE(s)
Definition: solgame.cpp:4
struct INPUTCONTEXTDX * LPINPUTCONTEXTDX
static BOOL Imm32IsCrossThreadAccess(HIMC hIMC)
Definition: precomp.h:100
Definition: compat.h:694
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
#define NULL
Definition: types.h:112
DWORD dwFlags
Definition: ntuser.h:1305
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1032
#define PRIMARYLANGID(l)
Definition: nls.h:16
VOID WINAPI ImmUnlockClientImc(PCLIENTIMC pClientImc)
Definition: imm.c:954

Referenced by ActiveIMMApp_SetCompositionFontA(), ImeWnd_OnImeControl(), ImmSetCompositionFontW(), test_ImmThreads(), and test_InvalidIMC().

◆ ImmSetCompositionFontW()

BOOL WINAPI ImmSetCompositionFontW ( HIMC  hIMC,
LPLOGFONTW  lplf 
)

Definition at line 1437 of file ime.c.

1438 {
1439  LOGFONTA lfA;
1440  PCLIENTIMC pClientImc;
1441  BOOL bWide;
1442  HWND hWnd;
1443  LPINPUTCONTEXTDX pIC;
1444  PTEB pTeb;
1445  LCID lcid;
1446 
1447  TRACE("(%p, %p)\n", hIMC, lplf);
1448 
1449  if (Imm32IsCrossThreadAccess(hIMC))
1450  return FALSE;
1451 
1452  pClientImc = ImmLockClientImc(hIMC);
1453  if (pClientImc == NULL)
1454  return FALSE;
1455 
1456  bWide = (pClientImc->dwFlags & CLIENTIMC_WIDE);
1457  ImmUnlockClientImc(pClientImc);
1458 
1459  if (!bWide)
1460  {
1461  LogFontWideToAnsi(lplf, &lfA);
1462  return ImmSetCompositionFontA(hIMC, &lfA);
1463  }
1464 
1465  pIC = (LPINPUTCONTEXTDX)ImmLockIMC(hIMC);
1466  if (pIC == NULL)
1467  return FALSE;
1468 
1469  pTeb = NtCurrentTeb();
1470  if (pTeb->Win32ClientInfo[2] < 0x400)
1471  {
1472  lcid = GetSystemDefaultLCID();
1473  if (PRIMARYLANGID(lcid) == LANG_JAPANESE &&
1474  !(pIC->dwUIFlags & 2) &&
1475  pIC->cfCompForm.dwStyle != CFS_DEFAULT)
1476  {
1478  }
1479  }
1480 
1481  pIC->lfFont.W = *lplf;
1482  pIC->fdwInit |= INIT_LOGFONT;
1483  hWnd = pIC->hWnd;
1484 
1485  ImmUnlockIMC(hIMC);
1486 
1489  return TRUE;
1490 }
ULONG Win32ClientInfo[31]
Definition: compat.h:706
DWORD dwUIFlags
Definition: immdev.h:109
BOOL WINAPI ImmSetCompositionFontA(HIMC hIMC, LPLOGFONTA lplf)
Definition: ime.c:1380
BOOL APIENTRY Imm32MakeIMENotify(HIMC hIMC, HWND hwnd, DWORD dwAction, DWORD_PTR dwIndex, DWORD_PTR dwValue, DWORD_PTR dwCommand, DWORD_PTR dwData)
Definition: utils.c:247
#define TRUE
Definition: types.h:120
#define IMC_SETCOMPOSITIONFONT
Definition: imm.h:281
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1023
#define IR_CHANGECONVERT
Definition: immdev.h:147
#define CFS_DEFAULT
Definition: imm.h:470
HWND hWnd
Definition: settings.c:17
#define IMN_SETCOMPOSITIONFONT
Definition: imm.h:530
DWORD LCID
Definition: nls.h:13
#define NI_CONTEXTUPDATED
Definition: imm.h:226
#define CLIENTIMC_WIDE
Definition: ntuser.h:1325
#define LANG_JAPANESE
Definition: nls.h:76
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WM_IME_REPORT
Definition: immdev.h:140
#define INIT_LOGFONT
Definition: immdev.h:129
LCID WINAPI GetSystemDefaultLCID(void)
Definition: lang.c:791
PCLIENTIMC WINAPI ImmLockClientImc(HIMC hImc)
Definition: imm.c:909
#define TRACE(s)
Definition: solgame.cpp:4
struct INPUTCONTEXTDX * LPINPUTCONTEXTDX
VOID APIENTRY LogFontWideToAnsi(const LOGFONTW *plfW, LPLOGFONTA plfA)
Definition: utils.c:145
static BOOL Imm32IsCrossThreadAccess(HIMC hIMC)
Definition: precomp.h:100
Definition: compat.h:694
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
#define NULL
Definition: types.h:112
DWORD dwFlags
Definition: ntuser.h:1305
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1032
#define PRIMARYLANGID(l)
Definition: nls.h:16
VOID WINAPI ImmUnlockClientImc(PCLIENTIMC pClientImc)
Definition: imm.c:954

Referenced by ActiveIMMApp_SetCompositionFontW(), ImeWnd_OnImeControl(), ImeWnd_OnImeSystem(), and ImmSetCompositionFontA().

◆ ImmSetCompositionWindow()

BOOL WINAPI ImmSetCompositionWindow ( HIMC  hIMC,
LPCOMPOSITIONFORM  lpCompForm 
)

Definition at line 1280 of file ime.c.

1281 {
1282  LPINPUTCONTEXT pIC;
1283  HWND hWnd;
1284 
1285  if (Imm32IsCrossThreadAccess(hIMC))
1286  return FALSE;
1287 
1288  pIC = ImmLockIMC(hIMC);
1289  if (pIC == NULL)
1290  return FALSE;
1291 
1292  pIC->cfCompForm = *lpCompForm;
1293  pIC->fdwInit |= INIT_COMPFORM;
1294 
1295  hWnd = pIC->hWnd;
1296 
1297  ImmUnlockIMC(hIMC);
1298 
1301  return TRUE;
1302 }
BOOL APIENTRY Imm32MakeIMENotify(HIMC hIMC, HWND hwnd, DWORD dwAction, DWORD_PTR dwIndex, DWORD_PTR dwValue, DWORD_PTR dwCommand, DWORD_PTR dwData)
Definition: utils.c:247
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1023
#define IMN_SETCOMPOSITIONWINDOW
Definition: imm.h:531
HWND hWnd
Definition: settings.c:17
#define NI_CONTEXTUPDATED
Definition: imm.h:226
#define FALSE
Definition: types.h:117
static BOOL Imm32IsCrossThreadAccess(HIMC hIMC)
Definition: precomp.h:100
COMPOSITIONFORM cfCompForm
Definition: immdev.h:49
DWORD fdwInit
Definition: immdev.h:57
#define INIT_COMPFORM
Definition: immdev.h:130
#define NULL
Definition: types.h:112
#define IMC_SETCOMPOSITIONWINDOW
Definition: imm.h:283
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1032

Referenced by ActiveIMMApp_SetCompositionWindow(), ImeWnd_OnImeControl(), ImeWnd_OnImeSetContext(), ImeWnd_OnImeSystem(), ImmGetContextThreadFunc(), test_ImmThreads(), and test_InvalidIMC().

◆ ImmSetConversionStatus()

BOOL WINAPI ImmSetConversionStatus ( HIMC  hIMC,
DWORD  fdwConversion,
DWORD  fdwSentence 
)

Definition at line 1627 of file ime.c.

1628 {
1629  HKL hKL;
1630  LPINPUTCONTEXT pIC;
1631  DWORD dwOldConversion, dwOldSentence;
1632  BOOL fOpen = FALSE, fConversionChange = FALSE, fSentenceChange = FALSE, fUseCicero = FALSE;
1633  HWND hWnd;
1634 
1635  TRACE("(%p, 0x%lX, 0x%lX)\n", hIMC, fdwConversion, fdwSentence);
1636 
1637  hKL = GetKeyboardLayout(0);
1638  if (!IS_IME_HKL(hKL) && Imm32IsCiceroMode() && !Imm32Is16BitMode())
1639  fUseCicero = TRUE;
1640 
1641  if (Imm32IsCrossThreadAccess(hIMC))
1642  return FALSE;
1643 
1644  pIC = ImmLockIMC(hIMC);
1645  if (pIC == NULL)
1646  return FALSE;
1647 
1648  if (pIC->fdwConversion != fdwConversion)
1649  {
1650  dwOldConversion = pIC->fdwConversion;
1651  pIC->fdwConversion = fdwConversion;
1652  fConversionChange = TRUE;
1653  }
1654 
1655  if (pIC->fdwSentence != fdwSentence)
1656  {
1657  dwOldSentence = pIC->fdwSentence;
1658  pIC->fdwSentence = fdwSentence;
1659  fSentenceChange = TRUE;
1660  }
1661 
1662  hWnd = pIC->hWnd;
1663  fOpen = pIC->fOpen;
1664  ImmUnlockIMC(hIMC);
1665 
1666  if (fConversionChange || fUseCicero)
1667  {
1668  Imm32MakeIMENotify(hIMC, hWnd, NI_CONTEXTUPDATED, dwOldConversion,
1670  if (fConversionChange)
1671  NtUserNotifyIMEStatus(hWnd, fOpen, fdwConversion);
1672  }
1673 
1674  if (fSentenceChange || fUseCicero)
1675  {
1676  Imm32MakeIMENotify(hIMC, hWnd, NI_CONTEXTUPDATED, dwOldSentence,
1678  }
1679 
1680  return TRUE;
1681 }
BOOL APIENTRY Imm32MakeIMENotify(HIMC hIMC, HWND hwnd, DWORD dwAction, DWORD_PTR dwIndex, DWORD_PTR dwValue, DWORD_PTR dwCommand, DWORD_PTR dwData)
Definition: utils.c:247
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1023
HWND hWnd
Definition: settings.c:17
DWORD fdwConversion
Definition: immdev.h:43
#define NI_CONTEXTUPDATED
Definition: imm.h:226
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IMN_SETSENTENCEMODE
Definition: imm.h:527
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1203
#define TRACE(s)
Definition: solgame.cpp:4
#define IMC_SETCONVERSIONMODE
Definition: imm.h:221
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL Imm32IsCrossThreadAccess(HIMC hIMC)
Definition: precomp.h:100
DWORD NTAPI NtUserNotifyIMEStatus(HWND hwnd, BOOL fOpen, DWORD dwConversion)
Definition: ime.c:809
UINT_PTR HKL
Definition: msctf.idl:101
#define IMC_SETSENTENCEMODE
Definition: imm.h:222
#define IMN_SETCONVERSIONMODE
Definition: imm.h:526
PKEYBOARD_LAYOUT GetKeyboardLayout()
Definition: utils.c:194
#define NULL
Definition: types.h:112
DWORD fdwSentence
Definition: immdev.h:44
#define Imm32Is16BitMode()
Definition: precomp.h:119
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1032
#define Imm32IsCiceroMode()
Definition: precomp.h:118

Referenced by ActiveIMMApp_SetConversionStatus(), ImeWnd_OnImeControl(), Imm32CShapeToggle(), Imm32CSymbolToggle(), Imm32KEnglish(), Imm32KHanjaConvert(), Imm32KShapeToggle(), test_ImmThreads(), and test_InvalidIMC().

◆ ImmSetOpenStatus()

BOOL WINAPI ImmSetOpenStatus ( HIMC  hIMC,
BOOL  fOpen 
)

Definition at line 1167 of file ime.c.

1168 {
1169  DWORD dwConversion;
1170  LPINPUTCONTEXT pIC;
1171  HWND hWnd;
1172  BOOL bHasChange = FALSE;
1173 
1174  TRACE("(%p, %d)\n", hIMC, fOpen);
1175 
1176  if (Imm32IsCrossThreadAccess(hIMC))
1177  return FALSE;
1178 
1179  pIC = ImmLockIMC(hIMC);
1180  if (pIC == NULL)
1181  return FALSE;
1182 
1183  if (pIC->fOpen != fOpen)
1184  {
1185  pIC->fOpen = fOpen;
1186  hWnd = pIC->hWnd;
1187  dwConversion = pIC->fdwConversion;
1188  bHasChange = TRUE;
1189  }
1190 
1191  ImmUnlockIMC(hIMC);
1192 
1193  if (bHasChange)
1194  {
1197  NtUserNotifyIMEStatus(hWnd, fOpen, dwConversion);
1198  }
1199 
1200  return TRUE;
1201 }
BOOL APIENTRY Imm32MakeIMENotify(HIMC hIMC, HWND hwnd, DWORD dwAction, DWORD_PTR dwIndex, DWORD_PTR dwValue, DWORD_PTR dwCommand, DWORD_PTR dwData)
Definition: utils.c:247
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1023
HWND hWnd
Definition: settings.c:17
DWORD fdwConversion
Definition: immdev.h:43
#define NI_CONTEXTUPDATED
Definition: imm.h:226
#define IMN_SETOPENSTATUS
Definition: imm.h:528
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL Imm32IsCrossThreadAccess(HIMC hIMC)
Definition: precomp.h:100
DWORD NTAPI NtUserNotifyIMEStatus(HWND hwnd, BOOL fOpen, DWORD dwConversion)
Definition: ime.c:809
#define IMC_SETOPENSTATUS
Definition: imm.h:223
#define NULL
Definition: types.h:112
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1032

Referenced by ActiveIMMApp_SetOpenStatus(), ImeWnd_OnImeControl(), ImeWnd_OnImeSystem(), Imm32CShapeToggle(), Imm32CSymbolToggle(), Imm32ImeNonImeToggle(), Imm32JCloseOpen(), Imm32KEnglish(), Imm32KShapeToggle(), ImmGetContextThreadFunc(), Test1(), test_ime_processkey(), test_ImmDefaultHwnd(), test_ImmMessages(), test_ImmThreads(), and test_InvalidIMC().

◆ ImmSetStatusWindowPos()

BOOL WINAPI ImmSetStatusWindowPos ( HIMC  hIMC,
LPPOINT  lpptPos 
)

Definition at line 1228 of file ime.c.

1229 {
1230  LPINPUTCONTEXT pIC;
1231  HWND hWnd;
1232 
1233  TRACE("(%p, {%ld, %ld})\n", hIMC, lpptPos->x, lpptPos->y);
1234 
1235  if (Imm32IsCrossThreadAccess(hIMC))
1236  return FALSE;
1237 
1238  pIC = ImmLockIMC(hIMC);
1239  if (!pIC)
1240  return FALSE;
1241 
1242  hWnd = pIC->hWnd;
1243  pIC->ptStatusWndPos = *lpptPos;
1244  pIC->fdwInit |= INIT_STATUSWNDPOS;
1245 
1246  ImmUnlockIMC(hIMC);
1247 
1250  return TRUE;
1251 }
long y
Definition: polytest.cpp:48
BOOL APIENTRY Imm32MakeIMENotify(HIMC hIMC, HWND hwnd, DWORD dwAction, DWORD_PTR dwIndex, DWORD_PTR dwValue, DWORD_PTR dwCommand, DWORD_PTR dwData)
Definition: utils.c:247
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1023
HWND hWnd
Definition: settings.c:17
#define INIT_STATUSWNDPOS
Definition: immdev.h:126
#define NI_CONTEXTUPDATED
Definition: imm.h:226
#define FALSE
Definition: types.h:117
POINT ptStatusWndPos
Definition: immdev.h:41
#define TRACE(s)
Definition: solgame.cpp:4
#define IMC_SETSTATUSWINDOWPOS
Definition: imm.h:285
static BOOL Imm32IsCrossThreadAccess(HIMC hIMC)
Definition: precomp.h:100
DWORD fdwInit
Definition: immdev.h:57
#define IMN_SETSTATUSWINDOWPOS
Definition: imm.h:532
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1032

Referenced by ActiveIMMApp_SetStatusWindowPos(), ImeWnd_OnImeControl(), ImmGetContextThreadFunc(), test_ImmThreads(), and test_InvalidIMC().

◆ ImmUnlockImeDpi()

VOID WINAPI ImmUnlockImeDpi ( PIMEDPI  pImeDpi)

Definition at line 758 of file ime.c.

759 {
760  PIMEDPI *ppEntry;
761 
762  TRACE("(%p)\n", pImeDpi);
763 
764  if (pImeDpi == NULL)
765  return;
766 
768 
769  /* unlock */
770  --(pImeDpi->cLockObj);
771  if (pImeDpi->cLockObj != 0)
772  {
774  return;
775  }
776 
777  if ((pImeDpi->dwFlags & IMEDPI_FLAG_UNKNOWN) == 0)
778  {
779  if ((pImeDpi->dwFlags & IMEDPI_FLAG_LOCKED) == 0 ||
780  (pImeDpi->ImeInfo.fdwProperty & IME_PROP_END_UNLOAD) == 0)
781  {
783  return;
784  }
785  }
786 
787  /* Remove from list */
788  for (ppEntry = &gpImeDpiList; *ppEntry; ppEntry = &((*ppEntry)->pNext))
789  {
790  if (*ppEntry == pImeDpi) /* found */
791  {
792  *ppEntry = pImeDpi->pNext;
793  break;
794  }
795  }
796 
797  Imm32FreeIME(pImeDpi, TRUE);
798  ImmLocalFree(pImeDpi);
799 
801 }
IMEINFO ImeInfo
Definition: ntuser.h:1253
#define TRUE
Definition: types.h:120
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
PIMEDPI gpImeDpiList
Definition: ime.c:17
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
DWORD cLockObj
Definition: ntuser.h:1256
#define TRACE(s)
Definition: solgame.cpp:4
RTL_CRITICAL_SECTION gcsImeDpi
Definition: ime.c:16
DWORD fdwProperty
Definition: imm.h:158
#define ImmLocalFree(lpData)
Definition: precomp.h:89
struct IMEDPI * pNext
Definition: ntuser.h:1250
DWORD dwFlags
Definition: ntuser.h:1257
#define NULL
Definition: types.h:112
VOID APIENTRY Imm32FreeIME(PIMEDPI pImeDpi, BOOL bDestroy)
Definition: ime.c:36
#define IMEDPI_FLAG_UNKNOWN
Definition: ntuser.h:1297
#define IME_PROP_END_UNLOAD
Definition: imm.h:213
#define IMEDPI_FLAG_LOCKED
Definition: ntuser.h:1298

Referenced by Imm32CreateInputContext(), Imm32DestroyInputContext(), Imm32MakeIMENotify(), Imm32ProcessHotKey(), Imm32SelectInputContext(), ImmActivateLayout(), ImmConfigureIMEA(), ImmConfigureIMEW(), ImmEnumRegisterWordA(), ImmEnumRegisterWordW(), ImmEscapeA(), ImmEscapeW(), ImmGetConversionListA(), ImmGetConversionListW(), ImmGetImeMenuItemsAW(), ImmGetProperty(), ImmGetRegisterWordStyleA(), ImmGetRegisterWordStyleW(), ImmNotifyIME(), ImmProcessKey(), ImmRegisterWordA(), ImmRegisterWordW(), ImmSetActiveContext(), ImmSetCompositionStringAW(), ImmTranslateMessage(), ImmUnregisterWordA(), ImmUnregisterWordW(), and User32CreateImeUIWindow().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( imm  )

Variable Documentation

◆ gcsImeDpi

◆ gpImeDpiList

PIMEDPI gpImeDpiList = NULL