ReactOS  0.4.15-dev-5487-ge7bbbf0
imm.c File Reference
#include <user32.h>
#include <strsafe.h>
#include <ddk/immdev.h>
#include "immtable.h"
Include dependency graph for imm.c:

Go to the source code of this file.

Macros

#define IMM_INIT_MAGIC   0x19650412
 
#define MAX_CANDIDATEFORM   4
 
#define DEFINE_IMM_ENTRY(type, name, params, retval, retkind)   static type WINAPI IMMSTUB_##name params { IMM_RETURN_##retkind((type)retval); }
 
#define DEFINE_IMM_ENTRY(type, name, params, retval, retkind)   IMMSTUB_##name,
 
#define DEFINE_IMM_ENTRY(type, name, params, retval, retkind)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (user32)
 
HWND FASTCALL IntGetTopLevelWindow (HWND hWnd)
 
HRESULT User32GetImmFileName (_Out_ LPWSTR lpBuffer, _In_ size_t cchBuffer)
 
static BOOL IntInitializeImmEntryTable (VOID)
 
BOOL WINAPI InitializeImmEntryTable (VOID)
 
BOOL WINAPI User32InitializeImmEntryTable (DWORD magic)
 
static BOOL User32CanSetImeWindowToImc (HIMC hIMC, HWND hImeWnd)
 
static BOOL User32GetImeShowStatus (VOID)
 
static LRESULT User32SendImeUIMessage (PIMEUI pimeui, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
 
static VOID User32NotifyOpenStatus (PIMEUI pimeui, HWND hwndIMC, BOOL bOpen)
 
static VOID User32SetImeWindowOfImc (HIMC hIMC, HWND hImeWnd)
 
static VOID User32UpdateImcOfImeUI (PIMEUI pimeui, HIMC hNewIMC)
 
static LRESULT ImeWnd_OnImeNotify (PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
 
static HWND User32CreateImeUIWindow (PIMEUI pimeui, HKL hKL)
 
static INT ImeWnd_OnCreate (PIMEUI pimeui, LPCREATESTRUCT lpCS)
 
static VOID User32DestroyImeUIWindow (PIMEUI pimeui)
 
static VOID ImeWnd_OnImeSelect (PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
 
static LRESULT ImeWnd_OnImeControl (PIMEUI pimeui, WPARAM wParam, LPARAM lParam, BOOL unicode)
 
static VOID FASTCALL User32SetImeActivenessOfWindow (HWND hWnd, BOOL bActive)
 
VOID FASTCALL CtfLoadThreadLayout (PIMEUI pimeui)
 
static LRESULT FASTCALL User32DoImeHelp (PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
 
static LRESULT ImeWnd_OnImeSystem (PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
 
LRESULT ImeWnd_OnImeSetContext (PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI ImeWndProc_common (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode)
 
LRESULT WINAPI ImeWndProcA (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI ImeWndProcW (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
BOOL WINAPI UpdatePerUserImmEnabling (VOID)
 
BOOL WINAPI RegisterIMEClass (VOID)
 
BOOL WINAPI IMPSetIMEW (HWND hwnd, LPIMEPROW ime)
 
BOOL WINAPI IMPQueryIMEW (LPIMEPROW ime)
 
BOOL WINAPI IMPGetIMEW (HWND hwnd, LPIMEPROW ime)
 
BOOL WINAPI IMPSetIMEA (HWND hwnd, LPIMEPROA ime)
 
BOOL WINAPI IMPQueryIMEA (LPIMEPROA ime)
 
BOOL WINAPI IMPGetIMEA (HWND hwnd, LPIMEPROA ime)
 
LRESULT WINAPI SendIMEMessageExW (HWND hwnd, LPARAM lParam)
 
LRESULT WINAPI SendIMEMessageExA (HWND hwnd, LPARAM lParam)
 
BOOL WINAPI WINNLSEnableIME (HWND hwnd, BOOL enable)
 
BOOL WINAPI WINNLSGetEnableStatus (HWND hwnd)
 
UINT WINAPI WINNLSGetIMEHotkey (HWND hwnd)
 

Variables

HINSTANCE ghImm32 = NULL
 
BOOL gbImmInitializing = FALSE
 
INT gfConIme = -1
 
Imm32ApiTable gImmApiEntries
 

Macro Definition Documentation

◆ DEFINE_IMM_ENTRY [1/3]

#define DEFINE_IMM_ENTRY (   type,
  name,
  params,
  retval,
  retkind 
)    static type WINAPI IMMSTUB_##name params { IMM_RETURN_##retkind((type)retval); }

Definition at line 42 of file imm.c.

◆ DEFINE_IMM_ENTRY [2/3]

#define DEFINE_IMM_ENTRY (   type,
  name,
  params,
  retval,
  retkind 
)    IMMSTUB_##name,

Definition at line 42 of file imm.c.

◆ DEFINE_IMM_ENTRY [3/3]

#define DEFINE_IMM_ENTRY (   type,
  name,
  params,
  retval,
  retkind 
)
Value:
do { \
FN_##name proc = (FN_##name)GetProcAddress(imm32, #name); \
if (!proc) { \
ERR("Could not load %s\n", #name); \
return FALSE; \
} \
IMM_FN(name) = proc; \
} while (0);
static HANDLE proc()
Definition: pdb.c:34
#define FALSE
Definition: types.h:117
Definition: name.c:38
#define GetProcAddress(x, y)
Definition: compat.h:753
GLuint const GLchar * name
Definition: glext.h:6031

Definition at line 42 of file imm.c.

◆ IMM_INIT_MAGIC

#define IMM_INIT_MAGIC   0x19650412

Definition at line 16 of file imm.c.

◆ MAX_CANDIDATEFORM

#define MAX_CANDIDATEFORM   4

Definition at line 17 of file imm.c.

Function Documentation

◆ CtfLoadThreadLayout()

VOID FASTCALL CtfLoadThreadLayout ( PIMEUI  pimeui)

Definition at line 578 of file imm.c.

579 {
580  IMM_FN(CtfImmTIMActivate)(pimeui->hKL);
581  pimeui->hKL = GetWin32ClientInfo()->hKL;
582  IMM_FN(ImmLoadIME)(pimeui->hKL);
583  pimeui->hwndUI = NULL;
584 }
HKL hKL
Definition: ntuser.h:1240
BOOL WINAPI ImmLoadIME(HKL hKL)
Definition: ime.c:1064
#define GetWin32ClientInfo()
Definition: ntuser.h:347
HWND hwndUI
Definition: ntuser.h:1241
#define NULL
Definition: types.h:112
HRESULT WINAPI CtfImmTIMActivate(HKL hKL)
Definition: ctf.c:75
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by ImeWnd_OnImeSystem().

◆ ImeWnd_OnCreate()

static INT ImeWnd_OnCreate ( PIMEUI  pimeui,
LPCREATESTRUCT  lpCS 
)
static

Definition at line 343 of file imm.c.

344 {
345  PWND pParentWnd, pWnd = pimeui->spwnd;
346  HIMC hIMC = NULL;
347 
348  if (!pWnd || (pWnd->style & (WS_DISABLED | WS_POPUP)) != (WS_DISABLED | WS_POPUP))
349  return -1;
350 
351  pParentWnd = ValidateHwnd(lpCS->hwndParent);
352  if (pParentWnd)
353  {
354  hIMC = pParentWnd->hImc;
355  if (hIMC && !User32CanSetImeWindowToImc(hIMC, UserHMGetHandle(pWnd)))
356  hIMC = NULL;
357  }
358 
359  User32UpdateImcOfImeUI(pimeui, hIMC);
360 
361  pimeui->fShowStatus = FALSE;
362  pimeui->nCntInIMEProc = 0;
363  pimeui->fActivate = FALSE;
364  pimeui->fDestroy = FALSE;
365  pimeui->hwndIMC = NULL;
366  pimeui->hKL = GetWin32ClientInfo()->hKL;
367  pimeui->fCtrlShowStatus = TRUE;
368  pimeui->dwLastStatus = 0;
369 
370  return 0;
371 }
#define WS_DISABLED
Definition: pedump.c:621
static BOOL User32CanSetImeWindowToImc(HIMC hIMC, HWND hImeWnd)
Definition: imm.c:155
#define TRUE
Definition: types.h:120
HKL hKL
Definition: ntuser.h:1240
PWND spwnd
Definition: ntuser.h:1237
LONG nCntInIMEProc
Definition: ntuser.h:1242
#define GetWin32ClientInfo()
Definition: ntuser.h:347
HIMC hImc
Definition: ntuser.h:735
#define FALSE
Definition: types.h:117
DWORD dwLastStatus
Definition: ntuser.h:1252
UINT fDestroy
Definition: ntuser.h:1246
DWORD HIMC
Definition: dimm.idl:75
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
static VOID User32UpdateImcOfImeUI(PIMEUI pimeui, HIMC hNewIMC)
Definition: imm.c:224
Definition: ntuser.h:688
#define WS_POPUP
Definition: pedump.c:616
#define NULL
Definition: types.h:112
UINT fShowStatus
Definition: ntuser.h:1244
UINT fCtrlShowStatus
Definition: ntuser.h:1249
HWND hwndIMC
Definition: ntuser.h:1239
UINT fActivate
Definition: ntuser.h:1245
#define ValidateHwnd(hwnd)
Definition: precomp.h:85
DWORD style
Definition: ntuser.h:701

Referenced by ImeWndProc_common().

◆ ImeWnd_OnImeControl()

static LRESULT ImeWnd_OnImeControl ( PIMEUI  pimeui,
WPARAM  wParam,
LPARAM  lParam,
BOOL  unicode 
)
static

Definition at line 427 of file imm.c.

428 {
429  HIMC hIMC = pimeui->hIMC;
430  DWORD dwConversion, dwSentence;
431  POINT pt;
432 
433  if (IS_CICERO_MODE())
434  {
436  {
438  pimeui->dwLastStatus = 0;
439  }
440  else if (wParam == IMC_CLOSESTATUSWINDOW)
441  {
443  }
444  }
445 
446  if (!hIMC)
447  return 0;
448 
449  switch (wParam)
450  {
452  if (!IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion, &dwSentence))
453  return 1;
454  return dwConversion;
455 
456  case IMC_GETSENTENCEMODE:
457  if (!IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion, &dwSentence))
458  return 1;
459  return dwSentence;
460 
461  case IMC_GETOPENSTATUS:
462  return IMM_FN(ImmGetOpenStatus)(hIMC);
463 
465  if (!IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion, &dwSentence) ||
466  !IMM_FN(ImmSetConversionStatus)(hIMC, (DWORD)lParam, dwSentence))
467  {
468  return 1;
469  }
470  break;
471 
472  case IMC_SETSENTENCEMODE:
473  if (!IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion, &dwSentence) ||
474  !IMM_FN(ImmSetConversionStatus)(hIMC, dwConversion, (DWORD)lParam))
475  {
476  return 1;
477  }
478  break;
479 
480  case IMC_SETOPENSTATUS:
481  if (!IMM_FN(ImmSetOpenStatus)(hIMC, (BOOL)lParam))
482  return 1;
483  break;
484 
485  case IMC_GETCANDIDATEPOS:
487  case IMC_GETSOFTKBDPOS:
488  case IMC_SETSOFTKBDPOS:
490  return User32SendImeUIMessage(pimeui, WM_IME_CONTROL, wParam, lParam, unicode);
491 
492  case IMC_SETCANDIDATEPOS:
494  return 1;
495  break;
496 
498  if (unicode)
499  {
501  return 1;
502  }
503  else
504  {
506  return 1;
507  }
508  break;
509 
511  if (unicode)
512  {
514  return 1;
515  }
516  else
517  {
519  return 1;
520  }
521  break;
522 
525  return 1;
526  break;
527 
529  pt.x = GET_X_LPARAM(lParam);
530  pt.y = GET_Y_LPARAM(lParam);
531  if (!IMM_FN(ImmSetStatusWindowPos)(hIMC, &pt))
532  return 1;
533  break;
534 
536  if (pimeui->fShowStatus && User32GetImeShowStatus())
537  {
538  pimeui->fShowStatus = FALSE;
540  }
541  pimeui->fCtrlShowStatus = FALSE;
542  break;
543 
545  if (!pimeui->fShowStatus && User32GetImeShowStatus())
546  {
547  pimeui->fShowStatus = TRUE;
549  }
550  pimeui->fCtrlShowStatus = TRUE;
551  break;
552 
553  default:
554  break;
555  }
556 
557  return 0;
558 }
#define WM_IME_NOTIFY
Definition: winuser.h:1820
#define IMC_GETCOMPOSITIONFONT
Definition: imm.h:280
#define IMN_CLOSESTATUSWINDOW
Definition: imm.h:521
BOOL WINAPI ImmSetCompositionFontA(HIMC hIMC, LPLOGFONTA lplf)
Definition: ime.c:1697
#define IMN_OPENSTATUSWINDOW
Definition: imm.h:522
#define IMC_SETCANDIDATEPOS
Definition: imm.h:279
BOOL WINAPI ImmGetOpenStatus(HIMC hIMC)
Definition: ime.c:1452
BOOL WINAPI ImmGetCompositionFontA(HIMC hIMC, LPLOGFONTA lplf)
Definition: ime.c:1624
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
#define IMC_SETCOMPOSITIONFONT
Definition: imm.h:281
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
static LRESULT User32SendImeUIMessage(PIMEUI pimeui, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:170
#define IMC_GETCONVERSIONMODE
Definition: immdev.h:21
BOOL WINAPI ImmGetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf)
Definition: ime.c:1660
DWORD WINAPI CtfImmHideToolbarWnd(VOID)
Definition: ctf.c:92
#define BOOL
Definition: nt_native.h:43
BOOL WINAPI ImmSetConversionStatus(HIMC hIMC, DWORD fdwConversion, DWORD fdwSentence)
Definition: ime.c:1950
#define DWORD
Definition: nt_native.h:44
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI ImmSetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf)
Definition: ime.c:1753
#define IMC_GETSTATUSWINDOWPOS
Definition: imm.h:284
#define FALSE
Definition: types.h:117
BOOL WINAPI ImmSetOpenStatus(HIMC hIMC, BOOL fOpen)
Definition: ime.c:1475
DWORD dwLastStatus
Definition: ntuser.h:1252
#define IMC_CLOSESTATUSWINDOW
Definition: imm.h:286
DWORD HIMC
Definition: dimm.idl:75
#define IMC_GETCOMPOSITIONWINDOW
Definition: imm.h:282
#define IMC_SETCONVERSIONMODE
Definition: imm.h:221
HIMC hIMC
Definition: ntuser.h:1238
#define WM_IME_CONTROL
Definition: winuser.h:1821
#define IS_CICERO_MODE()
Definition: ntuser.h:1233
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IMC_SETSTATUSWINDOWPOS
Definition: imm.h:285
#define IMC_GETSOFTKBDPOS
Definition: immdev.h:24
static BOOL User32GetImeShowStatus(VOID)
Definition: imm.c:162
#define IMC_GETCANDIDATEPOS
Definition: imm.h:278
#define IMC_OPENSTATUSWINDOW
Definition: imm.h:287
#define IMC_SETSENTENCEMODE
Definition: imm.h:222
BOOL WINAPI ImmSetStatusWindowPos(HIMC hIMC, LPPOINT lpptPos)
Definition: ime.c:1540
BOOL WINAPI ImmGetConversionStatus(HIMC hIMC, LPDWORD lpfdwConversion, LPDWORD lpfdwSentence)
Definition: ime.c:1921
#define IMC_SETOPENSTATUS
Definition: imm.h:223
UINT fShowStatus
Definition: ntuser.h:1244
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
BOOL WINAPI ImmSetCandidateWindow(HIMC hIMC, LPCANDIDATEFORM lpCandidate)
Definition: candidate.c:414
#define IMC_SETCOMPOSITIONWINDOW
Definition: imm.h:283
#define IMC_SETSOFTKBDPOS
Definition: immdev.h:25
UINT fCtrlShowStatus
Definition: ntuser.h:1249
#define IMC_GETOPENSTATUS
Definition: immdev.h:23
#define IMC_GETSENTENCEMODE
Definition: immdev.h:22
BOOL WINAPI ImmSetCompositionWindow(HIMC hIMC, LPCOMPOSITIONFORM lpCompForm)
Definition: ime.c:1592
VOID WINAPI CtfImmRestoreToolbarWnd(DWORD dwStatus)
Definition: ctf.c:84
LPARAM lParam
Definition: combotst.c:139
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by ImeWndProc_common().

◆ ImeWnd_OnImeNotify()

static LRESULT ImeWnd_OnImeNotify ( PIMEUI  pimeui,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 246 of file imm.c.

247 {
248  LRESULT ret = 0;
249  HIMC hIMC;
250  LPINPUTCONTEXT pIC;
251  HWND hwndUI, hwndIMC, hImeWnd, hwndOwner;
252 
253  ASSERT(pimeui->spwnd != NULL);
254 
255  switch (wParam)
256  {
258  case IMN_SETOPENSTATUS:
259  hIMC = pimeui->hIMC;
260  pIC = IMM_FN(ImmLockIMC)(hIMC);
261  if (pIC)
262  {
263  hwndIMC = pimeui->hwndIMC;
264  if (IsWindow(hwndIMC))
265  {
266  NtUserNotifyIMEStatus(hwndIMC, pIC->fOpen, pIC->fdwConversion);
267  }
268  else if (gfConIme == TRUE && pimeui->spwnd)
269  {
270  hImeWnd = UserHMGetHandle(pimeui->spwnd);
271  hwndOwner = GetWindow(hImeWnd, GW_OWNER);
272  if (hwndOwner)
273  {
274  NtUserNotifyIMEStatus(hwndOwner, pIC->fOpen, pIC->fdwConversion);
275  }
276  }
277 
278  IMM_FN(ImmUnlockIMC)(hIMC);
279  }
280  /* FALL THROUGH */
281  default:
283  break;
284 
285  case IMN_PRIVATE:
286  hwndUI = pimeui->hwndUI;
287  if (IsWindow(hwndUI))
289  break;
290  }
291 
292  return ret;
293 }
#define WM_IME_NOTIFY
Definition: winuser.h:1820
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1070
DWORD NTAPI NtUserNotifyIMEStatus(HWND hwnd, BOOL fOpen, DWORD dwConversion)
Definition: ime.c:814
PWND spwnd
Definition: ntuser.h:1237
static LRESULT User32SendImeUIMessage(PIMEUI pimeui, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:170
DWORD fdwConversion
Definition: immdev.h:60
WPARAM wParam
Definition: combotst.c:138
#define IMN_SETOPENSTATUS
Definition: imm.h:528
HWND hwndUI
Definition: ntuser.h:1241
DWORD HIMC
Definition: dimm.idl:75
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define ASSERT(a)
Definition: mode.c:44
HIMC hIMC
Definition: ntuser.h:1238
int ret
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
#define IMN_PRIVATE
Definition: imm.h:534
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IMN_SETCONVERSIONMODE
Definition: imm.h:526
#define NULL
Definition: types.h:112
#define GW_OWNER
Definition: winuser.h:761
HWND hwndIMC
Definition: ntuser.h:1239
LONG_PTR LRESULT
Definition: windef.h:209
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1079
LPARAM lParam
Definition: combotst.c:139
INT gfConIme
Definition: imm.c:24
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by ImeWndProc_common().

◆ ImeWnd_OnImeSelect()

static VOID ImeWnd_OnImeSelect ( PIMEUI  pimeui,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 391 of file imm.c.

392 {
393  HKL hKL;
394  HWND hwndUI, hwndIMC = pimeui->hwndIMC;
395 
396  if (wParam)
397  {
398  pimeui->hKL = hKL = (HKL)lParam;
399 
400  if (!pimeui->fActivate)
401  return;
402 
403  pimeui->hwndUI = hwndUI = User32CreateImeUIWindow(pimeui, hKL);
404  if (hwndUI)
406 
407  if (User32GetImeShowStatus() && pimeui->fCtrlShowStatus)
408  {
409  if (!pimeui->fShowStatus && pimeui->fActivate && IsWindow(hwndIMC))
410  User32NotifyOpenStatus(pimeui, hwndIMC, TRUE);
411  }
412  }
413  else
414  {
415  if (pimeui->fShowStatus && pimeui->fActivate && IsWindow(hwndIMC))
416  User32NotifyOpenStatus(pimeui, hwndIMC, FALSE);
417 
419  User32DestroyImeUIWindow(pimeui);
420  pimeui->hKL = NULL;
421  }
422 }
static VOID User32NotifyOpenStatus(PIMEUI pimeui, HWND hwndIMC, BOOL bOpen)
Definition: imm.c:199
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
HKL hKL
Definition: ntuser.h:1240
#define WM_IME_SELECT
Definition: winuser.h:1823
static LRESULT User32SendImeUIMessage(PIMEUI pimeui, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:170
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
HWND hwndUI
Definition: ntuser.h:1241
static VOID User32DestroyImeUIWindow(PIMEUI pimeui)
Definition: imm.c:375
static BOOL User32GetImeShowStatus(VOID)
Definition: imm.c:162
UINT_PTR HKL
Definition: msctf.idl:101
static HWND User32CreateImeUIWindow(PIMEUI pimeui, HKL hKL)
Definition: imm.c:297
#define NULL
Definition: types.h:112
UINT fShowStatus
Definition: ntuser.h:1244
UINT fCtrlShowStatus
Definition: ntuser.h:1249
HWND hwndIMC
Definition: ntuser.h:1239
UINT fActivate
Definition: ntuser.h:1245
LPARAM lParam
Definition: combotst.c:139

Referenced by ImeWndProc_common().

◆ ImeWnd_OnImeSetContext()

LRESULT ImeWnd_OnImeSetContext ( PIMEUI  pimeui,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 779 of file imm.c.

780 {
781  LRESULT ret;
782  HIMC hIMC;
783  LPINPUTCONTEXTDX pIC;
784  HWND hwndFocus, hwndOldImc, hwndNewImc, hImeWnd, hwndActive, hwndOwner;
785  PWND pwndFocus, pImeWnd, pwndOwner;
786  COMPOSITIONFORM CompForm;
787 
788  pimeui->fActivate = !!wParam;
789  hwndOldImc = pimeui->hwndIMC;
790  ASSERT(pimeui->spwnd != NULL);
791 
792  if (wParam)
793  {
794  if (!pimeui->hwndUI)
795  pimeui->hwndUI = User32CreateImeUIWindow(pimeui, pimeui->hKL);
796 
797  if (gfConIme == -1)
798  {
800  if (gfConIme)
801  pimeui->fCtrlShowStatus = FALSE;
802  }
803 
804  hImeWnd = UserHMGetHandle(pimeui->spwnd);
805 
806  if (gfConIme)
807  {
808  hwndOwner = GetWindow(hImeWnd, GW_OWNER);
809  pwndOwner = ValidateHwnd(hwndOwner);
810  if (pwndOwner)
811  {
812  User32UpdateImcOfImeUI(pimeui, pwndOwner->hImc);
813 
814  if (pimeui->hwndUI)
815  SetWindowLongPtrW(pimeui->hwndUI, IMMGWLP_IMC, (LONG_PTR)pwndOwner->hImc);
816  }
817 
819  }
820 
821  hwndFocus = (HWND)NtUserQueryWindow(hImeWnd, QUERY_WINDOW_FOCUS);
822 
823  hIMC = IMM_FN(ImmGetContext)(hwndFocus);
824 
825  if (hIMC && !User32CanSetImeWindowToImc(hIMC, hImeWnd))
826  {
827  User32UpdateImcOfImeUI(pimeui, NULL);
828  return 0;
829  }
830 
831  User32UpdateImcOfImeUI(pimeui, hIMC);
832 
833  if (pimeui->hwndUI)
834  SetWindowLongPtrW(pimeui->hwndUI, IMMGWLP_IMC, (LONG_PTR)hIMC);
835 
836  if (hIMC)
837  {
838  pIC = IMM_FN(ImmLockIMC)(hIMC);
839  if (!pIC)
840  return 0;
841 
842  if (hwndFocus != pIC->hWnd)
843  {
844  IMM_FN(ImmUnlockIMC)(hIMC);
845  return 0;
846  }
847 
848  if ((pIC->dwUIFlags & 0x40000) && hwndOldImc != hwndFocus)
849  {
850  RtlZeroMemory(&CompForm, sizeof(CompForm));
851  IMM_FN(ImmSetCompositionWindow)(hIMC, &CompForm);
852 
853  pIC->dwUIFlags &= ~0x40000;
854  }
855 
856  IMM_FN(ImmUnlockIMC)(hIMC);
857 
858  hImeWnd = UserHMGetHandle(pimeui->spwnd);
859  if (NtUserSetImeOwnerWindow(hImeWnd, hwndFocus))
860  pimeui->hwndIMC = hwndFocus;
861  }
862  else
863  {
864  pimeui->hwndIMC = hwndFocus;
865 
866  hImeWnd = UserHMGetHandle(pimeui->spwnd);
867  NtUserSetImeOwnerWindow(hImeWnd, NULL);
868  }
869  }
870 
872 
873  if (!pimeui->spwnd)
874  return 0;
875 
876  if (!pimeui->fCtrlShowStatus || !User32GetImeShowStatus())
877  return ret;
878 
879  hImeWnd = UserHMGetHandle(pimeui->spwnd);
880  hwndFocus = (HWND)NtUserQueryWindow(hImeWnd, QUERY_WINDOW_FOCUS);
881  pwndFocus = ValidateHwnd(hwndFocus);
882 
883  if (wParam)
884  {
885  pImeWnd = ValidateHwnd(hImeWnd);
886  if (pwndFocus && pImeWnd && pImeWnd->head.pti == pwndFocus->head.pti)
887  {
888  hwndNewImc = pimeui->hwndIMC;
889  if (pimeui->fShowStatus)
890  {
891  if (hwndOldImc && hwndNewImc && hwndOldImc != hwndNewImc &&
892  IntGetTopLevelWindow(hwndOldImc) != IntGetTopLevelWindow(hwndNewImc))
893  {
894  User32NotifyOpenStatus(pimeui, hwndOldImc, FALSE);
895  User32NotifyOpenStatus(pimeui, hwndNewImc, TRUE);
896  }
897  }
898  else
899  {
900  if (ValidateHwnd(hwndNewImc))
901  User32NotifyOpenStatus(pimeui, hwndNewImc, TRUE);
902  }
903  }
904 
905  pImeWnd = pimeui->spwnd;
906  hImeWnd = (pImeWnd ? UserHMGetHandle(pImeWnd) : NULL);
907  if (hImeWnd)
909  }
910  else
911  {
912  pImeWnd = pimeui->spwnd;
913  hImeWnd = UserHMGetHandle(pImeWnd);
914  hwndActive = (HWND)NtUserQueryWindow(hImeWnd, QUERY_WINDOW_ACTIVE);
915  if (!pwndFocus || !hwndActive || pImeWnd->head.pti != pwndFocus->head.pti)
916  {
917  if (IsWindow(hwndOldImc))
918  {
919  User32NotifyOpenStatus(pimeui, hwndOldImc, FALSE);
920  }
921  else
922  {
923  pimeui->fShowStatus = FALSE;
925  }
926  }
927  }
928 
929  return ret;
930 }
static BOOL User32CanSetImeWindowToImc(HIMC hIMC, HWND hImeWnd)
Definition: imm.c:155
#define WM_IME_NOTIFY
Definition: winuser.h:1820
static VOID User32NotifyOpenStatus(PIMEUI pimeui, HWND hwndIMC, BOOL bOpen)
Definition: imm.c:199
DWORD dwUIFlags
Definition: immdev.h:132
#define IMN_CLOSESTATUSWINDOW
Definition: imm.h:521
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:232
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1070
#define INT
Definition: polytest.cpp:20
HKL hKL
Definition: ntuser.h:1240
HANDLE HWND
Definition: compat.h:19
PWND spwnd
Definition: ntuser.h:1237
static LRESULT User32SendImeUIMessage(PIMEUI pimeui, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:170
HIMC hImc
Definition: ntuser.h:735
WPARAM wParam
Definition: combotst.c:138
DWORD_PTR NTAPI NtUserQueryWindow(HWND hWnd, DWORD Index)
Definition: window.c:4181
#define QUERY_WINDOW_FOCUS
Definition: ntuser.h:2953
#define FALSE
Definition: types.h:117
HWND hwndUI
Definition: ntuser.h:1241
BOOL NTAPI NtUserCallHwndLock(HWND hWnd, DWORD Routine)
Definition: simplecall.c:585
THRDESKHEAD head
Definition: ntuser.h:690
BOOL NTAPI NtUserSetImeOwnerWindow(HWND hImeWnd, HWND hwndFocus)
Definition: ime.c:1369
DWORD HIMC
Definition: dimm.idl:75
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define QUERY_WINDOW_ACTIVE
Definition: ntuser.h:2952
#define ASSERT(a)
Definition: mode.c:44
#define IMMGWLP_IMC
Definition: immdev.h:52
#define WM_IME_SETCONTEXT
Definition: winuser.h:1819
HIMC WINAPI ImmGetContext(HWND hWnd)
Definition: imm.c:1057
static BOOL User32GetImeShowStatus(VOID)
Definition: imm.c:162
int ret
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
static VOID User32UpdateImcOfImeUI(PIMEUI pimeui, HIMC hNewIMC)
Definition: imm.c:224
Definition: ntuser.h:688
static HWND User32CreateImeUIWindow(PIMEUI pimeui, HKL hKL)
Definition: imm.c:297
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#define GW_OWNER
Definition: winuser.h:761
UINT fShowStatus
Definition: ntuser.h:1244
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
UINT fCtrlShowStatus
Definition: ntuser.h:1249
#define SetWindowLongPtrW
Definition: winuser.h:5336
HWND hwndIMC
Definition: ntuser.h:1239
BOOL WINAPI ImmSetCompositionWindow(HIMC hIMC, LPCOMPOSITIONFORM lpCompForm)
Definition: ime.c:1592
LONG_PTR LRESULT
Definition: windef.h:209
UINT fActivate
Definition: ntuser.h:1245
HWND FASTCALL IntGetTopLevelWindow(HWND hWnd)
Definition: imm.c:26
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1079
LPARAM lParam
Definition: combotst.c:139
INT gfConIme
Definition: imm.c:24
#define ValidateHwnd(hwnd)
Definition: precomp.h:85
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by ImeWndProc_common().

◆ ImeWnd_OnImeSystem()

static LRESULT ImeWnd_OnImeSystem ( PIMEUI  pimeui,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 623 of file imm.c.

624 {
625  LRESULT ret = 0;
626  LPINPUTCONTEXTDX pIC;
627  HIMC hIMC = pimeui->hIMC;
628  LPCANDIDATEFORM pCandForm;
629  LPCOMPOSITIONFORM pCompForm;
630  DWORD dwConversion, dwSentence;
631  HWND hImeWnd;
632  BOOL bCompForm;
633  CANDIDATEFORM CandForm;
634  COMPOSITIONFORM CompForm;
635  UINT iCandForm;
636 
637  ASSERT(pimeui->spwnd != NULL);
638 
639  switch (wParam)
640  {
641  case IMS_NOTIFYIMESHOW:
642  if (User32GetImeShowStatus() == !lParam)
643  {
644  hImeWnd = UserHMGetHandle(pimeui->spwnd);
646  }
647  break;
648 
649  case IMS_UPDATEIMEUI:
650  if (!hIMC)
651  break;
652 
653  bCompForm = TRUE;
654  pIC = IMM_FN(ImmLockIMC)(hIMC);
655  if (pIC)
656  {
657  bCompForm = !(pIC->dwUIFlags & 0x2);
658  IMM_FN(ImmUnlockIMC)(hIMC);
659  }
660 
661  if (!IsWindow(pimeui->hwndIMC))
662  break;
663 
664  if (bCompForm && IMM_FN(ImmGetCompositionWindow)(hIMC, &CompForm))
665  {
666  if (CompForm.dwStyle)
667  IMM_FN(ImmSetCompositionWindow)(hIMC, &CompForm);
668  }
669 
670  for (iCandForm = 0; iCandForm < MAX_CANDIDATEFORM; ++iCandForm)
671  {
672  if (IMM_FN(ImmGetCandidateWindow)(hIMC, iCandForm, &CandForm))
673  {
674  if (CandForm.dwStyle)
675  IMM_FN(ImmSetCandidateWindow)(hIMC, &CandForm);
676  }
677  }
678  break;
679 
680  case IMS_SETCANDFORM:
681  pIC = IMM_FN(ImmLockIMC)(hIMC);
682  if (!pIC)
683  break;
684 
685  pCandForm = &pIC->cfCandForm[lParam];
686  IMM_FN(ImmSetCandidateWindow)(hIMC, pCandForm);
687  IMM_FN(ImmUnlockIMC)(hIMC);
688  break;
689 
690  case IMS_SETCOMPFONT:
691  pIC = IMM_FN(ImmLockIMC)(hIMC);
692  if (!pIC)
693  break;
694 
695  IMM_FN(ImmSetCompositionFontW)(hIMC, &pIC->lfFont.W);
696  IMM_FN(ImmUnlockIMC)(hIMC);
697  break;
698 
699  case IMS_SETCOMPFORM:
700  pIC = IMM_FN(ImmLockIMC)(hIMC);
701  if (!pIC)
702  break;
703 
704  pCompForm = &pIC->cfCompForm;
705  pIC->dwUIFlags |= 0x8;
706  IMM_FN(ImmSetCompositionWindow)(hIMC, pCompForm);
707  IMM_FN(ImmUnlockIMC)(hIMC);
708  break;
709 
710  case IMS_CONFIGURE:
712  break;
713 
714  case IMS_SETOPENSTATUS:
715  if (hIMC)
717  break;
718 
719  case IMS_FREELAYOUT:
721  break;
722 
723  case 0x13:
724  FIXME("\n");
725  break;
726 
727  case IMS_GETCONVSTATUS:
728  IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion, &dwSentence);
729  ret = dwConversion;
730  break;
731 
732  case IMS_IMEHELP:
733  return User32DoImeHelp(pimeui, wParam, lParam);
734 
735  case IMS_IMEACTIVATE:
737  break;
738 
739  case IMS_IMEDEACTIVATE:
741  break;
742 
743  case IMS_ACTIVATELAYOUT:
745  break;
746 
747  case IMS_GETIMEMENU:
749  break;
750 
751  case 0x1D:
752  FIXME("\n");
753  break;
754 
755  case IMS_GETCONTEXT:
757  break;
758 
760  case IMS_COMPLETECOMPSTR:
761  case IMS_SETLANGBAND:
762  case IMS_UNSETLANGBAND:
764  break;
765 
767  CtfLoadThreadLayout(pimeui);
768  break;
769 
770  default:
771  break;
772  }
773 
774  return ret;
775 }
DWORD dwUIFlags
Definition: immdev.h:132
#define IMS_SETOPENSTATUS
Definition: immdev.h:34
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
#define MAX_CANDIDATEFORM
Definition: imm.c:17
#define IMS_IMEACTIVATE
Definition: immdev.h:38
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1070
VOID FASTCALL CtfLoadThreadLayout(PIMEUI pimeui)
Definition: imm.c:578
#define IMS_FREELAYOUT
Definition: immdev.h:35
HANDLE HWND
Definition: compat.h:19
PWND spwnd
Definition: ntuser.h:1237
#define IMS_GETCONVSTATUS
Definition: immdev.h:36
LRESULT WINAPI ImmPutImeMenuItemsIntoMappedFile(HIMC hIMC)
Definition: ime.c:448
DWORD dwStyle
Definition: dimm.idl:80
#define IMS_SETLANGBAND
Definition: immdev.h:46
BOOL WINAPI ImmGetCandidateWindow(HIMC hIMC, DWORD dwIndex, LPCANDIDATEFORM lpCandidate)
Definition: candidate.c:377
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI ImmSetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf)
Definition: ime.c:1753
#define IMS_IMEDEACTIVATE
Definition: immdev.h:39
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI ImmSetOpenStatus(HIMC hIMC, BOOL fOpen)
Definition: ime.c:1475
BOOL WINAPI ImmFreeLayout(DWORD dwUnknown)
Definition: imm.c:120
#define FIXME(fmt,...)
Definition: debug.h:111
#define IMS_SETCOMPFONT
Definition: immdev.h:31
BOOL WINAPI ImmGetCompositionWindow(HIMC hIMC, LPCOMPOSITIONFORM lpCompForm)
Definition: ime.c:1568
DWORD HIMC
Definition: dimm.idl:75
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define IMS_LOADTHREADLAYOUT
Definition: immdev.h:45
static LRESULT FASTCALL User32DoImeHelp(PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
Definition: imm.c:588
#define ASSERT(a)
Definition: mode.c:44
#define IMS_COMPLETECOMPSTR
Definition: immdev.h:44
HIMC WINAPI ImmGetContext(HWND hWnd)
Definition: imm.c:1057
#define IMS_SENDNOTIFICATION
Definition: immdev.h:43
HIMC hIMC
Definition: ntuser.h:1238
#define IMS_GETCONTEXT
Definition: immdev.h:42
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL User32GetImeShowStatus(VOID)
Definition: imm.c:162
#define IMS_SETCOMPFORM
Definition: immdev.h:32
#define IMS_ACTIVATELAYOUT
Definition: immdev.h:40
int ret
static VOID FASTCALL User32SetImeActivenessOfWindow(HWND hWnd, BOOL bActive)
Definition: imm.c:562
UINT_PTR HKL
Definition: msctf.idl:101
BOOL WINAPI ImmConfigureIMEW(HKL hKL, HWND hWnd, DWORD dwMode, LPVOID lpData)
Definition: ime.c:2064
#define IMS_CONFIGURE
Definition: immdev.h:33
#define IMS_NOTIFYIMESHOW
Definition: immdev.h:28
DWORD NTAPI NtUserCallHwndParamLock(HWND hWnd, DWORD_PTR Param, DWORD Routine)
Definition: simplecall.c:884
LRESULT WINAPI ImmSystemHandler(HIMC hIMC, WPARAM wParam, LPARAM lParam)
Definition: keymsg.c:865
BOOL WINAPI ImmGetConversionStatus(HIMC hIMC, LPDWORD lpfdwConversion, LPDWORD lpfdwSentence)
Definition: ime.c:1921
#define IMS_UPDATEIMEUI
Definition: immdev.h:29
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define IME_CONFIG_GENERAL
Definition: imm.h:553
#define IMS_GETIMEMENU
Definition: immdev.h:41
BOOL WINAPI ImmSetCandidateWindow(HIMC hIMC, LPCANDIDATEFORM lpCandidate)
Definition: candidate.c:414
#define ULONG_PTR
Definition: config.h:101
BOOL WINAPI ImmActivateLayout(HKL hKL)
Definition: imm.c:448
HWND hwndIMC
Definition: ntuser.h:1239
BOOL WINAPI ImmSetCompositionWindow(HIMC hIMC, LPCOMPOSITIONFORM lpCompForm)
Definition: ime.c:1592
LONG_PTR LRESULT
Definition: windef.h:209
#define IMS_UNSETLANGBAND
Definition: immdev.h:47
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1079
LPARAM lParam
Definition: combotst.c:139
DWORD dwStyle
Definition: dimm.idl:86
#define IMS_SETCANDFORM
Definition: immdev.h:30
#define IMS_IMEHELP
Definition: immdev.h:37
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by ImeWndProc_common().

◆ ImeWndProc_common()

LRESULT WINAPI ImeWndProc_common ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam,
BOOL  unicode 
)

Definition at line 935 of file imm.c.

936 {
937  PWND pWnd;
938  PIMEUI pimeui;
939  LRESULT ret;
940 
941  pWnd = ValidateHwnd(hwnd);
942  if (pWnd == NULL)
943  {
944  ERR("hwnd was %p\n", hwnd);
945  return 0;
946  }
947 
948  if (!pWnd->fnid)
949  {
951  }
952  else if (pWnd->fnid != FNID_IME)
953  {
954  ERR("fnid was 0x%x\n", pWnd->fnid);
955  return 0;
956  }
957 
958  pimeui = (PIMEUI)GetWindowLongPtrW(hwnd, 0);
959  if (pimeui == NULL)
960  {
961  pimeui = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMEUI));
962  if (pimeui == NULL)
963  {
964  ERR("HeapAlloc failed\n");
967  return 0;
968  }
969 
970  SetWindowLongPtrW(hwnd, 0, (LONG_PTR)pimeui);
971  pimeui->spwnd = pWnd;
972  }
973 
974  if (IS_CICERO_MODE())
975  {
977  if (ret)
978  return ret;
979  }
980 
981  if (pimeui->nCntInIMEProc > 0)
982  {
983  switch (msg)
984  {
985  case WM_IME_CHAR:
987  case WM_IME_CONTROL:
988  case WM_IME_REQUEST:
989  case WM_IME_SELECT:
990  case WM_IME_SETCONTEXT:
991  case WM_IME_STARTCOMPOSITION:
992  case WM_IME_COMPOSITION:
993  case WM_IME_ENDCOMPOSITION:
994  return 0;
995 
996  case WM_IME_NOTIFY:
997  if (wParam < IMN_PRIVATE || IS_IME_HKL(pimeui->hKL) || !IS_CICERO_MODE())
998  return 0;
999  break;
1000 
1001  case WM_IME_SYSTEM:
1002  switch (wParam)
1003  {
1004  case 0x03:
1005  case 0x10:
1006  case 0x13:
1007  break;
1008 
1009  default:
1010  return 0;
1011  }
1012  break;
1013 
1014  default:
1015  goto Finish;
1016  }
1017  }
1018 
1019  if ((pWnd->state2 & WNDS2_INDESTROY) || (pWnd->state & WNDS_DESTROYED))
1020  {
1021  switch (msg)
1022  {
1023  case WM_DESTROY:
1024  case WM_NCDESTROY:
1025  case WM_FINALDESTROY:
1026  break;
1027 
1028  default:
1029  return 0;
1030  }
1031  }
1032 
1033  switch (msg)
1034  {
1035  case WM_CREATE:
1036  return ImeWnd_OnCreate(pimeui, (LPCREATESTRUCT)lParam);
1037 
1038  case WM_DESTROY:
1039  User32DestroyImeUIWindow(pimeui);
1040  return 0;
1041 
1042  case WM_NCDESTROY:
1043  case WM_FINALDESTROY:
1044  pimeui->spwnd = NULL;
1045  HeapFree(GetProcessHeap(), 0, pimeui);
1047  break;
1048 
1049  case WM_ERASEBKGND:
1050  return TRUE;
1051 
1052  case WM_PAINT:
1053  return 0;
1054 
1055  case WM_IME_STARTCOMPOSITION:
1056  case WM_IME_COMPOSITION:
1057  case WM_IME_ENDCOMPOSITION:
1058  return User32SendImeUIMessage(pimeui, msg, wParam, lParam, unicode);
1059 
1060  case WM_IME_CONTROL:
1061  return ImeWnd_OnImeControl(pimeui, wParam, lParam, unicode);
1062 
1063  case WM_IME_NOTIFY:
1064  return ImeWnd_OnImeNotify(pimeui, wParam, lParam);
1065 
1066  case WM_IME_REQUEST:
1067  return 0;
1068 
1069  case WM_IME_SELECT:
1070  ImeWnd_OnImeSelect(pimeui, wParam, lParam);
1071  return (LRESULT)pimeui;
1072 
1073  case WM_IME_SETCONTEXT:
1074  return ImeWnd_OnImeSetContext(pimeui, wParam, lParam);
1075 
1076  case WM_IME_SYSTEM:
1077  return ImeWnd_OnImeSystem(pimeui, wParam, lParam);
1078 
1079  default:
1080  break;
1081  }
1082 
1083 Finish:
1084  if (unicode)
1085  return DefWindowProcW(hwnd, msg, wParam, lParam);
1086  return DefWindowProcA(hwnd, msg, wParam, lParam);
1087 }
#define WM_IME_NOTIFY
Definition: winuser.h:1820
#define WM_IME_CHAR
Definition: winuser.h:1824
static LRESULT ImeWnd_OnImeNotify(PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
Definition: imm.c:246
#define TRUE
Definition: types.h:120
HKL hKL
Definition: ntuser.h:1240
#define WM_IME_SELECT
Definition: winuser.h:1823
PWND spwnd
Definition: ntuser.h:1237
static LRESULT User32SendImeUIMessage(PIMEUI pimeui, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:170
LONG nCntInIMEProc
Definition: ntuser.h:1242
#define GetWindowLongPtrW
Definition: winuser.h:4819
#define FNID_DESTROY
Definition: ntuser.h:893
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WM_IME_COMPOSITIONFULL
Definition: winuser.h:1822
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI CtfImmDispatchDefImeMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ctf.c:101
DWORD fnid
Definition: ntuser.h:704
static VOID User32DestroyImeUIWindow(PIMEUI pimeui)
Definition: imm.c:375
LRESULT ImeWnd_OnImeSetContext(PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
Definition: imm.c:779
#define WM_IME_REQUEST
Definition: winuser.h:1826
#define WM_IME_SYSTEM
Definition: undocuser.h:60
#define WM_DESTROY
Definition: winuser.h:1599
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define WM_IME_SETCONTEXT
Definition: winuser.h:1819
static LRESULT ImeWnd_OnImeSystem(PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
Definition: imm.c:623
#define WM_IME_CONTROL
Definition: winuser.h:1821
#define WM_NCDESTROY
Definition: winuser.h:1674
#define IS_CICERO_MODE()
Definition: ntuser.h:1233
static INT ImeWnd_OnCreate(PIMEUI pimeui, LPCREATESTRUCT lpCS)
Definition: imm.c:343
#define WM_PAINT
Definition: winuser.h:1610
int ret
#define IMN_PRIVATE
Definition: imm.h:534
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_FINALDESTROY
Definition: undocuser.h:39
#define ERR(fmt,...)
Definition: debug.h:110
Definition: ntuser.h:688
#define IS_IME_HKL(hKL)
Definition: input.h:88
DWORD state
Definition: ntuser.h:696
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static VOID ImeWnd_OnImeSelect(PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
Definition: imm.c:391
#define msg(x)
Definition: auth_time.c:54
#define WM_CREATE
Definition: winuser.h:1598
DWORD state2
Definition: ntuser.h:697
BOOL NTAPI NtUserSetWindowFNID(HWND hWnd, WORD fnID)
Definition: window.c:4336
#define SetWindowLongPtrW
Definition: winuser.h:5336
#define WM_ERASEBKGND
Definition: winuser.h:1615
struct tagIMEUI * PIMEUI
LONG_PTR LRESULT
Definition: windef.h:209
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define WNDS_DESTROYED
Definition: ntuser.h:631
LPARAM lParam
Definition: combotst.c:139
#define HeapFree(x, y, z)
Definition: compat.h:735
#define WNDS2_INDESTROY
Definition: ntuser.h:643
#define FNID_IME
Definition: ntuser.h:869
static LRESULT ImeWnd_OnImeControl(PIMEUI pimeui, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:427
#define ValidateHwnd(hwnd)
Definition: precomp.h:85
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by ImeWndProcA(), ImeWndProcW(), RealDefWindowProcA(), RealDefWindowProcW(), and RegisterClientPFN().

◆ ImeWndProcA()

LRESULT WINAPI ImeWndProcA ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1090 of file imm.c.

1091 {
1093 }
LRESULT WINAPI ImeWndProc_common(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:935
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
#define msg(x)
Definition: auth_time.c:54
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
LPARAM lParam
Definition: combotst.c:139

Referenced by RegisterClientPFN().

◆ ImeWndProcW()

LRESULT WINAPI ImeWndProcW ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1096 of file imm.c.

1097 {
1099 }
#define TRUE
Definition: types.h:120
LRESULT WINAPI ImeWndProc_common(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:935
WPARAM wParam
Definition: combotst.c:138
#define msg(x)
Definition: auth_time.c:54
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
LPARAM lParam
Definition: combotst.c:139

Referenced by RegisterClientPFN(), and RegisterIMEClass().

◆ IMPGetIMEA()

BOOL WINAPI IMPGetIMEA ( HWND  hwnd,
LPIMEPROA  ime 
)

Definition at line 1205 of file imm.c.

1206 {
1207  return IMM_FN(ImmIMPGetIMEA)(hwnd, ime);
1208 }
BOOL WINAPI ImmIMPGetIMEA(HWND hWnd, LPIMEPROA pImePro)
Definition: utils.c:1268
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define IMM_FN(name)
Definition: user32p.h:56

◆ IMPGetIMEW()

BOOL WINAPI IMPGetIMEW ( HWND  hwnd,
LPIMEPROW  ime 
)

Definition at line 1175 of file imm.c.

1176 {
1177  return IMM_FN(ImmIMPGetIMEW)(hwnd, ime);
1178 }
BOOL WINAPI ImmIMPGetIMEW(HWND hWnd, LPIMEPROW pImePro)
Definition: utils.c:1277
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define IMM_FN(name)
Definition: user32p.h:56

◆ IMPQueryIMEA()

BOOL WINAPI IMPQueryIMEA ( LPIMEPROA  ime)

Definition at line 1195 of file imm.c.

1196 {
1197  return IMM_FN(ImmIMPQueryIMEA)(ime);
1198 }
BOOL WINAPI ImmIMPQueryIMEA(LPIMEPROA pImePro)
Definition: utils.c:1286
#define IMM_FN(name)
Definition: user32p.h:56

◆ IMPQueryIMEW()

BOOL WINAPI IMPQueryIMEW ( LPIMEPROW  ime)

Definition at line 1165 of file imm.c.

1166 {
1167  return IMM_FN(ImmIMPQueryIMEW)(ime);
1168 }
BOOL WINAPI ImmIMPQueryIMEW(LPIMEPROW pImePro)
Definition: utils.c:1295
#define IMM_FN(name)
Definition: user32p.h:56

◆ IMPSetIMEA()

BOOL WINAPI IMPSetIMEA ( HWND  hwnd,
LPIMEPROA  ime 
)

Definition at line 1185 of file imm.c.

1186 {
1187  return IMM_FN(ImmIMPSetIMEA)(hwnd, ime);
1188 }
BOOL WINAPI ImmIMPSetIMEA(HWND hWnd, LPIMEPROA pImePro)
Definition: utils.c:1304
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define IMM_FN(name)
Definition: user32p.h:56

◆ IMPSetIMEW()

BOOL WINAPI IMPSetIMEW ( HWND  hwnd,
LPIMEPROW  ime 
)

Definition at line 1155 of file imm.c.

1156 {
1157  return IMM_FN(ImmIMPSetIMEW)(hwnd, ime);
1158 }
BOOL WINAPI ImmIMPSetIMEW(HWND hWnd, LPIMEPROW pImePro)
Definition: utils.c:1313
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define IMM_FN(name)
Definition: user32p.h:56

◆ InitializeImmEntryTable()

BOOL WINAPI InitializeImmEntryTable ( VOID  )

Definition at line 119 of file imm.c.

120 {
123 }
#define TRUE
Definition: types.h:120
BOOL gbImmInitializing
Definition: imm.c:22
static BOOL IntInitializeImmEntryTable(VOID)
Definition: imm.c:70

Referenced by DllMain().

◆ IntGetTopLevelWindow()

HWND FASTCALL IntGetTopLevelWindow ( HWND  hWnd)

Definition at line 26 of file imm.c.

27 {
28  DWORD style;
29 
30  for (; hWnd; hWnd = GetParent(hWnd))
31  {
33  if (!(style & WS_CHILD))
34  break;
35  }
36 
37  return hWnd;
38 }
HWND hWnd
Definition: settings.c:17
#define WS_CHILD
Definition: pedump.c:617
#define GetWindowLongPtrW
Definition: winuser.h:4819
#define DWORD
Definition: nt_native.h:44
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GWL_STYLE
Definition: winuser.h:846
HWND WINAPI GetParent(_In_ HWND)
Arabic default style
Definition: afstyles.h:93

Referenced by ImeWnd_OnImeSetContext().

◆ IntInitializeImmEntryTable()

static BOOL IntInitializeImmEntryTable ( VOID  )
static

Definition at line 70 of file imm.c.

71 {
72  WCHAR ImmFile[MAX_PATH];
73  HMODULE imm32 = ghImm32;
74 
75  /* Check whether the IMM table has already been initialized */
76  if (IMM_FN(ImmWINNLSEnableIME) != IMMSTUB_ImmWINNLSEnableIME)
77  return TRUE;
78 
79  User32GetImmFileName(ImmFile, _countof(ImmFile));
80  TRACE("File %S\n", ImmFile);
81 
82  /* If IMM32 is already loaded, use it without increasing reference count. */
83  if (imm32 == NULL)
84  imm32 = GetModuleHandleW(ImmFile);
85 
86  /*
87  * Loading imm32.dll will call imm32!DllMain function.
88  * imm32!DllMain calls User32InitializeImmEntryTable.
89  * Thus, if imm32.dll was loaded, the table has been loaded.
90  */
91  if (imm32 == NULL)
92  {
93  imm32 = ghImm32 = LoadLibraryW(ImmFile);
94  if (imm32 == NULL)
95  {
96  ERR("Did not load imm32.dll!\n");
97  return FALSE;
98  }
99  return TRUE;
100  }
101 
102 /* load imm procedures */
103 #undef DEFINE_IMM_ENTRY
104 #define DEFINE_IMM_ENTRY(type, name, params, retval, retkind) \
105  do { \
106  FN_##name proc = (FN_##name)GetProcAddress(imm32, #name); \
107  if (!proc) { \
108  ERR("Could not load %s\n", #name); \
109  return FALSE; \
110  } \
111  IMM_FN(name) = proc; \
112  } while (0);
113 #include "immtable.h"
114 
115  return TRUE;
116 }
#define TRUE
Definition: types.h:120
HRESULT User32GetImmFileName(_Out_ LPWSTR lpBuffer, _In_ size_t cchBuffer)
Definition: imm.c:57
#define FALSE
Definition: types.h:117
#define LoadLibraryW(x)
Definition: compat.h:747
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI ImmWINNLSEnableIME(HWND hWnd, BOOL enable)
Definition: ime.c:2145
#define ERR(fmt,...)
Definition: debug.h:110
HINSTANCE ghImm32
Definition: imm.c:20
#define NULL
Definition: types.h:112
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by InitializeImmEntryTable(), and User32InitializeImmEntryTable().

◆ RegisterIMEClass()

BOOL WINAPI RegisterIMEClass ( VOID  )

Definition at line 1127 of file imm.c.

1128 {
1129  ATOM atom;
1130  WNDCLASSEXW WndClass = { sizeof(WndClass) };
1131 
1132  WndClass.lpszClassName = L"IME";
1133  WndClass.style = CS_GLOBALCLASS;
1134  WndClass.lpfnWndProc = ImeWndProcW;
1135  WndClass.cbWndExtra = sizeof(LONG_PTR);
1136  WndClass.hCursor = LoadCursorW(NULL, IDC_ARROW);
1137 
1138  atom = RegisterClassExWOWW(&WndClass, 0, FNID_IME, 0, FALSE);
1139  if (!atom)
1140  {
1141  ERR("Failed to register IME Class!\n");
1142  return FALSE;
1143  }
1144 
1146  TRACE("RegisterIMEClass atom = %u\n", atom);
1147  return TRUE;
1148 }
#define LONG_PTR
Definition: treelist.c:79
WORD ATOM
Definition: dimm.idl:113
#define TRUE
Definition: types.h:120
LRESULT WINAPI ImeWndProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: imm.c:1096
ATOM WINAPI RegisterClassExWOWW(WNDCLASSEXW *, LPDWORD, WORD, DWORD, BOOL)
Definition: class.c:1413
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
#define CS_GLOBALCLASS
Definition: winuser.h:647
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
#define ICLS_IME
Definition: ntuser.h:922
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
#define IDC_ARROW
Definition: winuser.h:682
#define ICLASS_TO_MASK(iCls)
Definition: ntuser.h:897
DWORD RegisterDefaultClasses
Definition: regcontrol.c:13
WCHAR WndClass[]
Definition: capicon.c:23
#define FNID_IME
Definition: ntuser.h:869

Referenced by RegisterSystemControls().

◆ SendIMEMessageExA()

LRESULT WINAPI SendIMEMessageExA ( HWND  hwnd,
LPARAM  lParam 
)

Definition at line 1225 of file imm.c.

1226 {
1228 }
WORD WINAPI ImmSendIMEMessageExA(HWND hWnd, LPARAM lParam)
Definition: win3.c:216
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
LPARAM lParam
Definition: combotst.c:139
#define IMM_FN(name)
Definition: user32p.h:56

◆ SendIMEMessageExW()

LRESULT WINAPI SendIMEMessageExW ( HWND  hwnd,
LPARAM  lParam 
)

Definition at line 1215 of file imm.c.

1216 {
1218 }
WORD WINAPI ImmSendIMEMessageExW(HWND hWnd, LPARAM lParam)
Definition: win3.c:225
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
LPARAM lParam
Definition: combotst.c:139
#define IMM_FN(name)
Definition: user32p.h:56

◆ UpdatePerUserImmEnabling()

BOOL WINAPI UpdatePerUserImmEnabling ( VOID  )

Definition at line 1102 of file imm.c.

1103 {
1104  HMODULE imm32;
1105  BOOL ret;
1106 
1108  if (!ret || !(gpsi->dwSRVIFlags & SRVINFO_IMM32))
1109  return FALSE;
1110 
1111  imm32 = GetModuleHandleW(L"imm32.dll");
1112  if (imm32)
1113  return TRUE;
1114 
1115  imm32 = LoadLibraryW(L"imm32.dll");
1116  if (imm32 == NULL)
1117  {
1118  ERR("Imm32 not installed!\n");
1119  ret = FALSE;
1120  }
1121 
1122  return ret;
1123 }
#define TRUE
Definition: types.h:120
PSERVERINFO gpsi
Definition: imm.c:18
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
DWORD dwSRVIFlags
Definition: ntuser.h:1046
unsigned int BOOL
Definition: ntddk_ex.h:94
#define LoadLibraryW(x)
Definition: compat.h:747
int ret
DWORD_PTR NTAPI NtUserCallNoParam(DWORD Routine)
Definition: simplecall.c:59
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
#define SRVINFO_IMM32
Definition: ntuser.h:944
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838

Referenced by UpdatePerUserSystemParameters().

◆ User32CanSetImeWindowToImc()

static BOOL User32CanSetImeWindowToImc ( HIMC  hIMC,
HWND  hImeWnd 
)
static

Definition at line 155 of file imm.c.

156 {
157  PIMC pIMC = ValidateHandle(hIMC, TYPE_INPUTCONTEXT);
158  return pIMC && (!pIMC->hImeWnd || pIMC->hImeWnd == hImeWnd || !ValidateHwnd(pIMC->hImeWnd));
159 }
Definition: ntuser.h:198
HWND hImeWnd
Definition: ntuser.h:203
LPVOID FASTCALL ValidateHandle(HANDLE hObject, UINT uType)
Definition: utils.c:377
#define ValidateHwnd(hwnd)
Definition: precomp.h:85

Referenced by ImeWnd_OnCreate(), and ImeWnd_OnImeSetContext().

◆ User32CreateImeUIWindow()

static HWND User32CreateImeUIWindow ( PIMEUI  pimeui,
HKL  hKL 
)
static

Definition at line 297 of file imm.c.

298 {
299  IMEINFOEX ImeInfoEx;
300  PIMEDPI pImeDpi;
301  WNDCLASSW wc;
302  HWND hwndUI = NULL;
303  CHAR szUIClass[32];
304  PWND pwnd = pimeui->spwnd;
305 
306  ASSERT(pimeui->spwnd != NULL);
307 
308  if (!pwnd || !IMM_FN(ImmGetImeInfoEx)(&ImeInfoEx, ImeInfoExKeyboardLayout, &hKL))
309  return NULL;
310 
311  pImeDpi = IMM_FN(ImmLockImeDpi)(hKL);
312  if (!pImeDpi)
313  return NULL;
314 
315  if (!GetClassInfoW(pImeDpi->hInst, ImeInfoEx.wszUIClass, &wc))
316  goto Quit;
317 
318  if (ImeInfoEx.ImeInfo.fdwProperty & IME_PROP_UNICODE)
319  {
320  hwndUI = CreateWindowW(ImeInfoEx.wszUIClass, ImeInfoEx.wszUIClass, WS_POPUP | WS_DISABLED,
321  0, 0, 0, 0, UserHMGetHandle(pwnd), 0, wc.hInstance, NULL);
322  }
323  else
324  {
325  WideCharToMultiByte(CP_ACP, 0, ImeInfoEx.wszUIClass, -1,
326  szUIClass, _countof(szUIClass), NULL, NULL);
327  szUIClass[_countof(szUIClass) - 1] = 0;
328 
329  hwndUI = CreateWindowA(szUIClass, szUIClass, WS_POPUP | WS_DISABLED,
330  0, 0, 0, 0, UserHMGetHandle(pwnd), 0, wc.hInstance, NULL);
331  }
332 
333  if (hwndUI)
335 
336 Quit:
337  IMM_FN(ImmUnlockImeDpi)(pImeDpi);
338  return hwndUI;
339 }
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:1016
#define WS_DISABLED
Definition: pedump.c:621
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
char CHAR
Definition: xmlstorage.h:175
BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey)
Definition: ime.c:941
PWND spwnd
Definition: ntuser.h:1237
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4306
#define FALSE
Definition: types.h:117
HINSTANCE hInst
Definition: ntuser.h:1282
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4305
BOOL WINAPI GetClassInfoW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _Out_ LPWNDCLASSW)
#define IME_PROP_UNICODE
Definition: imm.h:393
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define ASSERT(a)
Definition: mode.c:44
#define IMMGWLP_IMC
Definition: immdev.h:52
DWORD fdwProperty
Definition: imm.h:158
#define _countof(array)
Definition: sndvol32.h:68
HIMC hIMC
Definition: ntuser.h:1238
PIMEDPI WINAPI ImmLockImeDpi(HKL hKL)
Definition: ime.c:987
WCHAR wszUIClass[16]
Definition: ntuser.h:1208
#define NtUserSetWindowLongPtr
Definition: ntuser.h:3400
Definition: ntuser.h:688
IMEINFO ImeInfo
Definition: ntuser.h:1207
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WS_POPUP
Definition: pedump.c:616
#define NULL
Definition: types.h:112
HINSTANCE hInstance
Definition: winuser.h:3170
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by ImeWnd_OnImeSelect(), and ImeWnd_OnImeSetContext().

◆ User32DestroyImeUIWindow()

static VOID User32DestroyImeUIWindow ( PIMEUI  pimeui)
static

Definition at line 375 of file imm.c.

376 {
377  HWND hwndUI = pimeui->hwndUI;
378 
379  if (IsWindow(hwndUI))
380  {
381  pimeui->fDestroy = TRUE;
382  NtUserDestroyWindow(hwndUI);
383  }
384 
385  pimeui->fShowStatus = pimeui->fDestroy = FALSE;
386  pimeui->hwndUI = NULL;
387 }
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HWND hwndUI
Definition: ntuser.h:1241
BOOLEAN NTAPI NtUserDestroyWindow(HWND Wnd)
Definition: window.c:3019
UINT fDestroy
Definition: ntuser.h:1246
#define NULL
Definition: types.h:112
UINT fShowStatus
Definition: ntuser.h:1244

Referenced by ImeWnd_OnImeSelect(), and ImeWndProc_common().

◆ User32DoImeHelp()

static LRESULT FASTCALL User32DoImeHelp ( PIMEUI  pimeui,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 588 of file imm.c.

589 {
592  size_t cch;
593 
594  /* Is there any IME help file? */
595  ret = IMM_FN(ImmEscapeW)(pimeui->hKL, pimeui->hIMC, IME_ESC_QUERY_SUPPORT, &dwEsc);
596  if (!ret || !lParam)
597  return ret;
598 
599  /* Get the help filename */
600  if (IMM_FN(ImmEscapeW)(pimeui->hKL, pimeui->hIMC, IME_ESC_GETHELPFILENAME, szHelpFile))
601  {
602  /* Check filename extension */
603  cch = wcslen(szHelpFile);
604  if (cch > 4 && _wcsicmp(&szHelpFile[cch - 4], L".HLP") == 0)
605  {
606  /* Open the old-style help */
607  TRACE("szHelpFile: %s\n", debugstr_w(szHelpFile));
609  }
610  else
611  {
612  /* Open the new-style help */
613  FIXME("(%p, %p, %p): %s\n", pimeui, wParam, lParam, debugstr_w(szHelpFile));
614  ret = FALSE;
615  }
616  }
617 
618  return ret;
619 }
HKL hKL
Definition: ntuser.h:1240
WPARAM wParam
Definition: combotst.c:138
#define HELP_FINDER
Definition: winuser.h:2409
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define IME_ESC_GETHELPFILENAME
Definition: imm.h:572
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
HIMC hIMC
Definition: ntuser.h:1238
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
TCHAR szHelpFile[]
Definition: scrnsave.c:30
LRESULT WINAPI ImmEscapeW(HKL hKL, HIMC hIMC, UINT uSubFunc, LPVOID lpData)
Definition: ime.c:1374
#define IME_ESC_QUERY_SUPPORT
Definition: imm.h:558
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
BOOL WINAPI WinHelpW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_ UINT, _In_ ULONG_PTR)
IN PCTCH IN DWORD cch
Definition: pager.h:36
LPARAM lParam
Definition: combotst.c:139
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by ImeWnd_OnImeSystem().

◆ User32GetImeShowStatus()

static BOOL User32GetImeShowStatus ( VOID  )
static

Definition at line 162 of file imm.c.

163 {
165 }
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD_PTR NTAPI NtUserCallNoParam(DWORD Routine)
Definition: simplecall.c:59

Referenced by ImeWnd_OnImeControl(), ImeWnd_OnImeSelect(), ImeWnd_OnImeSetContext(), and ImeWnd_OnImeSystem().

◆ User32GetImmFileName()

HRESULT User32GetImmFileName ( _Out_ LPWSTR  lpBuffer,
_In_ size_t  cchBuffer 
)

Definition at line 57 of file imm.c.

58 {
60  if (length && length < cchBuffer)
61  {
63  return StringCchCatW(lpBuffer, cchBuffer, L"imm32.dll");
64  }
65  return StringCchCopyW(lpBuffer, cchBuffer, L"imm32.dll");
66 }
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
#define L(x)
Definition: ntvdm.h:50
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
static DWORD cchBuffer
Definition: fusion.c:85
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
unsigned int UINT
Definition: ndis.h:50

Referenced by DllMain(), IntInitializeImmEntryTable(), and User32InitializeImmEntryTable().

◆ User32InitializeImmEntryTable()

BOOL WINAPI User32InitializeImmEntryTable ( DWORD  magic)

Definition at line 126 of file imm.c.

127 {
128  TRACE("Imm (%x)\n", magic);
129 
130  if (magic != IMM_INIT_MAGIC)
131  return FALSE;
132 
133  /* Check whether the IMM table has already been initialized */
134  if (IMM_FN(ImmWINNLSEnableIME) != IMMSTUB_ImmWINNLSEnableIME)
135  return TRUE;
136 
138 
139  if (ghImm32 == NULL && !gbImmInitializing)
140  {
141  WCHAR ImmFile[MAX_PATH];
142  User32GetImmFileName(ImmFile, _countof(ImmFile));
143  ghImm32 = LoadLibraryW(ImmFile);
144  if (ghImm32 == NULL)
145  {
146  ERR("Did not load imm32.dll!\n");
147  return FALSE;
148  }
149  }
150 
152 }
#define TRUE
Definition: types.h:120
u32_t magic(void)
HRESULT User32GetImmFileName(_Out_ LPWSTR lpBuffer, _In_ size_t cchBuffer)
Definition: imm.c:57
BOOL WINAPI ImmRegisterClient(PSHAREDINFO ptr, HINSTANCE hMod)
Definition: imm.c:58
#define FALSE
Definition: types.h:117
#define LoadLibraryW(x)
Definition: compat.h:747
BOOL gbImmInitializing
Definition: imm.c:22
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
SHAREDINFO gSharedInfo
Definition: imm.c:19
BOOL WINAPI ImmWINNLSEnableIME(HWND hWnd, BOOL enable)
Definition: ime.c:2145
static BOOL IntInitializeImmEntryTable(VOID)
Definition: imm.c:70
#define ERR(fmt,...)
Definition: debug.h:110
HINSTANCE ghImm32
Definition: imm.c:20
#define NULL
Definition: types.h:112
#define IMM_INIT_MAGIC
Definition: imm.c:16
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by ImmDllInitialize().

◆ User32NotifyOpenStatus()

static VOID User32NotifyOpenStatus ( PIMEUI  pimeui,
HWND  hwndIMC,
BOOL  bOpen 
)
static

Definition at line 199 of file imm.c.

200 {
202 
203  ASSERT(pimeui->spwnd != NULL);
204 
205  pimeui->fShowStatus = bOpen;
206 
207  if (LOWORD(GetWin32ClientInfo()->dwExpWinVer) >= 0x400)
208  SendMessageW(hwndIMC, WM_IME_NOTIFY, wParam, 0);
209  else
211 }
#define WM_IME_NOTIFY
Definition: winuser.h:1820
#define IMN_CLOSESTATUSWINDOW
Definition: imm.h:521
#define IMN_OPENSTATUSWINDOW
Definition: imm.h:522
#define TRUE
Definition: types.h:120
PWND spwnd
Definition: ntuser.h:1237
static LRESULT User32SendImeUIMessage(PIMEUI pimeui, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:170
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWin32ClientInfo()
Definition: ntuser.h:347
WPARAM wParam
Definition: combotst.c:138
#define ASSERT(a)
Definition: mode.c:44
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
UINT fShowStatus
Definition: ntuser.h:1244
#define LOWORD(l)
Definition: pedump.c:82

Referenced by ImeWnd_OnImeSelect(), and ImeWnd_OnImeSetContext().

◆ User32SendImeUIMessage()

static LRESULT User32SendImeUIMessage ( PIMEUI  pimeui,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL  unicode 
)
static

Definition at line 170 of file imm.c.

171 {
172  LRESULT ret = 0;
173  HWND hwndUI = pimeui->hwndUI;
174  PWND pwnd, pwndUI;
175 
176  ASSERT(pimeui->spwnd != NULL);
177 
178  pwnd = pimeui->spwnd;
179  pwndUI = ValidateHwnd(hwndUI);
180  if (!pwnd || (pwnd->state & WNDS_DESTROYED) || (pwnd->state2 & WNDS2_INDESTROY) ||
181  !pwndUI || (pwndUI->state & WNDS_DESTROYED) || (pwndUI->state2 & WNDS2_INDESTROY))
182  {
183  return 0;
184  }
185 
187 
188  if (unicode)
189  ret = SendMessageW(hwndUI, uMsg, wParam, lParam);
190  else
191  ret = SendMessageA(hwndUI, uMsg, wParam, lParam);
192 
194 
195  return ret;
196 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
PWND spwnd
Definition: ntuser.h:1237
LONG nCntInIMEProc
Definition: ntuser.h:1242
WPARAM wParam
Definition: combotst.c:138
HWND hwndUI
Definition: ntuser.h:1241
#define ASSERT(a)
Definition: mode.c:44
int ret
#define InterlockedDecrement
Definition: armddk.h:52
Definition: ntuser.h:688
#define InterlockedIncrement
Definition: armddk.h:53
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
DWORD state
Definition: ntuser.h:696
#define NULL
Definition: types.h:112
DWORD state2
Definition: ntuser.h:697
LONG_PTR LRESULT
Definition: windef.h:209
#define WNDS_DESTROYED
Definition: ntuser.h:631
LPARAM lParam
Definition: combotst.c:139
#define WNDS2_INDESTROY
Definition: ntuser.h:643
#define ValidateHwnd(hwnd)
Definition: precomp.h:85

Referenced by ImeWnd_OnImeControl(), ImeWnd_OnImeNotify(), ImeWnd_OnImeSelect(), ImeWnd_OnImeSetContext(), ImeWndProc_common(), and User32NotifyOpenStatus().

◆ User32SetImeActivenessOfWindow()

static VOID FASTCALL User32SetImeActivenessOfWindow ( HWND  hWnd,
BOOL  bActive 
)
static

Definition at line 562 of file imm.c.

563 {
564  HIMC hIMC;
565 
566  if (!hWnd || !IsWindow(hWnd))
567  {
568  IMM_FN(ImmSetActiveContext)(NULL, NULL, bActive);
569  return;
570  }
571 
572  hIMC = IMM_FN(ImmGetContext)(hWnd);
573  IMM_FN(ImmSetActiveContext)(hWnd, hIMC, bActive);
574  IMM_FN(ImmReleaseContext)(hWnd, hIMC);
575 }
BOOL WINAPI IsWindow(_In_opt_ HWND)
HWND hWnd
Definition: settings.c:17
BOOL WINAPI ImmSetActiveContext(HWND hWnd, HIMC hIMC, BOOL fActive)
Definition: imm.c:1176
DWORD HIMC
Definition: dimm.idl:75
HIMC WINAPI ImmGetContext(HWND hWnd)
Definition: imm.c:1057
BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC)
Definition: imm.c:1098
#define NULL
Definition: types.h:112
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by ImeWnd_OnImeSystem().

◆ User32SetImeWindowOfImc()

static VOID User32SetImeWindowOfImc ( HIMC  hIMC,
HWND  hImeWnd 
)
static

Definition at line 214 of file imm.c.

215 {
216  PIMC pIMC = ValidateHandle(hIMC, TYPE_INPUTCONTEXT);
217  if (!pIMC || pIMC->hImeWnd == hImeWnd)
218  return;
219 
221 }
Definition: ntuser.h:198
uint32_t ULONG_PTR
Definition: typedefs.h:65
HWND hImeWnd
Definition: ntuser.h:203
BOOL NTAPI NtUserUpdateInputContext(HIMC hIMC, DWORD dwType, DWORD_PTR dwValue)
Definition: ime.c:1769
LPVOID FASTCALL ValidateHandle(HANDLE hObject, UINT uType)
Definition: utils.c:377

Referenced by User32UpdateImcOfImeUI().

◆ User32UpdateImcOfImeUI()

static VOID User32UpdateImcOfImeUI ( PIMEUI  pimeui,
HIMC  hNewIMC 
)
static

Definition at line 224 of file imm.c.

225 {
226  HWND hImeWnd;
227  HIMC hOldIMC = pimeui->hIMC;
228 
229  ASSERT(pimeui->spwnd != NULL);
230  hImeWnd = UserHMGetHandle(pimeui->spwnd);
231 
232  if (hNewIMC == hOldIMC)
233  return;
234 
235  if (hOldIMC)
236  User32SetImeWindowOfImc(hOldIMC, NULL);
237 
238  pimeui->hIMC = hNewIMC;
239 
240  if (hNewIMC)
241  User32SetImeWindowOfImc(hNewIMC, hImeWnd);
242 }
PWND spwnd
Definition: ntuser.h:1237
static VOID User32SetImeWindowOfImc(HIMC hIMC, HWND hImeWnd)
Definition: imm.c:214
DWORD HIMC
Definition: dimm.idl:75
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define ASSERT(a)
Definition: mode.c:44
HIMC hIMC
Definition: ntuser.h:1238
#define NULL
Definition: types.h:112

Referenced by ImeWnd_OnCreate(), and ImeWnd_OnImeSetContext().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( user32  )

◆ WINNLSEnableIME()

BOOL WINAPI WINNLSEnableIME ( HWND  hwnd,
BOOL  enable 
)

Definition at line 1235 of file imm.c.

1236 {
1238 }
BOOL WINAPI ImmWINNLSEnableIME(HWND hWnd, BOOL enable)
Definition: ime.c:2145
GLboolean enable
Definition: glext.h:11120
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define IMM_FN(name)
Definition: user32p.h:56

◆ WINNLSGetEnableStatus()

BOOL WINAPI WINNLSGetEnableStatus ( HWND  hwnd)

Definition at line 1245 of file imm.c.

1246 {
1248 }
BOOL WINAPI ImmWINNLSGetEnableStatus(HWND hWnd)
Definition: imm.c:1274
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define IMM_FN(name)
Definition: user32p.h:56

◆ WINNLSGetIMEHotkey()

UINT WINAPI WINNLSGetIMEHotkey ( HWND  hwnd)

Definition at line 1255 of file imm.c.

1256 {
1257  return FALSE;
1258 }
#define FALSE
Definition: types.h:117

Variable Documentation

◆ gbImmInitializing

BOOL gbImmInitializing = FALSE

Definition at line 22 of file imm.c.

Referenced by InitializeImmEntryTable(), and User32InitializeImmEntryTable().

◆ gfConIme

INT gfConIme = -1

Definition at line 24 of file imm.c.

Referenced by ImeWnd_OnImeNotify(), and ImeWnd_OnImeSetContext().

◆ ghImm32

HINSTANCE ghImm32 = NULL

Definition at line 20 of file imm.c.

Referenced by DllMain(), IntInitializeImmEntryTable(), and User32InitializeImmEntryTable().

◆ gImmApiEntries

Imm32ApiTable gImmApiEntries
Initial value:
= {
#define DEFINE_IMM_ENTRY(type, name, params, retval, retkind)
}

Definition at line 47 of file imm.c.