ReactOS  0.4.15-dev-3440-g915569a
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 Imm32FreeImeDpi (PIMEDPI pImeDpi, BOOL bDestroy)
 
BOOL APIENTRY Imm32InquireIme (PIMEDPI pImeDpi)
 
BOOL APIENTRY Imm32LoadImeInfo (PIMEINFOEX pImeInfoEx, PIMEDPI pImeDpi)
 
PIMEDPI APIENTRY Ime32LoadImeDpi (HKL hKL, BOOL bLock)
 
PIMEDPI APIENTRY ImmLockOrLoadImeDpi (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 Imm32GetImeMenuItemsAW (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 g_csImeDpi
 
PIMEDPI g_pImeDpiList = 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:487

◆ 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:393

◆ VALID_SCS_CAPS

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

◆ 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:507

◆ VALID_UI_CAPS

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

Function Documentation

◆ Ime32LoadImeDpi()

PIMEDPI APIENTRY Ime32LoadImeDpi ( HKL  hKL,
BOOL  bLock 
)

Definition at line 218 of file ime.c.

219 {
220  IMEINFOEX ImeInfoEx;
221  CHARSETINFO ci;
222  PIMEDPI pImeDpiNew, pImeDpiFound;
223  UINT uCodePage;
224  LCID lcid;
225 
226  if (!ImmGetImeInfoEx(&ImeInfoEx, ImeInfoExKeyboardLayout, &hKL) ||
227  ImeInfoEx.fLoadFlag == 1)
228  {
229  return NULL;
230  }
231 
232  pImeDpiNew = Imm32HeapAlloc(HEAP_ZERO_MEMORY, sizeof(IMEDPI));
233  if (pImeDpiNew == NULL)
234  return NULL;
235 
236  pImeDpiNew->hKL = hKL;
237 
238  lcid = LOWORD(hKL);
240  uCodePage = ci.ciACP;
241  else
242  uCodePage = CP_ACP;
243  pImeDpiNew->uCodePage = uCodePage;
244 
245  if (!Imm32LoadImeInfo(&ImeInfoEx, pImeDpiNew))
246  {
247  Imm32HeapFree(pImeDpiNew);
248  return FALSE;
249  }
250 
252 
253  pImeDpiFound = Imm32FindImeDpi(hKL);
254  if (pImeDpiFound)
255  {
256  if (!bLock)
257  pImeDpiFound->dwFlags &= ~IMEDPI_FLAG_LOCKED;
258 
260 
261  Imm32FreeImeDpi(pImeDpiNew, FALSE);
262  Imm32HeapFree(pImeDpiNew);
263  return pImeDpiFound;
264  }
265  else
266  {
267  if (bLock)
268  {
269  pImeDpiNew->dwFlags |= IMEDPI_FLAG_LOCKED;
270  pImeDpiNew->cLockObj = 1;
271  }
272 
273  pImeDpiNew->pNext = g_pImeDpiList;
274  g_pImeDpiList = pImeDpiNew;
275 
277  return pImeDpiNew;
278  }
279 }
UINT uCodePage
Definition: ntuser.h:1244
BOOL APIENTRY Imm32LoadImeInfo(PIMEINFOEX pImeInfoEx, PIMEDPI pImeDpi)
Definition: ime.c:150
LPVOID APIENTRY Imm32HeapAlloc(DWORD dwFlags, DWORD dwBytes)
Definition: utils.c:193
#define TCI_SRCLOCALE
Definition: wingdi.h:964
RTL_CRITICAL_SECTION g_csImeDpi
Definition: ime.c:17
#define Imm32HeapFree(lpData)
Definition: precomp.h:88
#define CP_ACP
Definition: compat.h:109
BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey)
Definition: ime.c:682
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
DWORD LCID
Definition: nls.h:13
#define FALSE
Definition: types.h:117
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
DWORD cLockObj
Definition: ntuser.h:1246
BOOL WINAPI TranslateCharsetInfo(_Inout_ PDWORD, _Out_ LPCHARSETINFO, _In_ DWORD)
VOID APIENTRY Imm32FreeImeDpi(PIMEDPI pImeDpi, BOOL bDestroy)
Definition: ime.c:35
struct IMEDPI * pNext
Definition: ntuser.h:1240
PIMEDPI g_pImeDpiList
Definition: ime.c:18
DWORD dwFlags
Definition: ntuser.h:1247
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:1174
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
PIMEDPI APIENTRY Imm32FindImeDpi(HKL hKL)
Definition: ime.c:20
uint32_t * LPDWORD
Definition: typedefs.h:59
#define IMEDPI_FLAG_LOCKED
Definition: ntuser.h:1288
#define LOWORD(l)
Definition: pedump.c:82
HKL hKL
Definition: ntuser.h:1242

Referenced by ImmLoadIME(), and ImmLockOrLoadImeDpi().

◆ ImeDpi_Escape()

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

Definition at line 295 of file ime.c.

296 {
297  if (IS_IME_HKL(hKL))
298  return pImeDpi->ImeEscape(hIMC, uSubFunc, lpData);
299 
300  if (Imm32IsCiceroMode() && pImeDpi->CtfImeEscapeEx)
301  return pImeDpi->CtfImeEscapeEx(hIMC, uSubFunc, lpData, hKL);
302 
303  return 0;
304 }
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1193
#define Imm32IsCiceroMode()
Definition: precomp.h:115

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 = g_pImeDpiList; pImeDpi != NULL; pImeDpi = pImeDpi->pNext)
26  {
27  if (pImeDpi->hKL == hKL)
28  break;
29  }
31 
32  return pImeDpi;
33 }
RTL_CRITICAL_SECTION g_csImeDpi
Definition: ime.c:17
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
struct IMEDPI * pNext
Definition: ntuser.h:1240
PIMEDPI g_pImeDpiList
Definition: ime.c:18
#define NULL
Definition: types.h:112
HKL hKL
Definition: ntuser.h:1242

Referenced by Ime32LoadImeDpi(), and ImmLoadIME().

◆ Imm32FreeImeDpi()

VOID APIENTRY Imm32FreeImeDpi ( PIMEDPI  pImeDpi,
BOOL  bDestroy 
)

Definition at line 35 of file ime.c.

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

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

◆ Imm32GetImeMenuItemsAW()

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

Definition at line 362 of file ime.c.

364 {
365  DWORD ret = 0, cbTotal, dwProcessId, dwThreadId, iItem;
366  LPINPUTCONTEXT pIC;
367  PIMEDPI pImeDpi = NULL;
368  IMEMENUITEMINFOA ParentA;
369  IMEMENUITEMINFOW ParentW;
370  LPIMEMENUITEMINFOA pItemA;
371  LPIMEMENUITEMINFOW pItemW;
372  LPVOID pNewItems = NULL, pNewParent = NULL;
373  BOOL bImcIsAnsi;
374  HKL hKL;
375 
376  if (!hIMC)
377  return 0;
378 
379  dwProcessId = NtUserQueryInputContext(hIMC, 0);
380  if (dwProcessId == 0)
381  return 0;
382 
383  if (dwProcessId != GetCurrentProcessId())
384  {
385  if (bTargetIsAnsi)
386  return 0;
387  return Imm32GetImeMenuItemWCrossProcess(hIMC, dwFlags, dwType, lpImeParentMenu,
388  lpImeMenu, dwSize);
389  }
390 
391  pIC = ImmLockIMC(hIMC);
392  if (pIC == NULL)
393  return 0;
394 
396  if (dwThreadId == 0)
397  {
398  ImmUnlockIMC(hIMC);
399  return 0;
400  }
401 
403  pImeDpi = ImmLockImeDpi(hKL);
404  if (!pImeDpi)
405  {
406  ImmUnlockIMC(hIMC);
407  return 0;
408  }
409 
410  if (pImeDpi->ImeGetImeMenuItems == NULL)
411  goto Quit;
412 
413  bImcIsAnsi = Imm32IsImcAnsi(hIMC);
414 
415  if (bImcIsAnsi != bTargetIsAnsi)
416  {
417  if (bTargetIsAnsi)
418  {
419  if (lpImeParentMenu)
420  pNewParent = &ParentW;
421 
422  if (lpImeMenu)
423  {
424  cbTotal = ((dwSize / sizeof(IMEMENUITEMINFOA)) * sizeof(IMEMENUITEMINFOW));
425  pNewItems = Imm32HeapAlloc(0, cbTotal);
426  if (!pNewItems)
427  goto Quit;
428  }
429  }
430  else
431  {
432  if (lpImeParentMenu)
433  pNewParent = &ParentA;
434 
435  if (lpImeMenu)
436  {
437  cbTotal = ((dwSize / sizeof(IMEMENUITEMINFOW)) * sizeof(IMEMENUITEMINFOA));
438  pNewItems = Imm32HeapAlloc(0, cbTotal);
439  if (!pNewItems)
440  goto Quit;
441  }
442  }
443  }
444  else
445  {
446  pNewItems = lpImeMenu;
447  pNewParent = lpImeParentMenu;
448  }
449 
450  ret = pImeDpi->ImeGetImeMenuItems(hIMC, dwFlags, dwType, pNewParent, pNewItems, dwSize);
451  if (!ret || !lpImeMenu)
452  goto Quit;
453 
454  if (bImcIsAnsi != bTargetIsAnsi)
455  {
456  if (bTargetIsAnsi)
457  {
458  if (pNewParent)
459  Imm32ImeMenuWideToAnsi(pNewParent, lpImeParentMenu, CP_ACP);
460 
461  pItemW = pNewItems;
462  pItemA = lpImeMenu;
463  for (iItem = 0; iItem < ret; ++iItem, ++pItemW, ++pItemA)
464  {
465  if (!Imm32ImeMenuWideToAnsi(pItemW, pItemA, CP_ACP))
466  {
467  ret = 0;
468  break;
469  }
470  }
471  }
472  else
473  {
474  if (pNewParent)
475  Imm32ImeMenuAnsiToWide(pNewParent, lpImeParentMenu, pImeDpi->uCodePage, TRUE);
476 
477  pItemA = pNewItems;
478  pItemW = lpImeMenu;
479  for (iItem = 0; iItem < dwSize; ++iItem, ++pItemA, ++pItemW)
480  {
481  if (!Imm32ImeMenuAnsiToWide(pItemA, pItemW, pImeDpi->uCodePage, TRUE))
482  {
483  ret = 0;
484  break;
485  }
486  }
487  }
488  }
489 
490 Quit:
491  if (pNewItems != lpImeMenu)
492  Imm32HeapFree(pNewItems);
493  ImmUnlockImeDpi(pImeDpi);
494  ImmUnlockIMC(hIMC);
495  return ret;
496 }
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:755
UINT uCodePage
Definition: ntuser.h:1244
LPVOID APIENTRY Imm32HeapAlloc(DWORD dwFlags, DWORD dwBytes)
Definition: utils.c:193
#define Imm32HeapFree(lpData)
Definition: precomp.h:88
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1029
#define CP_ACP
Definition: compat.h:109
INT APIENTRY Imm32ImeMenuAnsiToWide(const IMEMENUITEMINFOA *pItemA, LPIMEMENUITEMINFOW pItemW, UINT uCodePage, BOOL bBitmap)
Definition: utils.c:275
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI Imm32IsImcAnsi(HIMC hIMC)
Definition: utils.c:44
struct tagIMEMENUITEMINFOA IMEMENUITEMINFOA
PIMEDPI WINAPI ImmLockImeDpi(HKL hKL)
Definition: ime.c:726
unsigned long DWORD
Definition: ntddk_ex.h:95
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
struct tagIMEMENUITEMINFOW IMEMENUITEMINFOW
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:354
#define NULL
Definition: types.h:112
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1038
INT APIENTRY Imm32ImeMenuWideToAnsi(const IMEMENUITEMINFOW *pItemW, LPIMEMENUITEMINFOA pItemA, UINT uCodePage)
Definition: utils.c:301
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
DWORD NTAPI NtUserQueryInputContext(HIMC hIMC, DWORD dwUnknown2)
Definition: ntstubs.c:652
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1158

Referenced by ImmGetImeMenuItemsA(), and ImmGetImeMenuItemsW().

◆ Imm32GetImeMenuItemWCrossProcess()

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

Definition at line 354 of file ime.c.

356 {
357  FIXME("We have to do something\n");
358  return 0;
359 }
#define FIXME(fmt,...)
Definition: debug.h:111

Referenced by Imm32GetImeMenuItemsAW().

◆ Imm32InquireIme()

BOOL APIENTRY Imm32InquireIme ( PIMEDPI  pImeDpi)

Definition at line 45 of file ime.c.

46 {
47  WCHAR szUIClass[64];
48  WNDCLASSW wcW;
49  DWORD dwSysInfoFlags = 0;
50  LPIMEINFO pImeInfo = &pImeDpi->ImeInfo;
51 
52  if (NtUserGetThreadState(16))
53  dwSysInfoFlags |= IME_SYSINFO_WINLOGON;
54 
55  if (IS_IME_HKL(pImeDpi->hKL))
56  {
57  if (!pImeDpi->ImeInquire(pImeInfo, szUIClass, dwSysInfoFlags))
58  return FALSE;
59  }
60  else if (Imm32IsCiceroMode() && pImeDpi->CtfImeInquireExW)
61  {
62  if (!pImeDpi->CtfImeInquireExW(pImeInfo, szUIClass, dwSysInfoFlags, pImeDpi->hKL))
63  return FALSE;
64  }
65  else
66  {
67  return FALSE;
68  }
69 
70  szUIClass[_countof(szUIClass) - 1] = 0;
71 
72  if (pImeInfo->dwPrivateDataSize == 0)
73  pImeInfo->dwPrivateDataSize = sizeof(DWORD);
74 
75 #define VALID_IME_PROP (IME_PROP_AT_CARET | \
76  IME_PROP_SPECIAL_UI | \
77  IME_PROP_CANDLIST_START_FROM_1 | \
78  IME_PROP_UNICODE | \
79  IME_PROP_COMPLETE_ON_UNSELECT | \
80  IME_PROP_END_UNLOAD | \
81  IME_PROP_KBD_CHAR_FIRST | \
82  IME_PROP_IGNORE_UPKEYS | \
83  IME_PROP_NEED_ALTKEY | \
84  IME_PROP_NO_KEYS_ON_CLOSE | \
85  IME_PROP_ACCEPT_WIDE_VKEY)
86 #define VALID_CMODE_CAPS (IME_CMODE_ALPHANUMERIC | \
87  IME_CMODE_NATIVE | \
88  IME_CMODE_KATAKANA | \
89  IME_CMODE_LANGUAGE | \
90  IME_CMODE_FULLSHAPE | \
91  IME_CMODE_ROMAN | \
92  IME_CMODE_CHARCODE | \
93  IME_CMODE_HANJACONVERT | \
94  IME_CMODE_SOFTKBD | \
95  IME_CMODE_NOCONVERSION | \
96  IME_CMODE_EUDC | \
97  IME_CMODE_SYMBOL | \
98  IME_CMODE_FIXED)
99 #define VALID_SMODE_CAPS (IME_SMODE_NONE | \
100  IME_SMODE_PLAURALCLAUSE | \
101  IME_SMODE_SINGLECONVERT | \
102  IME_SMODE_AUTOMATIC | \
103  IME_SMODE_PHRASEPREDICT | \
104  IME_SMODE_CONVERSATION)
105 #define VALID_UI_CAPS (UI_CAP_2700 | \
106  UI_CAP_ROT90 | \
107  UI_CAP_ROTANY | \
108  UI_CAP_SOFTKBD)
109 #define VALID_SCS_CAPS (SCS_CAP_COMPSTR | \
110  SCS_CAP_MAKEREAD | \
111  SCS_CAP_SETRECONVERTSTRING)
112 #define VALID_SELECT_CAPS (SELECT_CAP_CONVERSION | SELECT_CAP_SENTENCE)
113 
114  if (pImeInfo->fdwProperty & ~VALID_IME_PROP)
115  return FALSE;
116  if (pImeInfo->fdwConversionCaps & ~VALID_CMODE_CAPS)
117  return FALSE;
118  if (pImeInfo->fdwSentenceCaps & ~VALID_SMODE_CAPS)
119  return FALSE;
120  if (pImeInfo->fdwUICaps & ~VALID_UI_CAPS)
121  return FALSE;
122  if (pImeInfo->fdwSCSCaps & ~VALID_SCS_CAPS)
123  return FALSE;
124  if (pImeInfo->fdwSelectCaps & ~VALID_SELECT_CAPS)
125  return FALSE;
126 
127 #undef VALID_IME_PROP
128 #undef VALID_CMODE_CAPS
129 #undef VALID_SMODE_CAPS
130 #undef VALID_UI_CAPS
131 #undef VALID_SCS_CAPS
132 #undef VALID_SELECT_CAPS
133 
134  if (pImeInfo->fdwProperty & IME_PROP_UNICODE)
135  {
136  StringCchCopyW(pImeDpi->szUIClass, _countof(pImeDpi->szUIClass), szUIClass);
137  }
138  else
139  {
140  if (pImeDpi->uCodePage != GetACP() && pImeDpi->uCodePage)
141  return FALSE;
142 
144  pImeDpi->szUIClass, _countof(pImeDpi->szUIClass));
145  }
146 
147  return GetClassInfoW(pImeDpi->hInst, pImeDpi->szUIClass, &wcW);
148 }
UINT uCodePage
Definition: ntuser.h:1244
IMEINFO ImeInfo
Definition: ntuser.h:1243
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:231
#define VALID_SMODE_CAPS
#define VALID_IME_PROP
#define IME_SYSINFO_WINLOGON
Definition: imm.h:241
#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 FALSE
Definition: types.h:117
HINSTANCE hInst
Definition: ntuser.h:1241
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:2183
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1193
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:1245
DWORD dwPrivateDataSize
Definition: imm.h:157
DWORD fdwSCSCaps
Definition: imm.h:162
#define IME_PROP_UNICODE
Definition: imm.h:396
#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:115
#define VALID_SELECT_CAPS
HKL hKL
Definition: ntuser.h:1242

Referenced by Imm32LoadImeInfo().

◆ Imm32LoadImeInfo()

BOOL APIENTRY Imm32LoadImeInfo ( PIMEINFOEX  pImeInfoEx,
PIMEDPI  pImeDpi 
)

Definition at line 150 of file ime.c.

151 {
153  HINSTANCE hIME;
154  FARPROC fn;
155  BOOL ret = FALSE;
156 
158  return FALSE;
159 
160  hIME = GetModuleHandleW(szPath);
161  if (hIME == NULL)
162  {
163  hIME = LoadLibraryW(szPath);
164  if (hIME == NULL)
165  {
166  ERR("Imm32LoadImeInfo: LoadLibraryW(%S) failed\n", szPath);
167  return FALSE;
168  }
169  }
170  pImeDpi->hInst = hIME;
171 
172 #define DEFINE_IME_ENTRY(type, name, params, optional) \
173  do { \
174  fn = GetProcAddress(hIME, #name); \
175  if (fn) pImeDpi->name = (FN_##name)fn; \
176  else if (!(optional)) { \
177  ERR("'%s' not found in the IME module '%s'.\n", #name, debugstr_w(szPath)); \
178  goto Failed; \
179  } \
180  } while (0);
181 #include "imetable.h"
182 #undef DEFINE_IME_ENTRY
183 
184  if (Imm32InquireIme(pImeDpi))
185  {
186  ret = TRUE;
187  }
188  else
189  {
190  ERR("Imm32InquireIme failed\n");
191 Failed:
192  ret = FALSE;
193  FreeLibrary(pImeDpi->hInst);
194  pImeDpi->hInst = NULL;
195  }
196 
197  if (pImeInfoEx->fLoadFlag == 0)
198  {
199  if (ret)
200  {
201  C_ASSERT(sizeof(pImeInfoEx->wszUIClass) == sizeof(pImeDpi->szUIClass));
202  pImeInfoEx->ImeInfo = pImeDpi->ImeInfo;
203  RtlCopyMemory(pImeInfoEx->wszUIClass, pImeDpi->szUIClass,
204  sizeof(pImeInfoEx->wszUIClass));
205  pImeInfoEx->fLoadFlag = 2;
206  }
207  else
208  {
209  pImeInfoEx->fLoadFlag = 1;
210  }
211 
212  NtUserSetImeInfoEx(pImeInfoEx);
213  }
214 
215  return ret;
216 }
IMEINFO ImeInfo
Definition: ntuser.h:1243
DWORD APIENTRY NtUserSetImeInfoEx(PIMEINFOEX pImeInfoEx)
Definition: ime.c:124
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:1241
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:1171
BOOL APIENTRY Imm32InquireIme(PIMEDPI pImeDpi)
Definition: ime.c:45
int ret
WCHAR szUIClass[16]
Definition: ntuser.h:1245
BOOL Imm32GetSystemLibraryPath(LPWSTR pszPath, DWORD cchPath, LPCWSTR pszFileName)
Definition: utils.c:111
#define ERR(fmt,...)
Definition: debug.h:110
WCHAR wszImeFile[80]
Definition: ntuser.h:1178
IMEINFO ImeInfo
Definition: ntuser.h:1170
LPCWSTR szPath
Definition: env.c:37
#define NULL
Definition: types.h:112
INT fLoadFlag
Definition: ntuser.h:1174
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
int(* FARPROC)()
Definition: compat.h:36

Referenced by Ime32LoadImeDpi().

◆ Imm32ReleaseIME()

BOOL APIENTRY Imm32ReleaseIME ( HKL  hKL)

Definition at line 306 of file ime.c.

307 {
308  BOOL ret = TRUE;
309  PIMEDPI pImeDpi0, pImeDpi1;
310 
312 
313  for (pImeDpi0 = g_pImeDpiList; pImeDpi0; pImeDpi0 = pImeDpi0->pNext)
314  {
315  if (pImeDpi0->hKL == hKL)
316  break;
317  }
318 
319  if (!pImeDpi0)
320  goto Quit;
321 
322  if (pImeDpi0->cLockObj)
323  {
324  pImeDpi0->dwFlags |= IMEDPI_FLAG_UNKNOWN;
325  ret = FALSE;
326  goto Quit;
327  }
328 
329  if (g_pImeDpiList == pImeDpi0)
330  {
331  g_pImeDpiList = pImeDpi0->pNext;
332  }
333  else if (g_pImeDpiList)
334  {
335  for (pImeDpi1 = g_pImeDpiList; pImeDpi1; pImeDpi1 = pImeDpi1->pNext)
336  {
337  if (pImeDpi1->pNext == pImeDpi0)
338  {
339  pImeDpi1->pNext = pImeDpi0->pNext;
340  break;
341  }
342  }
343  }
344 
345  Imm32FreeImeDpi(pImeDpi0, TRUE);
346  Imm32HeapFree(pImeDpi0);
347 
348 Quit:
350  return ret;
351 }
RTL_CRITICAL_SECTION g_csImeDpi
Definition: ime.c:17
#define Imm32HeapFree(lpData)
Definition: precomp.h:88
#define TRUE
Definition: types.h:120
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#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:1246
VOID APIENTRY Imm32FreeImeDpi(PIMEDPI pImeDpi, BOOL bDestroy)
Definition: ime.c:35
int ret
struct IMEDPI * pNext
Definition: ntuser.h:1240
PIMEDPI g_pImeDpiList
Definition: ime.c:18
DWORD dwFlags
Definition: ntuser.h:1247
#define IMEDPI_FLAG_UNKNOWN
Definition: ntuser.h:1287
HKL hKL
Definition: ntuser.h:1242

Referenced by ImmFreeLayout().

◆ ImmConfigureIMEA()

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

Definition at line 1683 of file ime.c.

1684 {
1685  BOOL ret = FALSE;
1686  PIMEDPI pImeDpi;
1687  REGISTERWORDW RegWordW;
1688  LPREGISTERWORDA pRegWordA;
1689 
1690  TRACE("(%p, %p, 0x%lX, %p)", hKL, hWnd, dwMode, lpData);
1691 
1693  return FALSE;
1694 
1695  pImeDpi = ImmLockOrLoadImeDpi(hKL);
1696  if (!pImeDpi)
1697  return FALSE;
1698 
1699  RtlZeroMemory(&RegWordW, sizeof(RegWordW));
1700 
1701  if (!ImeDpi_IsUnicode(pImeDpi) || !lpData || dwMode != IME_CONFIG_REGISTERWORD)
1702  goto DoIt;
1703 
1704  pRegWordA = lpData;
1705 
1706  if (pRegWordA->lpReading)
1707  {
1708  RegWordW.lpReading = Imm32WideFromAnsi(pRegWordA->lpReading);
1709  if (!RegWordW.lpReading)
1710  goto Quit;
1711  }
1712 
1713  if (pRegWordA->lpWord)
1714  {
1715  RegWordW.lpWord = Imm32WideFromAnsi(pRegWordA->lpWord);
1716  if (!RegWordW.lpWord)
1717  goto Quit;
1718  }
1719 
1720  lpData = &RegWordW;
1721 
1722 DoIt:
1723  SendMessageW(hWnd, WM_IME_SYSTEM, 0x1B, 0);
1724  ret = pImeDpi->ImeConfigure(hKL, hWnd, dwMode, lpData);
1725  SendMessageW(hWnd, WM_IME_SYSTEM, 0x1A, 0);
1726 
1727 Quit:
1728  Imm32HeapFree(RegWordW.lpReading);
1729  Imm32HeapFree(RegWordW.lpWord);
1730  ImmUnlockImeDpi(pImeDpi);
1731  return ret;
1732 }
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:755
#define Imm32HeapFree(lpData)
Definition: precomp.h:88
HWND hWnd
Definition: settings.c:17
#define FALSE
Definition: types.h:117
LPWSTR lpReading
Definition: dimm.idl:35
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:113
LPSTR lpWord
Definition: imm.h:39
int ret
PWND FASTCALL ValidateHwndNoErr(HWND hwnd)
Definition: utils.c:171
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IME_CONFIG_REGISTERWORD
Definition: imm.h:557
LPWSTR lpWord
Definition: dimm.idl:36
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
PIMEDPI APIENTRY ImmLockOrLoadImeDpi(HKL hKL)
Definition: ime.c:281
static BOOL Imm32IsCrossProcessAccess(HWND hWnd)
Definition: precomp.h:105
LPWSTR APIENTRY Imm32WideFromAnsi(LPCSTR pszA)
Definition: utils.c:55

Referenced by ActiveIMMApp_ConfigureIMEA(), and test_ImmIME().

◆ ImmConfigureIMEW()

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

Definition at line 1737 of file ime.c.

1738 {
1739  BOOL ret = FALSE;
1740  PIMEDPI pImeDpi;
1741  REGISTERWORDA RegWordA;
1742  LPREGISTERWORDW pRegWordW;
1743 
1744  TRACE("(%p, %p, 0x%lX, %p)", hKL, hWnd, dwMode, lpData);
1745 
1747  return FALSE;
1748 
1749  pImeDpi = ImmLockOrLoadImeDpi(hKL);
1750  if (!pImeDpi)
1751  return FALSE;
1752 
1753  RtlZeroMemory(&RegWordA, sizeof(RegWordA));
1754 
1755  if (ImeDpi_IsUnicode(pImeDpi) || !lpData || dwMode != IME_CONFIG_REGISTERWORD)
1756  goto DoIt;
1757 
1758  pRegWordW = lpData;
1759 
1760  if (pRegWordW->lpReading)
1761  {
1762  RegWordA.lpReading = Imm32AnsiFromWide(pRegWordW->lpReading);
1763  if (!RegWordA.lpReading)
1764  goto Quit;
1765  }
1766 
1767  if (pRegWordW->lpWord)
1768  {
1769  RegWordA.lpWord = Imm32AnsiFromWide(pRegWordW->lpWord);
1770  if (!RegWordA.lpWord)
1771  goto Quit;
1772  }
1773 
1774  lpData = &RegWordA;
1775 
1776 DoIt:
1777  SendMessageW(hWnd, WM_IME_SYSTEM, 0x1B, 0);
1778  ret = pImeDpi->ImeConfigure(hKL, hWnd, dwMode, lpData);
1779  SendMessageW(hWnd, WM_IME_SYSTEM, 0x1A, 0);
1780 
1781 Quit:
1782  Imm32HeapFree(RegWordA.lpReading);
1783  Imm32HeapFree(RegWordA.lpWord);
1784  ImmUnlockImeDpi(pImeDpi);
1785  return ret;
1786 }
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:755
#define Imm32HeapFree(lpData)
Definition: precomp.h:88
HWND hWnd
Definition: settings.c:17
LPSTR APIENTRY Imm32AnsiFromWide(LPCWSTR pszW)
Definition: utils.c:66
#define FALSE
Definition: types.h:117
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:113
int ret
PWND FASTCALL ValidateHwndNoErr(HWND hwnd)
Definition: utils.c:171
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IME_CONFIG_REGISTERWORD
Definition: imm.h:557
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
PIMEDPI APIENTRY ImmLockOrLoadImeDpi(HKL hKL)
Definition: ime.c:281
static BOOL Imm32IsCrossProcessAccess(HWND hWnd)
Definition: precomp.h:105

Referenced by ActiveIMMApp_ConfigureIMEW(), and test_ImmIME().

◆ ImmDisableIME()

BOOL WINAPI ImmDisableIME ( DWORD  dwThreadId)

Definition at line 819 of file ime.c.

820 {
822 }
DWORD dwThreadId
Definition: fdebug.c:31
DWORD APIENTRY NtUserDisableThreadIme(DWORD dwUnknown1)
Definition: ime.c:86

Referenced by ActiveIMMApp_DisableIME(), and test_default_ime_disabled_cb().

◆ ImmDisableLegacyIME()

BOOL WINAPI ImmDisableLegacyIME ( void  )

Definition at line 672 of file ime.c.

673 {
674  FIXME("stub\n");
675  return TRUE;
676 }
#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 977 of file ime.c.

978 {
979  LRESULT ret;
980  PIMEDPI pImeDpi;
981  INT cch;
982  CHAR szA[MAX_IMM_FILENAME];
983  WCHAR szW[MAX_IMM_FILENAME];
984 
985  TRACE("(%p, %p, %u, %p)\n", hKL, hIMC, uSubFunc, lpData);
986 
987  pImeDpi = ImmLockOrLoadImeDpi(hKL);
988  if (!pImeDpi)
989  return 0;
990 
991  if (!ImeDpi_IsUnicode(pImeDpi) || !lpData)
992  {
993  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
994  ImmUnlockImeDpi(pImeDpi);
995  return ret;
996  }
997 
998  switch (uSubFunc)
999  {
1001  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
1002 
1003  cch = 0;
1004  if (HIWORD(ret))
1005  szW[cch++] = HIWORD(ret);
1006  if (LOWORD(ret))
1007  szW[cch++] = LOWORD(ret);
1008 
1009  cch = WideCharToMultiByte(pImeDpi->uCodePage, 0, szW, cch, szA, _countof(szA),
1010  NULL, NULL);
1011  switch (cch)
1012  {
1013  case 1:
1014  ret = MAKEWORD(szA[0], 0);
1015  break;
1016  case 2:
1017  ret = MAKEWORD(szA[1], szA[0]);
1018  break;
1019  case 3:
1020  ret = MAKELONG(MAKEWORD(szA[2], szA[1]), MAKEWORD(szA[0], 0));
1021  break;
1022  case 4:
1023  ret = MAKELONG(MAKEWORD(szA[3], szA[2]), MAKEWORD(szA[1], szA[0]));
1024  break;
1025  default:
1026  ret = 0;
1027  break;
1028  }
1029  break;
1030 
1032  case IME_ESC_IME_NAME:
1034  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, szW, hKL);
1035  if (ret)
1036  {
1037  szW[_countof(szW) - 1] = 0;
1038  WideCharToMultiByte(pImeDpi->uCodePage, 0, szW, -1,
1039  lpData, MAX_IMM_FILENAME, NULL, NULL);
1040  ((LPSTR)lpData)[MAX_IMM_FILENAME - 1] = 0;
1041  }
1042  break;
1043 
1045  case IME_ESC_HANJA_MODE:
1047  lpData, -1, szW, _countof(szW));
1048  szW[_countof(szW) - 1] = 0;
1049  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, szW, hKL);
1050  break;
1051 
1052  default:
1053  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
1054  break;
1055  }
1056 
1057  ImmUnlockImeDpi(pImeDpi);
1058  return ret;
1059 }
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:755
UINT uCodePage
Definition: ntuser.h:1244
#define WideCharToMultiByte
Definition: compat.h:111
#define MAKEWORD(a, b)
Definition: typedefs.h:248
char CHAR
Definition: xmlstorage.h:175
#define IME_ESC_GETHELPFILENAME
Definition: imm.h:575
#define MB_PRECOMPOSED
Definition: winnls.h:281
char * LPSTR
Definition: xmlstorage.h:182
int32_t INT
Definition: typedefs.h:58
static LRESULT APIENTRY ImeDpi_Escape(PIMEDPI pImeDpi, HIMC hIMC, UINT uSubFunc, LPVOID lpData, HKL hKL)
Definition: ime.c:295
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define IME_ESC_SEQUENCE_TO_INTERNAL
Definition: imm.h:566
#define ImeDpi_IsUnicode(pImeDpi)
Definition: precomp.h:113
#define IME_ESC_GET_EUDC_DICTIONARY
Definition: imm.h:567
#define MAX_IMM_FILENAME
Definition: precomp.h:54
int ret
#define IME_ESC_HANJA_MODE
Definition: imm.h:572
#define NULL
Definition: types.h:112
#define IME_ESC_IME_NAME
Definition: imm.h:570
#define MultiByteToWideChar
Definition: compat.h:110
#define IME_ESC_SET_EUDC_DICTIONARY
Definition: imm.h:568
#define HIWORD(l)
Definition: typedefs.h:247
PIMEDPI APIENTRY ImmLockOrLoadImeDpi(HKL hKL)
Definition: ime.c:281
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 1064 of file ime.c.

1065 {
1066  LRESULT ret;
1067  PIMEDPI pImeDpi;
1068  INT cch;
1069  CHAR szA[MAX_IMM_FILENAME];
1070  WCHAR szW[MAX_IMM_FILENAME];
1071  WORD word;
1072 
1073  TRACE("(%p, %p, %u, %p)\n", hKL, hIMC, uSubFunc, lpData);
1074 
1075  pImeDpi = ImmLockOrLoadImeDpi(hKL);
1076  if (!pImeDpi)
1077  return 0;
1078 
1079  if (ImeDpi_IsUnicode(pImeDpi) || !lpData)
1080  {
1081  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
1082  ImmUnlockImeDpi(pImeDpi);
1083  return ret;
1084  }
1085 
1086  switch (uSubFunc)
1087  {
1089  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
1090 
1091  word = LOWORD(ret);
1092  cch = 0;
1093  if (HIBYTE(word))
1094  szA[cch++] = HIBYTE(word);
1095  if (LOBYTE(word))
1096  szA[cch++] = LOBYTE(word);
1097 
1099  szA, cch, szW, _countof(szW));
1100  switch (cch)
1101  {
1102  case 1: ret = szW[0]; break;
1103  case 2: ret = MAKELONG(szW[1], szW[0]); break;
1104  default: ret = 0; break;
1105  }
1106  break;
1107 
1109  case IME_ESC_IME_NAME:
1111  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, szA, hKL);
1112  if (ret)
1113  {
1114  szA[_countof(szA) - 1] = 0;
1116  szA, -1, lpData, MAX_IMM_FILENAME);
1117  ((LPWSTR)lpData)[MAX_IMM_FILENAME - 1] = 0;
1118  }
1119  break;
1120 
1122  case IME_ESC_HANJA_MODE:
1123  WideCharToMultiByte(pImeDpi->uCodePage, 0,
1124  lpData, -1, szA, _countof(szA), NULL, NULL);
1125  szA[_countof(szA) - 1] = 0;
1126  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, szA, hKL);
1127  break;
1128 
1129  default:
1130  ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
1131  break;
1132  }
1133 
1134  ImmUnlockImeDpi(pImeDpi);
1135  return ret;
1136 }
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:755
UINT uCodePage
Definition: ntuser.h:1244
#define WideCharToMultiByte
Definition: compat.h:111
#define LOBYTE(W)
Definition: jmemdos.c:487
char CHAR
Definition: xmlstorage.h:175
#define IME_ESC_GETHELPFILENAME
Definition: imm.h:575
#define MB_PRECOMPOSED
Definition: winnls.h:281
#define HIBYTE(W)
Definition: jmemdos.c:486
int32_t INT
Definition: typedefs.h:58
static LRESULT APIENTRY ImeDpi_Escape(PIMEDPI pImeDpi, HIMC hIMC, UINT uSubFunc, LPVOID lpData, HKL hKL)
Definition: ime.c:295
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define IME_ESC_SEQUENCE_TO_INTERNAL
Definition: imm.h:566
unsigned short WORD
Definition: ntddk_ex.h:93
#define ImeDpi_IsUnicode(pImeDpi)
Definition: precomp.h:113
#define IME_ESC_GET_EUDC_DICTIONARY
Definition: imm.h:567
#define MAX_IMM_FILENAME
Definition: precomp.h:54
int ret
#define IME_ESC_HANJA_MODE
Definition: imm.h:572
#define NULL
Definition: types.h:112
#define IME_ESC_IME_NAME
Definition: imm.h:570
const WCHAR * word
Definition: lex.c:36
#define MultiByteToWideChar
Definition: compat.h:110
#define IME_ESC_SET_EUDC_DICTIONARY
Definition: imm.h:568
PIMEDPI APIENTRY ImmLockOrLoadImeDpi(HKL hKL)
Definition: ime.c:281
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 1304 of file ime.c.

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

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

◆ ImmGetCompositionFontW()

BOOL WINAPI ImmGetCompositionFontW ( HIMC  hIMC,
LPLOGFONTW  lplf 
)

Definition at line 1340 of file ime.c.

1341 {
1342  PCLIENTIMC pClientImc;
1343  BOOL bWide;
1344  LPINPUTCONTEXT pIC;
1345  BOOL ret = FALSE;
1346 
1347  TRACE("(%p, %p)\n", hIMC, lplf);
1348 
1349  pClientImc = ImmLockClientImc(hIMC);
1350  if (pClientImc == NULL)
1351  return FALSE;
1352 
1353  bWide = (pClientImc->dwFlags & CLIENTIMC_WIDE);
1354  ImmUnlockClientImc(pClientImc);
1355 
1356  pIC = ImmLockIMC(hIMC);
1357  if (pIC == NULL)
1358  return FALSE;
1359 
1360  if (pIC->fdwInit & INIT_LOGFONT)
1361  {
1362  if (bWide)
1363  *lplf = pIC->lfFont.W;
1364  else
1365  LogFontAnsiToWide(&pIC->lfFont.A, lplf);
1366 
1367  ret = TRUE;
1368  }
1369 
1370  ImmUnlockIMC(hIMC);
1371  return ret;
1372 }
LOGFONTA A
Definition: imm.h:35
VOID APIENTRY LogFontAnsiToWide(const LOGFONTA *plfA, LPLOGFONTW plfW)
Definition: utils.c:120
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1029
#define CLIENTIMC_WIDE
Definition: ntuser.h:1314
#define INIT_LOGFONT
Definition: imm.h:118
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
union _tagINPUTCONTEXT::@3482 lfFont
PCLIENTIMC WINAPI ImmLockClientImc(HIMC hImc)
Definition: imm.c:905
#define TRACE(s)
Definition: solgame.cpp:4
int ret
DWORD fdwInit
Definition: imm.h:46
#define NULL
Definition: types.h:112
DWORD dwFlags
Definition: ntuser.h:1295
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1038
LOGFONTW W
Definition: imm.h:36
VOID WINAPI ImmUnlockClientImc(PCLIENTIMC pClientImc)
Definition: imm.c:952

Referenced by ActiveIMMApp_GetCompositionFontW().

◆ ImmGetCompositionWindow()

BOOL WINAPI ImmGetCompositionWindow ( HIMC  hIMC,
LPCOMPOSITIONFORM  lpCompForm 
)

Definition at line 1253 of file ime.c.

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

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

◆ ImmGetConversionListA()

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

Definition at line 1493 of file ime.c.

1495 {
1496  DWORD ret = 0;
1497  UINT cb;
1498  LPWSTR pszSrcW = NULL;
1499  LPCANDIDATELIST pCL = NULL;
1500  PIMEDPI pImeDpi;
1501 
1502  TRACE("(%p, %p, %s, %p, %lu, 0x%lX)\n", hKL, hIMC, debugstr_a(pSrc),
1503  lpDst, dwBufLen, uFlag);
1504 
1505  pImeDpi = ImmLockOrLoadImeDpi(hKL);
1506  if (pImeDpi == NULL)
1507  return 0;
1508 
1509  if (!ImeDpi_IsUnicode(pImeDpi))
1510  {
1511  ret = pImeDpi->ImeConversionList(hIMC, pSrc, lpDst, dwBufLen, uFlag);
1512  ImmUnlockImeDpi(pImeDpi);
1513  return ret;
1514  }
1515 
1516  if (pSrc)
1517  {
1518  pszSrcW = Imm32WideFromAnsi(pSrc);
1519  if (pszSrcW == NULL)
1520  goto Quit;
1521  }
1522 
1523  cb = pImeDpi->ImeConversionList(hIMC, pszSrcW, NULL, 0, uFlag);
1524  if (cb == 0)
1525  goto Quit;
1526 
1527  pCL = Imm32HeapAlloc(0, cb);
1528  if (pCL == NULL)
1529  goto Quit;
1530 
1531  cb = pImeDpi->ImeConversionList(hIMC, pszSrcW, pCL, cb, uFlag);
1532  if (cb == 0)
1533  goto Quit;
1534 
1535  ret = CandidateListWideToAnsi(pCL, lpDst, dwBufLen, CP_ACP);
1536 
1537 Quit:
1538  Imm32HeapFree(pszSrcW);
1539  Imm32HeapFree(pCL);
1540  ImmUnlockImeDpi(pImeDpi);
1541  return ret;
1542 }
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:755
LPVOID APIENTRY Imm32HeapAlloc(DWORD dwFlags, DWORD dwBytes)
Definition: utils.c:193
#define Imm32HeapFree(lpData)
Definition: precomp.h:88
#define CP_ACP
Definition: compat.h:109
_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:13
#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:113
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 ImmLockOrLoadImeDpi(HKL hKL)
Definition: ime.c:281
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPWSTR APIENTRY Imm32WideFromAnsi(LPCSTR pszA)
Definition: utils.c:55

Referenced by ActiveIMMApp_GetConversionListA().

◆ ImmGetConversionListW()

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

Definition at line 1548 of file ime.c.

1550 {
1551  DWORD ret = 0;
1552  INT cb;
1553  PIMEDPI pImeDpi;
1554  LPCANDIDATELIST pCL = NULL;
1555  LPSTR pszSrcA = NULL;
1556 
1557  TRACE("(%p, %p, %s, %p, %lu, 0x%lX)\n", hKL, hIMC, debugstr_w(pSrc),
1558  lpDst, dwBufLen, uFlag);
1559 
1560  pImeDpi = ImmLockOrLoadImeDpi(hKL);
1561  if (!pImeDpi)
1562  return 0;
1563 
1564  if (ImeDpi_IsUnicode(pImeDpi))
1565  {
1566  ret = pImeDpi->ImeConversionList(hIMC, pSrc, lpDst, dwBufLen, uFlag);
1567  ImmUnlockImeDpi(pImeDpi);
1568  return ret;
1569  }
1570 
1571  if (pSrc)
1572  {
1573  pszSrcA = Imm32AnsiFromWide(pSrc);
1574  if (pszSrcA == NULL)
1575  goto Quit;
1576  }
1577 
1578  cb = pImeDpi->ImeConversionList(hIMC, pszSrcA, NULL, 0, uFlag);
1579  if (cb == 0)
1580  goto Quit;
1581 
1582  pCL = Imm32HeapAlloc(0, cb);
1583  if (!pCL)
1584  goto Quit;
1585 
1586  cb = pImeDpi->ImeConversionList(hIMC, pszSrcA, pCL, cb, uFlag);
1587  if (!cb)
1588  goto Quit;
1589 
1590  ret = CandidateListAnsiToWide(pCL, lpDst, dwBufLen, CP_ACP);
1591 
1592 Quit:
1593  Imm32HeapFree(pszSrcA);
1594  Imm32HeapFree(pCL);
1595  ImmUnlockImeDpi(pImeDpi);
1596  return ret;
1597 }
DWORD APIENTRY CandidateListAnsiToWide(const CANDIDATELIST *pAnsiCL, LPCANDIDATELIST pWideCL, DWORD dwBufLen, UINT uCodePage)
Definition: candidate.c:82
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:755
LPVOID APIENTRY Imm32HeapAlloc(DWORD dwFlags, DWORD dwBytes)
Definition: utils.c:193
#define Imm32HeapFree(lpData)
Definition: precomp.h:88
#define CP_ACP
Definition: compat.h:109
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:66
#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:113
int ret
#define NULL
Definition: types.h:112
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
PIMEDPI APIENTRY ImmLockOrLoadImeDpi(HKL hKL)
Definition: ime.c:281

Referenced by ActiveIMMApp_GetConversionListW().

◆ ImmGetConversionStatus()

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

Definition at line 1602 of file ime.c.

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

Referenced by ActiveIMMApp_GetConversionStatus(), and test_ImmThreads().

◆ ImmGetDefaultIMEWnd()

HWND WINAPI ImmGetDefaultIMEWnd ( HWND  hWnd)

Definition at line 633 of file ime.c.

634 {
635  if (!Imm32IsImmMode())
636  return NULL;
637 
638  // FIXME: NtUserGetThreadState and enum ThreadStateRoutines are broken.
639  if (hWnd == NULL)
640  return (HWND)NtUserGetThreadState(3);
641 
643 }
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:231
HWND hWnd
Definition: settings.c:17
DWORD_PTR NTAPI NtUserQueryWindow(HWND hWnd, DWORD Index)
Definition: window.c:3929
#define QUERY_WINDOW_DEFAULT_IME
Definition: ntuser.h:2907
#define Imm32IsImmMode()
Definition: precomp.h:114
#define NULL
Definition: types.h:112

Referenced by ActiveIMMApp_GetDefaultIMEWnd(), DoTest_BUTTON(), DoTest_EDIT(), Imm32UnknownProcess1Proc(), ImmActivateLayout(), ImmSetActiveContext(), RealDefWindowProcA(), RealDefWindowProcW(), test_default_ime_disabled_cb(), test_default_ime_window_cancel_cb(), test_default_ime_window_cb(), test_default_ime_with_message_only_window_cb(), test_ime_wnd_proc(), test_ImmDefaultHwnd(), test_ImmGetDefaultIMEWnd_thread(), and test_ImmMessages().

◆ ImmGetDescriptionA()

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

Definition at line 827 of file ime.c.

828 {
829  IMEINFOEX info;
830  size_t cch;
831 
832  TRACE("(%p,%p,%d)\n", hKL, lpszDescription, uBufLen);
833 
835  return 0;
836 
837  StringCchLengthW(info.wszImeDescription, _countof(info.wszImeDescription), &cch);
838  cch = WideCharToMultiByte(CP_ACP, 0, info.wszImeDescription, (INT)cch,
839  lpszDescription, uBufLen, NULL, NULL);
840  if (uBufLen)
841  lpszDescription[cch] = 0;
842  return (UINT)cch;
843 }
#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:682
int32_t INT
Definition: typedefs.h:58
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1193
#define TRACE(s)
Definition: solgame.cpp:4
#define _countof(array)
Definition: sndvol32.h:68
struct _test_info info[]
Definition: SetCursorPos.c:19
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 848 of file ime.c.

849 {
850  IMEINFOEX info;
851  size_t cch;
852 
853  TRACE("(%p, %p, %d)\n", hKL, lpszDescription, uBufLen);
854 
856  return 0;
857 
858  if (uBufLen != 0)
859  StringCchCopyW(lpszDescription, uBufLen, info.wszImeDescription);
860 
861  StringCchLengthW(info.wszImeDescription, _countof(info.wszImeDescription), &cch);
862  return (UINT)cch;
863 }
BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey)
Definition: ime.c:682
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1193
#define TRACE(s)
Definition: solgame.cpp:4
#define _countof(array)
Definition: sndvol32.h:68
struct _test_info info[]
Definition: SetCursorPos.c:19
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 868 of file ime.c.

869 {
870  BOOL bDefUsed;
871  IMEINFOEX info;
872  size_t cch;
873 
874  TRACE("(%p, %p, %u)\n", hKL, lpszFileName, uBufLen);
875 
877  {
878  if (uBufLen > 0)
879  lpszFileName[0] = 0;
880  return 0;
881  }
882 
883  StringCchLengthW(info.wszImeFile, _countof(info.wszImeFile), &cch);
884 
885  cch = WideCharToMultiByte(CP_ACP, 0, info.wszImeFile, (INT)cch,
886  lpszFileName, uBufLen, NULL, &bDefUsed);
887  if (uBufLen == 0)
888  return (UINT)cch;
889 
890  if (cch > uBufLen - 1)
891  cch = uBufLen - 1;
892 
893  lpszFileName[cch] = 0;
894  return (UINT)cch;
895 }
#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:682
int32_t INT
Definition: typedefs.h:58
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1193
#define TRACE(s)
Definition: solgame.cpp:4
#define _countof(array)
Definition: sndvol32.h:68
struct _test_info info[]
Definition: SetCursorPos.c:19
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 900 of file ime.c.

901 {
902  IMEINFOEX info;
903  size_t cch;
904 
905  TRACE("(%p, %p, %u)\n", hKL, lpszFileName, uBufLen);
906 
908  {
909  if (uBufLen > 0)
910  lpszFileName[0] = 0;
911  return 0;
912  }
913 
914  StringCchLengthW(info.wszImeFile, _countof(info.wszImeFile), &cch);
915  if (uBufLen == 0)
916  return (UINT)cch;
917 
918  StringCchCopyNW(lpszFileName, uBufLen, info.wszImeFile, cch);
919 
920  if (cch > uBufLen - 1)
921  cch = uBufLen - 1;
922 
923  lpszFileName[cch] = 0;
924  return (UINT)cch;
925 }
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:682
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1193
#define TRACE(s)
Definition: solgame.cpp:4
#define _countof(array)
Definition: sndvol32.h:68
struct _test_info info[]
Definition: SetCursorPos.c:19
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 682 of file ime.c.

683 {
684  BOOL bDisabled = FALSE;
685  HKL hKL;
686 
687  /* FIXME: broken */
688  switch (SearchType)
689  {
691  break;
692 
693  case ImeInfoExImeWindow:
694  bDisabled = CtfImmIsTextFrameServiceDisabled();
695  SearchType = ImeInfoExKeyboardLayout;
696  break;
697 
699  StringCchCopyW(pImeInfoEx->wszImeFile, _countof(pImeInfoEx->wszImeFile),
700  pvSearchKey);
701  goto Quit;
702  }
703 
704  hKL = *(HKL*)pvSearchKey;
705  pImeInfoEx->hkl = hKL;
706 
707  if (!IS_IME_HKL(hKL))
708  {
709  if (Imm32IsCiceroMode())
710  {
711  if (Imm32Is16BitMode())
712  return FALSE;
713  if (!bDisabled)
714  goto Quit;
715  }
716  return FALSE;
717  }
718 
719 Quit:
720  return NtUserGetImeInfoEx(pImeInfoEx, SearchType);
721 }
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1193
#define _countof(array)
Definition: sndvol32.h:68
UINT_PTR HKL
Definition: msctf.idl:101
WCHAR wszImeFile[80]
Definition: ntuser.h:1178
BOOL APIENTRY NtUserGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType)
Definition: ime.c:103
BOOL WINAPI CtfImmIsTextFrameServiceDisabled(VOID)
Definition: utils.c:909
#define Imm32Is16BitMode()
Definition: precomp.h:116
#define Imm32IsCiceroMode()
Definition: precomp.h:115

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

◆ ImmGetImeMenuItemsA()

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

Definition at line 1792 of file ime.c.

1795 {
1796  TRACE("(%p, 0x%lX, 0x%lX, %p, %p, 0x%lX)\n",
1797  hIMC, dwFlags, dwType, lpImeParentMenu, lpImeMenu, dwSize);
1798  return Imm32GetImeMenuItemsAW(hIMC, dwFlags, dwType, lpImeParentMenu, lpImeMenu,
1799  dwSize, TRUE);
1800 }
#define TRUE
Definition: types.h:120
DWORD APIENTRY Imm32GetImeMenuItemsAW(HIMC hIMC, DWORD dwFlags, DWORD dwType, LPVOID lpImeParentMenu, LPVOID lpImeMenu, DWORD dwSize, BOOL bTargetIsAnsi)
Definition: ime.c:362
#define TRACE(s)
Definition: solgame.cpp:4
_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().

◆ ImmGetImeMenuItemsW()

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

Definition at line 1806 of file ime.c.

1809 {
1810  TRACE("(%p, 0x%lX, 0x%lX, %p, %p, 0x%lX)\n",
1811  hIMC, dwFlags, dwType, lpImeParentMenu, lpImeMenu, dwSize);
1812  return Imm32GetImeMenuItemsAW(hIMC, dwFlags, dwType, lpImeParentMenu, lpImeMenu,
1813  dwSize, FALSE);
1814 }
#define FALSE
Definition: types.h:117
DWORD APIENTRY Imm32GetImeMenuItemsAW(HIMC hIMC, DWORD dwFlags, DWORD dwType, LPVOID lpImeParentMenu, LPVOID lpImeMenu, DWORD dwSize, BOOL bTargetIsAnsi)
Definition: ime.c:362
#define TRACE(s)
Definition: solgame.cpp:4
_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 1141 of file ime.c.

1142 {
1143  BOOL ret;
1144  LPINPUTCONTEXT pIC;
1145 
1146  TRACE("(%p)\n", hIMC);
1147 
1148  if (!hIMC)
1149  return FALSE;
1150 
1151  pIC = ImmLockIMC(hIMC);
1152  if (!pIC)
1153  return FALSE;
1154 
1155  ret = pIC->fOpen;
1156 
1157  ImmUnlockIMC(hIMC);
1158  return ret;
1159 }
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1029
BOOL fOpen
Definition: imm.h:29
#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:1038

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

◆ ImmGetProperty()

DWORD WINAPI ImmGetProperty ( HKL  hKL,
DWORD  fdwIndex 
)

Definition at line 930 of file ime.c.

931 {
932  IMEINFOEX ImeInfoEx;
933  LPIMEINFO pImeInfo;
934  DWORD dwValue;
935  PIMEDPI pImeDpi = NULL;
936 
937  TRACE("(%p, %lu)\n", hKL, fdwIndex);
938 
939  if (!ImmGetImeInfoEx(&ImeInfoEx, ImeInfoExKeyboardLayout, &hKL))
940  return FALSE;
941 
942  if (fdwIndex == IGP_GETIMEVERSION)
943  return ImeInfoEx.dwImeWinVersion;
944 
945  if (ImeInfoEx.fLoadFlag != 2)
946  {
947  pImeDpi = ImmLockOrLoadImeDpi(hKL);
948  if (pImeDpi == NULL)
949  return FALSE;
950 
951  pImeInfo = &pImeDpi->ImeInfo;
952  }
953  else
954  {
955  pImeInfo = &ImeInfoEx.ImeInfo;
956  }
957 
958  switch (fdwIndex)
959  {
960  case IGP_PROPERTY: dwValue = pImeInfo->fdwProperty; break;
961  case IGP_CONVERSION: dwValue = pImeInfo->fdwConversionCaps; break;
962  case IGP_SENTENCE: dwValue = pImeInfo->fdwSentenceCaps; break;
963  case IGP_UI: dwValue = pImeInfo->fdwUICaps; break;
964  case IGP_SETCOMPSTR: dwValue = pImeInfo->fdwSCSCaps; break;
965  case IGP_SELECT: dwValue = pImeInfo->fdwSelectCaps; break;
966  default: dwValue = 0; break;
967  }
968 
969  if (pImeDpi)
970  ImmUnlockImeDpi(pImeDpi);
971  return dwValue;
972 }
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:755
IMEINFO ImeInfo
Definition: ntuser.h:1243
#define IGP_PROPERTY
Definition: imm.h:448
BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey)
Definition: ime.c:682
#define IGP_SELECT
Definition: imm.h:453
#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
#define IGP_SETCOMPSTR
Definition: imm.h:452
DWORD fdwProperty
Definition: imm.h:158
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD fdwConversionCaps
Definition: imm.h:159
DWORD fdwSCSCaps
Definition: imm.h:162
IMEINFO ImeInfo
Definition: ntuser.h:1170
#define NULL
Definition: types.h:112
INT fLoadFlag
Definition: ntuser.h:1174
#define IGP_GETIMEVERSION
Definition: imm.h:447
DWORD fdwSentenceCaps
Definition: imm.h:160
DWORD dwImeWinVersion
Definition: ntuser.h:1176
PIMEDPI APIENTRY ImmLockOrLoadImeDpi(HKL hKL)
Definition: ime.c:281
#define IGP_SENTENCE
Definition: imm.h:450
#define IGP_CONVERSION
Definition: imm.h:449
#define IGP_UI
Definition: imm.h:451

Referenced by ActiveIMMApp_GetProperty(), and test_ImmGetCompositionString().

◆ ImmGetStatusWindowPos()

BOOL WINAPI ImmGetStatusWindowPos ( HIMC  hIMC,
LPPOINT  lpptPos 
)

Definition at line 1203 of file ime.c.

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

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

◆ ImmInstallIMEA()

HKL WINAPI ImmInstallIMEA ( LPCSTR  lpszIMEFileName,
LPCSTR  lpszLayoutText 
)

Definition at line 501 of file ime.c.

502 {
503  HKL hKL = NULL;
504  LPWSTR pszFileNameW = NULL, pszLayoutTextW = NULL;
505 
506  TRACE("(%s, %s)\n", debugstr_a(lpszIMEFileName), debugstr_a(lpszLayoutText));
507 
508  pszFileNameW = Imm32WideFromAnsi(lpszIMEFileName);
509  if (!pszFileNameW)
510  goto Quit;
511 
512  pszLayoutTextW = Imm32WideFromAnsi(lpszLayoutText);
513  if (!pszLayoutTextW)
514  goto Quit;
515 
516  hKL = ImmInstallIMEW(pszFileNameW, pszLayoutTextW);
517 
518 Quit:
519  Imm32HeapFree(pszFileNameW);
520  Imm32HeapFree(pszLayoutTextW);
521  return hKL;
522 }
#define Imm32HeapFree(lpData)
Definition: precomp.h:88
#define TRACE(s)
Definition: solgame.cpp:4
HKL WINAPI ImmInstallIMEW(LPCWSTR lpszIMEFileName, LPCWSTR lpszLayoutText)
Definition: ime.c:527
#define debugstr_a
Definition: kernel32.h:31
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:55

Referenced by ActiveIMMApp_InstallIMEA().

◆ ImmInstallIMEW()

HKL WINAPI ImmInstallIMEW ( LPCWSTR  lpszIMEFileName,
LPCWSTR  lpszLayoutText 
)

Definition at line 527 of file ime.c.

528 {
529  WCHAR szImeFileName[MAX_PATH], szImeDestPath[MAX_PATH], szImeKey[20];
530  IMEINFOEX InfoEx;
531  LPWSTR pchFilePart;
532  UINT iLayout, cLayouts;
533  HKL hNewKL;
534  WORD wLangID;
535  PREG_IME pLayouts = NULL;
536 
537  TRACE("(%s, %s)\n", debugstr_w(lpszIMEFileName), debugstr_w(lpszLayoutText));
538 
539  GetFullPathNameW(lpszIMEFileName, _countof(szImeFileName), szImeFileName, &pchFilePart);
540  CharUpperW(szImeFileName);
541  if (!pchFilePart)
542  return NULL;
543 
544  /* Load the IME version info */
545  InfoEx.hkl = hNewKL = NULL;
546  StringCchCopyW(InfoEx.wszImeFile, _countof(InfoEx.wszImeFile), pchFilePart);
547  if (Imm32LoadImeVerInfo(&InfoEx) && InfoEx.hkl)
548  wLangID = LOWORD(InfoEx.hkl);
549  else
550  return NULL;
551 
552  /* Get the IME layouts from registry */
553  cLayouts = Imm32GetRegImes(NULL, 0);
554  if (cLayouts)
555  {
556  pLayouts = Imm32HeapAlloc(0, cLayouts * sizeof(REG_IME));
557  if (!pLayouts || !Imm32GetRegImes(pLayouts, cLayouts))
558  {
559  Imm32HeapFree(pLayouts);
560  return NULL;
561  }
562 
563  for (iLayout = 0; iLayout < cLayouts; ++iLayout)
564  {
565  if (lstrcmpiW(pLayouts[iLayout].szFileName, pchFilePart) == 0)
566  {
567  if (wLangID != LOWORD(pLayouts[iLayout].hKL))
568  goto Quit; /* The language is different */
569 
570  hNewKL = pLayouts[iLayout].hKL; /* Found */
571  break;
572  }
573  }
574  }
575 
576  /* If the IME for the specified filename is valid, then unload it now */
577  /* FIXME: ImmGetImeInfoEx is broken */
578  if (ImmGetImeInfoEx(&InfoEx, 3, pchFilePart) &&
579  !UnloadKeyboardLayout(InfoEx.hkl))
580  {
581  hNewKL = NULL;
582  goto Quit;
583  }
584 
585  Imm32GetSystemLibraryPath(szImeDestPath, _countof(szImeDestPath), pchFilePart);
586  CharUpperW(szImeDestPath);
587 
588  /* If the source and the destination pathnames were different, then copy the IME file */
589  if (lstrcmpiW(szImeFileName, szImeDestPath) != 0 &&
590  !Imm32CopyFile(szImeFileName, szImeDestPath))
591  {
592  hNewKL = NULL;
593  goto Quit;
594  }
595 
596  if (hNewKL == NULL)
597  hNewKL = Imm32GetNextHKL(cLayouts, pLayouts, wLangID);
598 
599  if (hNewKL)
600  {
601  /* Write the IME layout to registry */
602  if (Imm32WriteRegIme(hNewKL, pchFilePart, lpszLayoutText))
603  {
604  /* Load the keyboard layout */
605  Imm32UIntToStr((DWORD)(DWORD_PTR)hNewKL, 16, szImeKey, _countof(szImeKey));
606  hNewKL = LoadKeyboardLayoutW(szImeKey, KLF_REPLACELANG);
607  }
608  else
609  {
610  hNewKL = NULL;
611  }
612  }
613 
614 Quit:
615  Imm32HeapFree(pLayouts);
616  return hNewKL;
617 }
HRESULT APIENTRY Imm32UIntToStr(DWORD dwValue, ULONG nBase, LPWSTR pszBuff, USHORT cchBuff)
Definition: utils.c:32
UINT APIENTRY Imm32GetRegImes(PREG_IME pLayouts, UINT cLayouts)
Definition: utils.c:688
LPVOID APIENTRY Imm32HeapAlloc(DWORD dwFlags, DWORD dwBytes)
Definition: utils.c:193
BOOL APIENTRY Imm32LoadImeVerInfo(PIMEINFOEX pImeInfoEx)
Definition: utils.c:589
#define Imm32HeapFree(lpData)
Definition: precomp.h:88
BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey)
Definition: ime.c:682
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1105
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 Imm32GetNextHKL(UINT cKLs, const REG_IME *pLayouts, WORD wLangID)
Definition: utils.c:643
#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
BOOL APIENTRY Imm32WriteRegIme(HKL hKL, LPCWSTR pchFilePart, LPCWSTR pszLayout)
Definition: utils.c:755
#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 Imm32CopyFile(LPWSTR pszOldFile, LPCWSTR pszNewFile)
Definition: utils.c:851
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:111
#define KLF_REPLACELANG
Definition: winuser.h:115
WCHAR wszImeFile[80]
Definition: ntuser.h:1178
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 622 of file ime.c.

623 {
624  IMEINFOEX info;
625  TRACE("(%p)\n", hKL);
626  /* FIXME: ImmGetImeInfoEx is broken */
627  return !!ImmGetImeInfoEx(&info, 1, &hKL);
628 }
BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey)
Definition: ime.c:682
#define TRACE(s)
Definition: solgame.cpp:4
struct _test_info info[]
Definition: SetCursorPos.c:19

Referenced by ActiveIMMApp_IsIME(), and Imm32JCloseOpen().

◆ ImmLoadIME()

BOOL WINAPI ImmLoadIME ( HKL  hKL)

Definition at line 803 of file ime.c.

804 {
805  PIMEDPI pImeDpi;
806 
807  if (!IS_IME_HKL(hKL) && (!Imm32IsCiceroMode() || Imm32Is16BitMode()))
808  return FALSE;
809 
810  pImeDpi = Imm32FindImeDpi(hKL);
811  if (pImeDpi == NULL)
812  pImeDpi = Ime32LoadImeDpi(hKL, FALSE);
813  return (pImeDpi != NULL);
814 }
#define FALSE
Definition: types.h:117
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1193
PIMEDPI APIENTRY Ime32LoadImeDpi(HKL hKL, BOOL bLock)
Definition: ime.c:218
#define NULL
Definition: types.h:112
#define Imm32Is16BitMode()
Definition: precomp.h:116
PIMEDPI APIENTRY Imm32FindImeDpi(HKL hKL)
Definition: ime.c:20
#define Imm32IsCiceroMode()
Definition: precomp.h:115

Referenced by ImmActivateLayout().

◆ ImmLockImeDpi()

PIMEDPI WINAPI ImmLockImeDpi ( HKL  hKL)

Definition at line 726 of file ime.c.

727 {
728  PIMEDPI pImeDpi = NULL;
729 
730  TRACE("(%p)\n", hKL);
731 
733 
734  /* Find by hKL */
735  for (pImeDpi = g_pImeDpiList; pImeDpi; pImeDpi = pImeDpi->pNext)
736  {
737  if (pImeDpi->hKL == hKL) /* found */
738  {
739  /* lock if possible */
740  if (pImeDpi->dwFlags & IMEDPI_FLAG_UNKNOWN)
741  pImeDpi = NULL;
742  else
743  ++(pImeDpi->cLockObj);
744  break;
745  }
746  }
747 
749  return pImeDpi;
750 }
RTL_CRITICAL_SECTION g_csImeDpi
Definition: ime.c:17
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
DWORD cLockObj
Definition: ntuser.h:1246
#define TRACE(s)
Definition: solgame.cpp:4
struct IMEDPI * pNext
Definition: ntuser.h:1240
PIMEDPI g_pImeDpiList
Definition: ime.c:18
DWORD dwFlags
Definition: ntuser.h:1247
#define NULL
Definition: types.h:112
#define IMEDPI_FLAG_UNKNOWN
Definition: ntuser.h:1287
HKL hKL
Definition: ntuser.h:1242

Referenced by Imm32CleanupContext(), Imm32GetImeMenuItemsAW(), Imm32InitContext(), Imm32NotifyAction(), Imm32ProcessHotKey(), Imm32SelectLayout(), Imm32SetCompositionStringAW(), ImmActivateLayout(), ImmLockOrLoadImeDpi(), ImmNotifyIME(), ImmProcessKey(), ImmSetActiveContext(), and ImmTranslateMessage().

◆ ImmLockOrLoadImeDpi()

PIMEDPI APIENTRY ImmLockOrLoadImeDpi ( HKL  hKL)

Definition at line 281 of file ime.c.

282 {
283  PIMEDPI pImeDpi;
284 
285  if (!IS_IME_HKL(hKL) && (!Imm32IsCiceroMode() || Imm32Is16BitMode()))
286  return NULL;
287 
288  pImeDpi = ImmLockImeDpi(hKL);
289  if (pImeDpi == NULL)
290  pImeDpi = Ime32LoadImeDpi(hKL, TRUE);
291  return pImeDpi;
292 }
#define TRUE
Definition: types.h:120
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1193
PIMEDPI WINAPI ImmLockImeDpi(HKL hKL)
Definition: ime.c:726
PIMEDPI APIENTRY Ime32LoadImeDpi(HKL hKL, BOOL bLock)
Definition: ime.c:218
#define NULL
Definition: types.h:112
#define Imm32Is16BitMode()
Definition: precomp.h:116
#define Imm32IsCiceroMode()
Definition: precomp.h:115

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

◆ ImmNotifyIME()

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

Definition at line 648 of file ime.c.

649 {
650  HKL hKL;
651  PIMEDPI pImeDpi;
652  BOOL ret;
653 
654  TRACE("(%p, %lu, %lu, %lu)\n", hIMC, dwAction, dwIndex, dwValue);
655 
656  if (hIMC && Imm32IsCrossThreadAccess(hIMC))
657  return FALSE;
658 
659  hKL = GetKeyboardLayout(0);
660  pImeDpi = ImmLockImeDpi(hKL);
661  if (pImeDpi == NULL)
662  return FALSE;
663 
664  ret = pImeDpi->NotifyIME(hIMC, dwAction, dwIndex, dwValue);
665  ImmUnlockImeDpi(pImeDpi);
666  return ret;
667 }
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:755
#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:726
static BOOL Imm32IsCrossThreadAccess(HIMC hIMC)
Definition: precomp.h:98
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(), Imm32NotifyCompStrProc(), ImmSystemHandler(), test_ImmGetCompositionString(), and test_ImmNotifyIME().

◆ ImmSetCompositionFontA()

BOOL WINAPI ImmSetCompositionFontA ( HIMC  hIMC,
LPLOGFONTA  lplf 
)

Definition at line 1377 of file ime.c.

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

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

◆ ImmSetCompositionFontW()

BOOL WINAPI ImmSetCompositionFontW ( HIMC  hIMC,
LPLOGFONTW  lplf 
)

Definition at line 1434 of file ime.c.

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

Referenced by ActiveIMMApp_SetCompositionFontW(), and ImmSetCompositionFontA().

◆ ImmSetCompositionWindow()

BOOL WINAPI ImmSetCompositionWindow ( HIMC  hIMC,
LPCOMPOSITIONFORM  lpCompForm 
)

Definition at line 1277 of file ime.c.

1278 {
1279  LPINPUTCONTEXT pIC;
1280  HWND hWnd;
1281 
1282  if (Imm32IsCrossThreadAccess(hIMC))
1283  return FALSE;
1284 
1285  pIC = ImmLockIMC(hIMC);
1286  if (pIC == NULL)
1287  return FALSE;
1288 
1289  pIC->cfCompForm = *lpCompForm;
1290  pIC->fdwInit |= INIT_COMPFORM;
1291 
1292  hWnd = pIC->hWnd;
1293 
1294  ImmUnlockIMC(hIMC);
1295 
1298  return TRUE;
1299 }
#define NI_CONTEXTUPDATED
Definition: imm.h:229
#define IMC_SETCOMPOSITIONWINDOW
Definition: imm.h:286
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1029
HWND hWnd
Definition: settings.c:17
#define IMN_SETCOMPOSITIONWINDOW
Definition: imm.h:534
#define FALSE
Definition: types.h:117
BOOL APIENTRY Imm32NotifyAction(HIMC hIMC, HWND hwnd, DWORD dwAction, DWORD_PTR dwIndex, DWORD_PTR dwValue, DWORD_PTR dwCommand, DWORD_PTR dwData)
Definition: utils.c:205
HWND hWnd
Definition: imm.h:28
static BOOL Imm32IsCrossThreadAccess(HIMC hIMC)
Definition: precomp.h:98
COMPOSITIONFORM cfCompForm
Definition: imm.h:38
#define INIT_COMPFORM
Definition: imm.h:119
DWORD fdwInit
Definition: imm.h:46
#define NULL
Definition: types.h:112
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1038

Referenced by ActiveIMMApp_SetCompositionWindow(), ImmGetContextThreadFunc(), test_ImmThreads(), and test_InvalidIMC().

◆ ImmSetConversionStatus()

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

Definition at line 1624 of file ime.c.

1625 {
1626  HKL hKL;
1627  LPINPUTCONTEXT pIC;
1628  DWORD dwOldConversion, dwOldSentence;
1629  BOOL fOpen = FALSE, fConversionChange = FALSE, fSentenceChange = FALSE, fUseCicero = FALSE;
1630  HWND hWnd;
1631 
1632  TRACE("(%p, 0x%lX, 0x%lX)\n", hIMC, fdwConversion, fdwSentence);
1633 
1634  hKL = GetKeyboardLayout(0);
1635  if (!IS_IME_HKL(hKL) && Imm32IsCiceroMode() && !Imm32Is16BitMode())
1636  fUseCicero = TRUE;
1637 
1638  if (Imm32IsCrossThreadAccess(hIMC))
1639  return FALSE;
1640 
1641  pIC = ImmLockIMC(hIMC);
1642  if (pIC == NULL)
1643  return FALSE;
1644 
1645  if (pIC->fdwConversion != fdwConversion)
1646  {
1647  dwOldConversion = pIC->fdwConversion;
1648  pIC->fdwConversion = fdwConversion;
1649  fConversionChange = TRUE;
1650  }
1651 
1652  if (pIC->fdwSentence != fdwSentence)
1653  {
1654  dwOldSentence = pIC->fdwSentence;
1655  pIC->fdwSentence = fdwSentence;
1656  fSentenceChange = TRUE;
1657  }
1658 
1659  hWnd = pIC->hWnd;
1660  fOpen = pIC->fOpen;
1661  ImmUnlockIMC(hIMC);
1662 
1663  if (fConversionChange || fUseCicero)
1664  {
1665  Imm32NotifyAction(hIMC, hWnd, NI_CONTEXTUPDATED, dwOldConversion,
1667  if (fConversionChange)
1668  NtUserNotifyIMEStatus(hWnd, fOpen, fdwConversion);
1669  }
1670 
1671  if (fSentenceChange || fUseCicero)
1672  {
1673  Imm32NotifyAction(hIMC, hWnd, NI_CONTEXTUPDATED, dwOldSentence,
1675  }
1676 
1677  return TRUE;
1678 }
#define IMN_SETCONVERSIONMODE
Definition: imm.h:529
#define NI_CONTEXTUPDATED
Definition: imm.h:229
#define IMC_SETSENTENCEMODE
Definition: imm.h:225
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1029
HWND hWnd
Definition: settings.c:17
DWORD fdwConversion
Definition: imm.h:32
BOOL fOpen
Definition: imm.h:29
#define IMN_SETSENTENCEMODE
Definition: imm.h:530
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IS_IME_HKL(hkl)
Definition: ntuser.h:1193
BOOL APIENTRY Imm32NotifyAction(HIMC hIMC, HWND hwnd, DWORD dwAction, DWORD_PTR dwIndex, DWORD_PTR dwValue, DWORD_PTR dwCommand, DWORD_PTR dwData)
Definition: utils.c:205
DWORD APIENTRY NtUserNotifyIMEStatus(HWND hwnd, BOOL fOpen, DWORD dwConversion)
Definition: ime.c:53
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
HWND hWnd
Definition: imm.h:28
static BOOL Imm32IsCrossThreadAccess(HIMC hIMC)
Definition: precomp.h:98
UINT_PTR HKL
Definition: msctf.idl:101
PKEYBOARD_LAYOUT GetKeyboardLayout()
Definition: utils.c:194
#define NULL
Definition: types.h:112
DWORD fdwSentence
Definition: imm.h:33
#define IMC_SETCONVERSIONMODE
Definition: imm.h:224
#define Imm32Is16BitMode()
Definition: precomp.h:116
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1038
#define Imm32IsCiceroMode()
Definition: precomp.h:115

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

◆ ImmSetOpenStatus()

BOOL WINAPI ImmSetOpenStatus ( HIMC  hIMC,
BOOL  fOpen 
)

Definition at line 1164 of file ime.c.

1165 {
1166  DWORD dwConversion;
1167  LPINPUTCONTEXT pIC;
1168  HWND hWnd;
1169  BOOL bHasChange = FALSE;
1170 
1171  TRACE("(%p, %d)\n", hIMC, fOpen);
1172 
1173  if (Imm32IsCrossThreadAccess(hIMC))
1174  return FALSE;
1175 
1176  pIC = ImmLockIMC(hIMC);
1177  if (pIC == NULL)
1178  return FALSE;
1179 
1180  if (pIC->fOpen != fOpen)
1181  {
1182  pIC->fOpen = fOpen;
1183  hWnd = pIC->hWnd;
1184  dwConversion = pIC->fdwConversion;
1185  bHasChange = TRUE;
1186  }
1187 
1188  ImmUnlockIMC(hIMC);
1189 
1190  if (bHasChange)
1191  {
1194  NtUserNotifyIMEStatus(hWnd, fOpen, dwConversion);
1195  }
1196 
1197  return TRUE;
1198 }
#define NI_CONTEXTUPDATED
Definition: imm.h:229
#define IMN_SETOPENSTATUS
Definition: imm.h:531
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1029
HWND hWnd
Definition: settings.c:17
DWORD fdwConversion
Definition: imm.h:32
BOOL fOpen
Definition: imm.h:29
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL APIENTRY Imm32NotifyAction(HIMC hIMC, HWND hwnd, DWORD dwAction, DWORD_PTR dwIndex, DWORD_PTR dwValue, DWORD_PTR dwCommand, DWORD_PTR dwData)
Definition: utils.c:205
DWORD APIENTRY NtUserNotifyIMEStatus(HWND hwnd, BOOL fOpen, DWORD dwConversion)
Definition: ime.c:53
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
HWND hWnd
Definition: imm.h:28
static BOOL Imm32IsCrossThreadAccess(HIMC hIMC)
Definition: precomp.h:98
#define NULL
Definition: types.h:112
#define IMC_SETOPENSTATUS
Definition: imm.h:226
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1038

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

◆ ImmSetStatusWindowPos()

BOOL WINAPI ImmSetStatusWindowPos ( HIMC  hIMC,
LPPOINT  lpptPos 
)

Definition at line 1225 of file ime.c.

1226 {
1227  LPINPUTCONTEXT pIC;
1228  HWND hWnd;
1229 
1230  TRACE("(%p, {%ld, %ld})\n", hIMC, lpptPos->x, lpptPos->y);
1231 
1232  if (Imm32IsCrossThreadAccess(hIMC))
1233  return FALSE;
1234 
1235  pIC = ImmLockIMC(hIMC);
1236  if (!pIC)
1237  return FALSE;
1238 
1239  hWnd = pIC->hWnd;
1240  pIC->ptStatusWndPos = *lpptPos;
1241  pIC->fdwInit |= INIT_STATUSWNDPOS;
1242 
1243  ImmUnlockIMC(hIMC);
1244 
1247  return TRUE;
1248 }
#define NI_CONTEXTUPDATED
Definition: imm.h:229
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1029
HWND hWnd
Definition: settings.c:17
#define FALSE
Definition: types.h:117
POINT ptStatusWndPos
Definition: imm.h:30
BOOL APIENTRY Imm32NotifyAction(HIMC hIMC, HWND hwnd, DWORD dwAction, DWORD_PTR dwIndex, DWORD_PTR dwValue, DWORD_PTR dwCommand, DWORD_PTR dwData)
Definition: utils.c:205
#define TRACE(s)
Definition: solgame.cpp:4
HWND hWnd
Definition: imm.h:28
static BOOL Imm32IsCrossThreadAccess(HIMC hIMC)
Definition: precomp.h:98
DWORD fdwInit
Definition: imm.h:46
#define IMN_SETSTATUSWINDOWPOS
Definition: imm.h:535
#define INIT_STATUSWNDPOS
Definition: imm.h:115
#define IMC_SETSTATUSWINDOWPOS
Definition: imm.h:288
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1038

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

◆ ImmUnlockImeDpi()

VOID WINAPI ImmUnlockImeDpi ( PIMEDPI  pImeDpi)

Definition at line 755 of file ime.c.

756 {
757  PIMEDPI *ppEntry;
758 
759  TRACE("(%p)\n", pImeDpi);
760 
761  if (pImeDpi == NULL)
762  return;
763 
765 
766  /* unlock */
767  --(pImeDpi->cLockObj);
768  if (pImeDpi->cLockObj != 0)
769  {
771  return;
772  }
773 
774  if ((pImeDpi->dwFlags & IMEDPI_FLAG_UNKNOWN) == 0)
775  {
776  if ((pImeDpi->dwFlags & IMEDPI_FLAG_LOCKED) == 0 ||
777  (pImeDpi->ImeInfo.fdwProperty & IME_PROP_END_UNLOAD) == 0)
778  {
780  return;
781  }
782  }
783 
784  /* Remove from list */
785  for (ppEntry = &g_pImeDpiList; *ppEntry; ppEntry = &((*ppEntry)->pNext))
786  {
787  if (*ppEntry == pImeDpi) /* found */
788  {
789  *ppEntry = pImeDpi->pNext;
790  break;
791  }
792  }
793 
794  Imm32FreeImeDpi(pImeDpi, TRUE);
795  Imm32HeapFree(pImeDpi);
796 
798 }
IMEINFO ImeInfo
Definition: ntuser.h:1243
RTL_CRITICAL_SECTION g_csImeDpi
Definition: ime.c:17
#define Imm32HeapFree(lpData)
Definition: precomp.h:88
#define TRUE
Definition: types.h:120
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
DWORD cLockObj
Definition: ntuser.h:1246
VOID APIENTRY Imm32FreeImeDpi(PIMEDPI pImeDpi, BOOL bDestroy)
Definition: ime.c:35
#define TRACE(s)
Definition: solgame.cpp:4
DWORD fdwProperty
Definition: imm.h:158
struct IMEDPI * pNext
Definition: ntuser.h:1240
PIMEDPI g_pImeDpiList
Definition: ime.c:18
DWORD dwFlags
Definition: ntuser.h:1247
#define IME_PROP_END_UNLOAD
Definition: imm.h:216
#define NULL
Definition: types.h:112
#define IMEDPI_FLAG_UNKNOWN
Definition: ntuser.h:1287
#define IMEDPI_FLAG_LOCKED
Definition: ntuser.h:1288

Referenced by Imm32CleanupContext(), Imm32GetImeMenuItemsAW(), Imm32InitContext(), Imm32NotifyAction(), Imm32ProcessHotKey(), Imm32SelectLayout(), Imm32SetCompositionStringAW(), ImmActivateLayout(), ImmConfigureIMEA(), ImmConfigureIMEW(), ImmEnumRegisterWordA(), ImmEnumRegisterWordW(), ImmEscapeA(), ImmEscapeW(), ImmGetConversionListA(), ImmGetConversionListW(), ImmGetProperty(), ImmGetRegisterWordStyleA(), ImmGetRegisterWordStyleW(), ImmNotifyIME(), ImmProcessKey(), ImmRegisterWordA(), ImmRegisterWordW(), ImmSetActiveContext(), ImmTranslateMessage(), ImmUnregisterWordA(), and ImmUnregisterWordW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( imm  )

Variable Documentation

◆ g_csImeDpi

◆ g_pImeDpiList

PIMEDPI g_pImeDpiList = NULL