ReactOS  0.4.15-dev-1074-gffc96d2
imm.c File Reference
#include <user32.h>
#include <strsafe.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 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)
 
HRESULT WINAPI GetImmFileName (PWSTR lpBuffer, UINT uSize)
 
BOOL WINAPI IntInitializeImmEntryTable (VOID)
 
BOOL WINAPI InitializeImmEntryTable (VOID)
 
BOOL WINAPI User32InitializeImmEntryTable (DWORD magic)
 
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 CliImmSetHotKey (DWORD dwID, UINT uModifiers, UINT uVirtualKey, HKL hKl)
 
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 bImmInitializing = FALSE
 
Imm32ApiTable gImmApiEntries
 
static const WCHAR imeW [] = {'I','M','E',0}
 

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 24 of file imm.c.

◆ DEFINE_IMM_ENTRY [2/3]

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

Definition at line 24 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) { \
IMM_FN(name) = proc; \
} \
} while (0);
static HANDLE proc()
Definition: pdb.c:32
Definition: name.c:38
#define GetProcAddress(x, y)
Definition: compat.h:501
GLuint const GLchar * name
Definition: glext.h:6031

Definition at line 24 of file imm.c.

◆ IMM_INIT_MAGIC

#define IMM_INIT_MAGIC   0x19650412

Definition at line 17 of file imm.c.

Function Documentation

◆ CliImmSetHotKey()

BOOL WINAPI CliImmSetHotKey ( DWORD  dwID,
UINT  uModifiers,
UINT  uVirtualKey,
HKL  hKl 
)

Definition at line 245 of file imm.c.

246 {
248  return FALSE;
249 }
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:115

◆ GetImmFileName()

HRESULT WINAPI GetImmFileName ( PWSTR  lpBuffer,
UINT  uSize 
)

Definition at line 36 of file imm.c.

37 {
38  UINT length;
39  STRSAFE_LPWSTR Safe = lpBuffer;
40 
42  if ( length && length < uSize )
43  {
44  StringCchCatW(Safe, uSize, L"\\");
45  return StringCchCatW(Safe, uSize, L"imm32.dll");
46  }
47  return StringCchCopyW(Safe, uSize, L"imm32.dll");
48 }
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:53
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
static const WCHAR L[]
Definition: oid.c:1250
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2312
unsigned int UINT
Definition: ndis.h:50

Referenced by IntInitializeImmEntryTable(), and User32InitializeImmEntryTable().

◆ ImeWndProc_common()

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

Definition at line 124 of file imm.c.

125 {
126  PWND pWnd;
127  PIMEUI pimeui;
128 
129  pWnd = ValidateHwnd(hwnd);
130  if (pWnd)
131  {
132  if (!pWnd->fnid)
133  {
134  if (msg != WM_NCCREATE)
135  {
136  if (unicode)
137  return DefWindowProcW(hwnd, msg, wParam, lParam);
138  return DefWindowProcA(hwnd, msg, wParam, lParam);
139  }
141  pimeui = HeapAlloc( GetProcessHeap(), 0, sizeof(IMEUI) );
142  SetWindowLongPtrW(hwnd, 0, (LONG_PTR)pimeui);
143  }
144  else
145  {
146  if (pWnd->fnid != FNID_IME)
147  {
148  ERR("Wrong window class for Ime! fnId 0x%x\n",pWnd->fnid);
149  return 0;
150  }
151  pimeui = ((PIMEWND)pWnd)->pimeui;
152  if (pimeui == NULL)
153  {
154  ERR("Window is not set to IME!\n");
155  return 0;
156  }
157  }
158  }
159 
160  if (msg==WM_CREATE || msg==WM_NCCREATE)
161  return TRUE;
162 
163  if (msg==WM_NCDESTROY)
164  {
165  HeapFree( GetProcessHeap(), 0, pimeui );
166  SetWindowLongPtrW(hwnd, 0, 0);
168  }
169 
170  if (unicode)
171  return DefWindowProcW(hwnd, msg, wParam, lParam);
172  return DefWindowProcA(hwnd, msg, wParam, lParam);
173 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define FNID_DESTROY
Definition: ntuser.h:859
#define WM_NCCREATE
Definition: winuser.h:1665
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
DWORD fnid
Definition: ntuser.h:673
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define WM_NCDESTROY
Definition: winuser.h:1666
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ERR(fmt,...)
Definition: debug.h:110
Definition: ntuser.h:657
struct _IMEWND * PIMEWND
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define msg(x)
Definition: auth_time.c:54
#define WM_CREATE
Definition: winuser.h:1590
BOOL NTAPI NtUserSetWindowFNID(HWND hWnd, WORD fnID)
Definition: window.c:4069
#define SetWindowLongPtrW
Definition: winuser.h:5321
LPARAM lParam
Definition: combotst.c:139
#define HeapFree(x, y, z)
Definition: compat.h:483
#define FNID_IME
Definition: ntuser.h:836

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

◆ ImeWndProcA()

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

Definition at line 175 of file imm.c.

176 {
178 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT WINAPI ImeWndProc_common(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:124
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
#define msg(x)
Definition: auth_time.c:54
LPARAM lParam
Definition: combotst.c:139

Referenced by RegisterClientPFN().

◆ ImeWndProcW()

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

Definition at line 180 of file imm.c.

181 {
183 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
LRESULT WINAPI ImeWndProc_common(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:124
WPARAM wParam
Definition: combotst.c:138
#define msg(x)
Definition: auth_time.c:54
LPARAM lParam
Definition: combotst.c:139

Referenced by RegisterClientPFN(), and RegisterIMEClass().

◆ IMPGetIMEA()

BOOL WINAPI IMPGetIMEA ( HWND  hwnd,
LPIMEPROA  ime 
)

Definition at line 306 of file imm.c.

307 {
308  return IMM_FN(ImmIMPGetIMEA)(hwnd, ime);
309 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IMM_FN(name)
Definition: user32p.h:57

◆ IMPGetIMEW()

BOOL WINAPI IMPGetIMEW ( HWND  hwnd,
LPIMEPROW  ime 
)

Definition at line 276 of file imm.c.

277 {
278  return IMM_FN(ImmIMPGetIMEW)(hwnd, ime);
279 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IMM_FN(name)
Definition: user32p.h:57

◆ IMPQueryIMEA()

BOOL WINAPI IMPQueryIMEA ( LPIMEPROA  ime)

Definition at line 296 of file imm.c.

297 {
298  return IMM_FN(ImmIMPQueryIMEA)(ime);
299 }
#define IMM_FN(name)
Definition: user32p.h:57

◆ IMPQueryIMEW()

BOOL WINAPI IMPQueryIMEW ( LPIMEPROW  ime)

Definition at line 266 of file imm.c.

267 {
268  return IMM_FN(ImmIMPQueryIMEW)(ime);
269 }
#define IMM_FN(name)
Definition: user32p.h:57

◆ IMPSetIMEA()

BOOL WINAPI IMPSetIMEA ( HWND  hwnd,
LPIMEPROA  ime 
)

Definition at line 286 of file imm.c.

287 {
288  return IMM_FN(ImmIMPSetIMEA)(hwnd, ime);
289 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IMM_FN(name)
Definition: user32p.h:57

◆ IMPSetIMEW()

BOOL WINAPI IMPSetIMEW ( HWND  hwnd,
LPIMEPROW  ime 
)

Definition at line 256 of file imm.c.

257 {
258  return IMM_FN(ImmIMPSetIMEW)(hwnd, ime);
259 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IMM_FN(name)
Definition: user32p.h:57

◆ InitializeImmEntryTable()

BOOL WINAPI InitializeImmEntryTable ( VOID  )

Definition at line 91 of file imm.c.

92 {
95 }
#define TRUE
Definition: types.h:120
BOOL WINAPI IntInitializeImmEntryTable(VOID)
Definition: imm.c:53
BOOL bImmInitializing
Definition: imm.c:20

Referenced by DllMain().

◆ IntInitializeImmEntryTable()

BOOL WINAPI IntInitializeImmEntryTable ( VOID  )

Definition at line 53 of file imm.c.

54 {
55  WCHAR ImmFile[MAX_PATH];
56  HMODULE imm32 = ghImm32;
57 
58  GetImmFileName(ImmFile, sizeof(ImmFile));
59  TRACE("File %ws\n",ImmFile);
60 
61  if (imm32 == NULL)
62  {
63  imm32 = GetModuleHandleW(ImmFile);
64  }
65 
66  if (imm32 == NULL)
67  {
68  imm32 = ghImm32 = LoadLibraryW(ImmFile);
69  if (imm32 == NULL)
70  {
71  ERR("Did not load!\n");
72  return FALSE;
73  }
74  return TRUE;
75  }
76 
77 /* load imm procedures */
78 #undef DEFINE_IMM_ENTRY
79 #define DEFINE_IMM_ENTRY(type, name, params, retval, retkind) \
80  do { \
81  FN_##name proc = (FN_##name)GetProcAddress(imm32, #name); \
82  if (proc) { \
83  IMM_FN(name) = proc; \
84  } \
85  } while (0);
86 #include "immtable.h"
87 
88  return TRUE;
89 }
HRESULT WINAPI GetImmFileName(PWSTR lpBuffer, UINT uSize)
Definition: imm.c:36
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define LoadLibraryW(x)
Definition: compat.h:495
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define ERR(fmt,...)
Definition: debug.h:110
HINSTANCE ghImm32
Definition: imm.c:19
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838

Referenced by InitializeImmEntryTable(), and User32InitializeImmEntryTable().

◆ RegisterIMEClass()

BOOL WINAPI RegisterIMEClass ( VOID  )

Definition at line 213 of file imm.c.

214 {
216  ATOM atom;
217 
218  ZeroMemory(&WndClass, sizeof(WndClass));
219 
220  WndClass.cbSize = sizeof(WndClass);
221  WndClass.lpszClassName = imeW;
222  WndClass.style = CS_GLOBALCLASS;
223  WndClass.lpfnWndProc = ImeWndProcW;
224  WndClass.cbWndExtra = sizeof(LONG_PTR);
225  WndClass.hCursor = LoadCursorW(NULL, IDC_ARROW);
226 
227  atom = RegisterClassExWOWW( &WndClass,
228  0,
229  FNID_IME,
230  0,
231  FALSE);
232  if (atom)
233  {
235  TRACE("Register IME Class!\n");
236  return TRUE;
237  }
238  ERR("Failed to register IME Class!\n");
239  return FALSE;
240 }
#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:180
#define ZeroMemory
Definition: winbase.h:1648
ATOM WINAPI RegisterClassExWOWW(WNDCLASSEXW *, LPDWORD, WORD, DWORD, BOOL)
Definition: class.c:1411
#define FALSE
Definition: types.h:117
static const WCHAR imeW[]
Definition: imm.c:209
smooth NULL
Definition: ftsmooth.c:416
#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:888
#define ERR(fmt,...)
Definition: debug.h:110
#define IDC_ARROW
Definition: winuser.h:682
#define ICLASS_TO_MASK(iCls)
Definition: ntuser.h:863
DWORD RegisterDefaultClasses
Definition: regcontrol.c:13
WCHAR WndClass[]
Definition: capicon.c:23
#define FNID_IME
Definition: ntuser.h:836

Referenced by RegisterSystemControls().

◆ SendIMEMessageExA()

LRESULT WINAPI SendIMEMessageExA ( HWND  hwnd,
LPARAM  lParam 
)

Definition at line 326 of file imm.c.

327 {
328  return IMM_FN(ImmSendIMEMessageExA)(hwnd, lParam);
329 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LPARAM lParam
Definition: combotst.c:139
#define IMM_FN(name)
Definition: user32p.h:57

◆ SendIMEMessageExW()

LRESULT WINAPI SendIMEMessageExW ( HWND  hwnd,
LPARAM  lParam 
)

Definition at line 316 of file imm.c.

317 {
318  return IMM_FN(ImmSendIMEMessageExW)(hwnd, lParam);
319 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LPARAM lParam
Definition: combotst.c:139
#define IMM_FN(name)
Definition: user32p.h:57

◆ UpdatePerUserImmEnabling()

BOOL WINAPI UpdatePerUserImmEnabling ( VOID  )

Definition at line 187 of file imm.c.

188 {
190  if ( Ret )
191  {
192  if ( gpsi->dwSRVIFlags & SRVINFO_IMM32 )
193  {
194  HMODULE imm32 = GetModuleHandleW(L"imm32.dll");
195  if ( !imm32 )
196  {
197  imm32 = LoadLibraryW(L"imm32.dll");
198  if (!imm32)
199  {
200  ERR("UPUIE: Imm32 not installed!\n");
201  Ret = FALSE;
202  }
203  }
204  }
205  }
206  return Ret;
207 }
PSERVERINFO gpsi
Definition: main.c:27
#define FALSE
Definition: types.h:117
DWORD dwSRVIFlags
Definition: ntuser.h:1004
unsigned int BOOL
Definition: ntddk_ex.h:94
#define LoadLibraryW(x)
Definition: compat.h:495
static const WCHAR L[]
Definition: oid.c:1250
DWORD_PTR NTAPI NtUserCallNoParam(DWORD Routine)
Definition: simplecall.c:59
#define ERR(fmt,...)
Definition: debug.h:110
#define SRVINFO_IMM32
Definition: ntuser.h:910
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838

Referenced by UpdatePerUserSystemParameters().

◆ User32InitializeImmEntryTable()

BOOL WINAPI User32InitializeImmEntryTable ( DWORD  magic)

Definition at line 97 of file imm.c.

98 {
99  TRACE("Imm (%x)\n", magic);
100 
101  if (magic != IMM_INIT_MAGIC)
102  return FALSE;
103 
104  if (IMM_FN(ImmIsIME) != IMMSTUB_ImmIsIME)
105  return TRUE;
106 
108 
109  if (ghImm32 == NULL && !bImmInitializing)
110  {
111  WCHAR ImmFile[MAX_PATH];
112  GetImmFileName(ImmFile, sizeof(ImmFile));
113  ghImm32 = LoadLibraryW(ImmFile);
114  if (ghImm32 == NULL)
115  {
116  ERR("Did not load! 2\n");
117  return FALSE;
118  }
119  }
120 
121  return TRUE;
122 }
HRESULT WINAPI GetImmFileName(PWSTR lpBuffer, UINT uSize)
Definition: imm.c:36
#define TRUE
Definition: types.h:120
u32_t magic(void)
BOOL WINAPI ImmIsIME(HKL hKL)
Definition: imm.c:2143
#define FALSE
Definition: types.h:117
#define LoadLibraryW(x)
Definition: compat.h:495
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI IntInitializeImmEntryTable(VOID)
Definition: imm.c:53
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define ERR(fmt,...)
Definition: debug.h:110
HINSTANCE ghImm32
Definition: imm.c:19
BOOL bImmInitializing
Definition: imm.c:20
#define IMM_INIT_MAGIC
Definition: imm.c:17
#define IMM_FN(name)
Definition: user32p.h:57

Referenced by DllMain().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( user32  )

◆ WINNLSEnableIME()

BOOL WINAPI WINNLSEnableIME ( HWND  hwnd,
BOOL  enable 
)

Definition at line 336 of file imm.c.

337 {
338  return IMM_FN(ImmWINNLSEnableIME)(hwnd, enable);
339 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
GLboolean enable
Definition: glext.h:11120
#define IMM_FN(name)
Definition: user32p.h:57

◆ WINNLSGetEnableStatus()

BOOL WINAPI WINNLSGetEnableStatus ( HWND  hwnd)

Definition at line 346 of file imm.c.

347 {
348  return IMM_FN(ImmWINNLSGetEnableStatus)(hwnd);
349 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IMM_FN(name)
Definition: user32p.h:57

◆ WINNLSGetIMEHotkey()

UINT WINAPI WINNLSGetIMEHotkey ( HWND  hwnd)

Definition at line 356 of file imm.c.

357 {
358  return FALSE;
359 }
#define FALSE
Definition: types.h:117

Variable Documentation

◆ bImmInitializing

BOOL bImmInitializing = FALSE

Definition at line 20 of file imm.c.

Referenced by InitializeImmEntryTable(), and User32InitializeImmEntryTable().

◆ ghImm32

HINSTANCE ghImm32 = NULL

Definition at line 19 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 28 of file imm.c.

◆ imeW

const WCHAR imeW[] = {'I','M','E',0}
static

Definition at line 209 of file imm.c.

Referenced by is_ime_window_proc(), and RegisterIMEClass().