ReactOS 0.4.15-dev-8102-g108db8f
ime.c File Reference
#include "precomp.h"
#include <imetable.h>
Include dependency graph for ime.c:

Go to the source code of this file.

Classes

struct  tagIMEMENUITEM
 
struct  tagIMEMENU
 

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)
 
#define DEFINE_IME_ENTRY(type, name, params, optional)   pImeDpi->name = Stub##name;
 
#define DEFINE_IME_ENTRY(type, name, params, optional)
 
#define MAX_IMEMENU_BITMAP_BYTES   0xF00
 

Typedefs

typedef struct tagIMEMENUITEM IMEMENUITEM
 
typedef struct tagIMEMENUITEMPIMEMENUITEM
 
typedef struct tagIMEMENU IMEMENU
 
typedef struct tagIMEMENUPIMEMENU
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (imm)
 
PIMEDPI APIENTRY Imm32FindImeDpi (HKL hKL)
 
VOID APIENTRY Imm32FreeIME (PIMEDPI pImeDpi, BOOL bDestroy)
 
BOOL APIENTRY Imm32InquireIme (PIMEDPI pImeDpi)
 
BOOL APIENTRY Imm32LoadIME (PIMEINFOEX pImeInfoEx, PIMEDPI pImeDpi)
 
PIMEDPI APIENTRY Imm32LoadImeDpi (HKL hKL, BOOL bLock)
 
PIMEDPI APIENTRY Imm32FindOrLoadImeDpi (HKL hKL)
 
static LRESULT APIENTRY ImeDpi_Escape (PIMEDPI pImeDpi, HIMC hIMC, UINT uSubFunc, LPVOID lpData, HKL hKL)
 
BOOL APIENTRY Imm32ReleaseIME (HKL hKL)
 
LRESULT WINAPI ImmPutImeMenuItemsIntoMappedFile (HIMC hIMC)
 
DWORD APIENTRY Imm32GetImeMenuItemWInterProcess (HIMC hIMC, DWORD dwFlags, DWORD dwType, LPVOID lpImeParentMenu, LPVOID lpImeMenu, DWORD dwSize)
 
DWORD APIENTRY ImmGetImeMenuItemsAW (HIMC hIMC, DWORD dwFlags, DWORD dwType, LPVOID lpImeParentMenu, LPVOID lpImeMenu, DWORD dwSize, BOOL bTargetIsAnsi)
 
HKL WINAPI ImmInstallIMEA (LPCSTR lpszIMEFileName, LPCSTR lpszLayoutText)
 
HKL WINAPI ImmInstallIMEW (LPCWSTR lpszIMEFileName, LPCWSTR lpszLayoutText)
 
BOOL WINAPI ImmIsIME (HKL hKL)
 
HWND WINAPI ImmGetDefaultIMEWnd (HWND hWnd)
 
BOOL WINAPI ImmNotifyIME (HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD_PTR dwValue)
 
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)
 
BOOL WINAPI ImmWINNLSEnableIME (HWND hWnd, BOOL enable)
 

Variables

RTL_CRITICAL_SECTION gcsImeDpi
 
PIMEDPI gpImeDpiList = NULL
 

Macro Definition Documentation

◆ DEFINE_IME_ENTRY [1/3]

#define DEFINE_IME_ENTRY (   type,
  name,
  params,
  optional 
)
Value:
FIXME("%s: Why stub called?\n", #name); \
return (type)0; \
}
#define APIENTRY
Definition: api.h:79
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum const GLfloat * params
Definition: glext.h:5645
Definition: name.c:39

Definition at line 189 of file ime.c.

◆ DEFINE_IME_ENTRY [2/3]

#define DEFINE_IME_ENTRY (   type,
  name,
  params,
  optional 
)    pImeDpi->name = Stub##name;

Definition at line 189 of file ime.c.

◆ DEFINE_IME_ENTRY [3/3]

#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 IME module '%s'.\n", #name, debugstr_w(szPath)); \
goto Failed; \
} \
} while (0);
@ optional
Definition: SystemMenu.c:34
#define GetProcAddress(x, y)
Definition: compat.h:753
#define debugstr_w
Definition: kernel32.h:32
LPCWSTR szPath
Definition: env.c:37
@ Failed
Definition: arc.h:79
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159

Definition at line 189 of file ime.c.

◆ MAX_IMEMENU_BITMAP_BYTES

#define MAX_IMEMENU_BITMAP_BYTES   0xF00

Definition at line 421 of file ime.c.

◆ VALID_CMODE_CAPS

#define VALID_CMODE_CAPS
Value:
#define IME_CMODE_KATAKANA
Definition: imm.h:343
#define IME_CMODE_ROMAN
Definition: imm.h:346
#define IME_CMODE_NATIVE
Definition: imm.h:337
#define IME_CMODE_LANGUAGE
Definition: imm.h:344
#define IME_CMODE_SYMBOL
Definition: imm.h:352
#define IME_CMODE_HANJACONVERT
Definition: imm.h:348
#define IME_CMODE_EUDC
Definition: imm.h:351
#define IME_CMODE_SOFTKBD
Definition: imm.h:349
#define IME_CMODE_NOCONVERSION
Definition: imm.h:350
#define IME_CMODE_FIXED
Definition: imm.h:353
#define IME_CMODE_CHARCODE
Definition: imm.h:347
#define IME_CMODE_ALPHANUMERIC
Definition: imm.h:336
#define IME_CMODE_FULLSHAPE
Definition: imm.h:345

◆ VALID_IME_PROP

#define VALID_IME_PROP
Value:
#define IME_PROP_CANDLIST_START_FROM_1
Definition: imm.h:248
#define IME_PROP_AT_CARET
Definition: imm.h:246
#define IME_PROP_UNICODE
Definition: imm.h:249
#define IME_PROP_SPECIAL_UI
Definition: imm.h:247
#define IME_PROP_COMPLETE_ON_UNSELECT
Definition: imm.h:250
#define IME_PROP_ACCEPT_WIDE_VKEY
Definition: immdev.h:389
#define IME_PROP_NEED_ALTKEY
Definition: immdev.h:387
#define IME_PROP_NO_KEYS_ON_CLOSE
Definition: immdev.h:388
#define IME_PROP_END_UNLOAD
Definition: immdev.h:384
#define IME_PROP_KBD_CHAR_FIRST
Definition: immdev.h:385
#define IME_PROP_IGNORE_UPKEYS
Definition: immdev.h:386

◆ VALID_SCS_CAPS

#define VALID_SCS_CAPS
Value:
#define SCS_CAP_COMPSTR
Definition: imm.h:259
#define SCS_CAP_SETRECONVERTSTRING
Definition: imm.h:261
#define SCS_CAP_MAKEREAD
Definition: imm.h:260

◆ VALID_SELECT_CAPS

#define VALID_SELECT_CAPS   (SELECT_CAP_CONVERSION | SELECT_CAP_SENTENCE)

◆ VALID_SMODE_CAPS

#define VALID_SMODE_CAPS
Value:
#define IME_SMODE_CONVERSATION
Definition: imm.h:361
#define IME_SMODE_PLAURALCLAUSE
Definition: imm.h:357
#define IME_SMODE_SINGLECONVERT
Definition: imm.h:358
#define IME_SMODE_PHRASEPREDICT
Definition: imm.h:360
#define IME_SMODE_AUTOMATIC
Definition: imm.h:359
#define IME_SMODE_NONE
Definition: imm.h:356

◆ VALID_UI_CAPS

#define VALID_UI_CAPS
Value:
#define UI_CAP_SOFTKBD
Definition: imm.h:256
#define UI_CAP_ROTANY
Definition: imm.h:255
#define UI_CAP_2700
Definition: imm.h:253
#define UI_CAP_ROT90
Definition: imm.h:254

Typedef Documentation

◆ IMEMENU

◆ IMEMENUITEM

◆ PIMEMENU

◆ PIMEMENUITEM

Function Documentation

◆ ImeDpi_Escape()

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

Definition at line 360 of file ime.c.

361{
362 if (IS_IME_HKL(hKL))
363 return pImeDpi->ImeEscape(hIMC, uSubFunc, lpData);
364 if (IS_CICERO_MODE() && !IS_16BIT_MODE())
365 return pImeDpi->CtfImeEscapeEx(hIMC, uSubFunc, lpData, hKL);
366
367 return 0;
368}
#define IS_IME_HKL(hKL)
Definition: imm32_undoc.h:20
#define IS_16BIT_MODE()
Definition: ntuser.h:1211
#define IS_CICERO_MODE()
Definition: ntuser.h:1210

Referenced by ImmEscapeA(), and ImmEscapeW().

◆ Imm32FindImeDpi()

PIMEDPI APIENTRY Imm32FindImeDpi ( HKL  hKL)

Definition at line 20 of file ime.c.

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

Referenced by Imm32LoadImeDpi(), and ImmLoadIME().

◆ Imm32FindOrLoadImeDpi()

PIMEDPI APIENTRY Imm32FindOrLoadImeDpi ( HKL  hKL)

Definition at line 343 of file ime.c.

344{
345 PIMEDPI pImeDpi;
346
347 if (!IS_IME_HKL(hKL) && (!IS_CICERO_MODE() || IS_16BIT_MODE()))
348 {
349 TRACE("\n");
350 return NULL;
351 }
352
353 pImeDpi = ImmLockImeDpi(hKL);
354 if (pImeDpi == NULL)
355 pImeDpi = Imm32LoadImeDpi(hKL, TRUE);
356 return pImeDpi;
357}
#define TRUE
Definition: types.h:120
PIMEDPI APIENTRY Imm32LoadImeDpi(HKL hKL, BOOL bLock)
Definition: ime.c:267
PIMEDPI WINAPI ImmLockImeDpi(HKL hKL)
Definition: ime.c:978
#define TRACE(s)
Definition: solgame.cpp:4

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

◆ Imm32FreeIME()

VOID APIENTRY Imm32FreeIME ( PIMEDPI  pImeDpi,
BOOL  bDestroy 
)

Definition at line 36 of file ime.c.

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

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

◆ Imm32GetImeMenuItemWInterProcess()

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

Definition at line 525 of file ime.c.

527{
528 HANDLE hMapping;
529 PIMEMENU pView;
530 DWORD i, cbView, dwItemCount, ret = 0;
531 HWND hImeWnd;
532 PIMEMENUITEM pGotItem;
533 LPIMEMENUITEMINFOW pSetInfo;
534
536 if (!hImeWnd || !IsWindow(hImeWnd))
537 {
538 ERR("\n");
539 return 0;
540 }
541
542 dwItemCount = (lpImeMenu ? (dwSize / sizeof(IMEMENUITEMINFOW)) : 0);
543 cbView = sizeof(IMEMENU) + ((size_t)dwItemCount - 1) * sizeof(IMEMENUITEM);
544
546
547 // create a file mapping
549 0, cbView, L"ImmMenuInfo");
550 pView = MapViewOfFile(hMapping, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0);
551 if (IS_NULL_UNEXPECTEDLY(pView))
552 goto Quit;
553
554 ZeroMemory(pView, cbView);
555 pView->dwVersion = 1;
556 pView->dwFlags = dwFlags;
557 pView->dwType = dwType;
558 pView->dwItemCount = dwItemCount;
559 if (lpImeParentMenu)
560 {
561 pView->Parent = *(LPIMEMENUITEMINFOW)lpImeParentMenu;
562 pView->Parent.cbSize = sizeof(IMEMENUITEMINFOW);
563 }
564
565 if (!SendMessageW(hImeWnd, WM_IME_SYSTEM, IMS_GETIMEMENU, (LPARAM)hIMC))
566 {
567 ERR("\n");
568 goto Quit;
569 }
570
571 ret = pView->dwItemCount;
572
573 if (!lpImeMenu)
574 goto Quit;
575
576 for (i = 0; i < ret; ++i)
577 {
578 pGotItem = &(pView->Items[i]);
579 pSetInfo = &((LPIMEMENUITEMINFOW)lpImeMenu)[i];
580
581 *pSetInfo = pGotItem->Info;
582
583 // load bitmaps from bytes
584 if (pSetInfo->hbmpChecked)
585 {
586 pSetInfo->hbmpChecked = Imm32LoadBitmapFromBytes(pGotItem->abChecked);
587 }
588 if (pSetInfo->hbmpUnchecked)
589 {
590 pSetInfo->hbmpUnchecked = Imm32LoadBitmapFromBytes(pGotItem->abUnchecked);
591 }
592 if (pSetInfo->hbmpItem)
593 {
594 pSetInfo->hbmpItem = Imm32LoadBitmapFromBytes(pGotItem->abItem);
595 }
596 }
597
598Quit:
600 if (pView)
601 UnmapViewOfFile(pView);
602 if (hMapping)
603 CloseHandle(hMapping);
604 return ret;
605}
#define ERR(fmt,...)
Definition: debug.h:113
#define CloseHandle
Definition: compat.h:739
#define UnmapViewOfFile
Definition: compat.h:746
HANDLE HWND
Definition: compat.h:19
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:744
#define FILE_MAP_READ
Definition: compat.h:776
#define MapViewOfFile
Definition: compat.h:745
struct tagIMEMENU IMEMENU
#define IS_NULL_UNEXPECTEDLY(p)
Definition: precomp.h:125
HBITMAP Imm32LoadBitmapFromBytes(const BYTE *pb)
Definition: utils.c:88
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define IMS_GETIMEMENU
Definition: immdev.h:111
DWORD_PTR NTAPI NtUserQueryInputContext(HIMC hIMC, DWORD dwType)
Definition: ime.c:1791
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define PAGE_READWRITE
Definition: nt_native.h:1304
#define L(x)
Definition: ntvdm.h:50
HBITMAP hbmpChecked
Definition: dimm.idl:134
BYTE abItem[MAX_IMEMENU_BITMAP_BYTES]
Definition: ime.c:428
BYTE abChecked[MAX_IMEMENU_BITMAP_BYTES]
Definition: ime.c:426
IMEMENUITEMINFOW Info
Definition: ime.c:425
BYTE abUnchecked[MAX_IMEMENU_BITMAP_BYTES]
Definition: ime.c:427
IMEMENUITEMINFOW Parent
Definition: ime.c:437
DWORD dwFlags
Definition: ime.c:434
DWORD dwVersion
Definition: ime.c:433
DWORD dwType
Definition: ime.c:435
DWORD dwItemCount
Definition: ime.c:436
IMEMENUITEM Items[ANYSIZE_ARRAY]
Definition: ime.c:438
@ QIC_DEFAULTWINDOWIME
Definition: undocuser.h:394
#define WM_IME_SYSTEM
Definition: undocuser.h:60
int ret
#define ZeroMemory
Definition: winbase.h:1712
#define FILE_MAP_WRITE
Definition: winbase.h:154
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI IsWindow(_In_opt_ HWND)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by ImmGetImeMenuItemsAW().

◆ Imm32InquireIme()

BOOL APIENTRY Imm32InquireIme ( PIMEDPI  pImeDpi)

Definition at line 47 of file ime.c.

48{
49 WCHAR szUIClass[64];
50 WNDCLASSW wcW;
51 DWORD dwSysInfoFlags = 0;
52 LPIMEINFO pImeInfo = &pImeDpi->ImeInfo;
53
55 dwSysInfoFlags |= IME_SYSINFO_WINLOGON;
56
57 if (GetWin32ClientInfo()->dwTIFlags & TIF_16BIT)
58 dwSysInfoFlags |= IME_SYSINFO_WOW16;
59
60 if (IS_IME_HKL(pImeDpi->hKL))
61 {
62 if (!pImeDpi->ImeInquire(pImeInfo, szUIClass, dwSysInfoFlags))
63 {
64 ERR("\n");
65 return FALSE;
66 }
67 }
68 else if (IS_CICERO_MODE() && !IS_16BIT_MODE())
69 {
70 if (pImeDpi->CtfImeInquireExW(pImeInfo, szUIClass, dwSysInfoFlags, pImeDpi->hKL) != S_OK)
71 {
72 ERR("\n");
73 return FALSE;
74 }
75 }
76 else
77 {
78 ERR("\n");
79 return FALSE;
80 }
81
82 szUIClass[_countof(szUIClass) - 1] = UNICODE_NULL; /* Avoid buffer overrun */
83
84 if (pImeInfo->dwPrivateDataSize < sizeof(DWORD))
85 pImeInfo->dwPrivateDataSize = sizeof(DWORD);
86
87#define VALID_IME_PROP (IME_PROP_AT_CARET | \
88 IME_PROP_SPECIAL_UI | \
89 IME_PROP_CANDLIST_START_FROM_1 | \
90 IME_PROP_UNICODE | \
91 IME_PROP_COMPLETE_ON_UNSELECT | \
92 IME_PROP_END_UNLOAD | \
93 IME_PROP_KBD_CHAR_FIRST | \
94 IME_PROP_IGNORE_UPKEYS | \
95 IME_PROP_NEED_ALTKEY | \
96 IME_PROP_NO_KEYS_ON_CLOSE | \
97 IME_PROP_ACCEPT_WIDE_VKEY)
98#define VALID_CMODE_CAPS (IME_CMODE_ALPHANUMERIC | \
99 IME_CMODE_NATIVE | \
100 IME_CMODE_KATAKANA | \
101 IME_CMODE_LANGUAGE | \
102 IME_CMODE_FULLSHAPE | \
103 IME_CMODE_ROMAN | \
104 IME_CMODE_CHARCODE | \
105 IME_CMODE_HANJACONVERT | \
106 IME_CMODE_SOFTKBD | \
107 IME_CMODE_NOCONVERSION | \
108 IME_CMODE_EUDC | \
109 IME_CMODE_SYMBOL | \
110 IME_CMODE_FIXED)
111#define VALID_SMODE_CAPS (IME_SMODE_NONE | \
112 IME_SMODE_PLAURALCLAUSE | \
113 IME_SMODE_SINGLECONVERT | \
114 IME_SMODE_AUTOMATIC | \
115 IME_SMODE_PHRASEPREDICT | \
116 IME_SMODE_CONVERSATION)
117#define VALID_UI_CAPS (UI_CAP_2700 | \
118 UI_CAP_ROT90 | \
119 UI_CAP_ROTANY | \
120 UI_CAP_SOFTKBD)
121#define VALID_SCS_CAPS (SCS_CAP_COMPSTR | \
122 SCS_CAP_MAKEREAD | \
123 SCS_CAP_SETRECONVERTSTRING)
124#define VALID_SELECT_CAPS (SELECT_CAP_CONVERSION | SELECT_CAP_SENTENCE)
125
126 if (pImeInfo->fdwProperty & ~VALID_IME_PROP)
127 {
128 ERR("Bad flags\n");
129 return FALSE;
130 }
131 if (pImeInfo->fdwConversionCaps & ~VALID_CMODE_CAPS)
132 {
133 ERR("Bad flags\n");
134 return FALSE;
135 }
136 if (pImeInfo->fdwSentenceCaps & ~VALID_SMODE_CAPS)
137 {
138 ERR("Bad flags\n");
139 return FALSE;
140 }
141 if (pImeInfo->fdwUICaps & ~VALID_UI_CAPS)
142 {
143 ERR("Bad flags\n");
144 return FALSE;
145 }
146 if (pImeInfo->fdwSCSCaps & ~VALID_SCS_CAPS)
147 {
148 ERR("Bad flags\n");
149 return FALSE;
150 }
151 if (pImeInfo->fdwSelectCaps & ~VALID_SELECT_CAPS)
152 {
153 ERR("Bad flags\n");
154 return FALSE;
155 }
156
157#undef VALID_IME_PROP
158#undef VALID_CMODE_CAPS
159#undef VALID_SMODE_CAPS
160#undef VALID_UI_CAPS
161#undef VALID_SCS_CAPS
162#undef VALID_SELECT_CAPS
163
164 if (pImeInfo->fdwProperty & IME_PROP_UNICODE)
165 {
166 StringCchCopyW(pImeDpi->szUIClass, _countof(pImeDpi->szUIClass), szUIClass);
167 }
168 else
169 {
170 if (pImeDpi->uCodePage != GetACP() && pImeDpi->uCodePage != CP_ACP)
171 return FALSE;
172
174 pImeDpi->szUIClass, _countof(pImeDpi->szUIClass));
175
176 pImeDpi->szUIClass[_countof(pImeDpi->szUIClass) - 1] = UNICODE_NULL;
177 }
178
179 if (!GetClassInfoW(pImeDpi->hInst, pImeDpi->szUIClass, &wcW))
180 {
181 ERR("\n");
182 return FALSE;
183 }
184
185 return TRUE;
186}
#define FALSE
Definition: types.h:117
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
#define VALID_IME_PROP
#define VALID_SELECT_CAPS
#define VALID_SCS_CAPS
#define VALID_SMODE_CAPS
#define VALID_UI_CAPS
#define VALID_CMODE_CAPS
UINT WINAPI GetACP(void)
Definition: locale.c:2020
#define IME_SYSINFO_WINLOGON
Definition: immdev.h:409
#define IME_SYSINFO_WOW16
Definition: immdev.h:410
@ THREADSTATE_ISWINLOGON2
Definition: ntuser.h:2488
#define TIF_16BIT
Definition: ntuser.h:264
#define GetWin32ClientInfo()
Definition: ntuser.h:352
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:240
#define S_OK
Definition: intsafe.h:52
#define DWORD
Definition: nt_native.h:44
#define UNICODE_NULL
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
IMEINFO ImeInfo
Definition: imm32_undoc.h:63
WCHAR szUIClass[16]
Definition: imm32_undoc.h:65
UINT uCodePage
Definition: imm32_undoc.h:64
DWORD fdwSelectCaps
Definition: immdev.h:27
DWORD fdwSentenceCaps
Definition: immdev.h:24
DWORD fdwConversionCaps
Definition: immdev.h:23
DWORD fdwSCSCaps
Definition: immdev.h:26
DWORD fdwProperty
Definition: immdev.h:22
DWORD dwPrivateDataSize
Definition: immdev.h:21
DWORD fdwUICaps
Definition: immdev.h:25
#define MB_PRECOMPOSED
Definition: winnls.h:281
BOOL WINAPI GetClassInfoW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _Out_ LPWNDCLASSW)
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by Imm32LoadIME().

◆ Imm32LoadIME()

BOOL APIENTRY Imm32LoadIME ( PIMEINFOEX  pImeInfoEx,
PIMEDPI  pImeDpi 
)

Definition at line 198 of file ime.c.

199{
201 HINSTANCE hIME;
202 FARPROC fn;
203 BOOL ret = FALSE;
204
206 return FALSE;
207
208 pImeDpi->hInst = hIME = LoadLibraryW(szPath);
209 if (hIME == NULL)
210 {
211 ERR("LoadLibraryW(%s) failed\n", debugstr_w(szPath));
212 return FALSE;
213 }
214
215 /* Populate the table by stub IME functions */
216#define DEFINE_IME_ENTRY(type, name, params, optional) pImeDpi->name = Stub##name;
217#include <imetable.h>
218#undef DEFINE_IME_ENTRY
219
220 /* Populate the table by real IME functions */
221#define DEFINE_IME_ENTRY(type, name, params, optional) \
222 do { \
223 fn = GetProcAddress(hIME, #name); \
224 if (fn) pImeDpi->name = (FN_##name)fn; \
225 else if (!(optional)) { \
226 ERR("'%s' not found in IME module '%s'.\n", #name, debugstr_w(szPath)); \
227 goto Failed; \
228 } \
229 } while (0);
230#include <imetable.h>
231#undef DEFINE_IME_ENTRY
232
233 if (Imm32InquireIme(pImeDpi))
234 {
235 ret = TRUE;
236 }
237 else
238 {
239Failed:
240 ret = FALSE;
241 FreeLibrary(pImeDpi->hInst);
242 pImeDpi->hInst = NULL;
243 }
244
245 if (pImeInfoEx->fLoadFlag == 0)
246 {
247 if (ret)
248 {
249 C_ASSERT(sizeof(pImeInfoEx->wszUIClass) == sizeof(pImeDpi->szUIClass));
250 pImeInfoEx->ImeInfo = pImeDpi->ImeInfo;
251 RtlCopyMemory(pImeInfoEx->wszUIClass, pImeDpi->szUIClass,
252 sizeof(pImeInfoEx->wszUIClass));
253 pImeInfoEx->fLoadFlag = 2;
254 }
255 else
256 {
257 pImeInfoEx->fLoadFlag = 1;
258 }
259
260 NtUserSetImeInfoEx(pImeInfoEx);
261 }
262
263 return ret;
264}
int(* FARPROC)()
Definition: compat.h:36
#define MAX_PATH
Definition: compat.h:34
#define LoadLibraryW(x)
Definition: compat.h:747
BOOL APIENTRY Imm32InquireIme(PIMEDPI pImeDpi)
Definition: ime.c:47
BOOL Imm32GetSystemLibraryPath(LPWSTR pszPath, DWORD cchPath, LPCWSTR pszFileName)
Definition: utils.c:286
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL NTAPI NtUserSetImeInfoEx(PIMEINFOEX pImeInfoEx)
Definition: ime.c:1126
#define C_ASSERT(e)
Definition: intsafe.h:73
IMEINFO ImeInfo
Definition: imm32_undoc.h:30
WCHAR wszImeFile[80]
Definition: imm32_undoc.h:38
WCHAR wszUIClass[16]
Definition: imm32_undoc.h:31
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263

Referenced by Imm32LoadImeDpi().

◆ Imm32LoadImeDpi()

PIMEDPI APIENTRY Imm32LoadImeDpi ( HKL  hKL,
BOOL  bLock 
)

Definition at line 267 of file ime.c.

268{
269 IMEINFOEX ImeInfoEx;
270 CHARSETINFO ci;
271 PIMEDPI pImeDpiNew, pImeDpiFound;
272 UINT uCodePage;
273 LCID lcid;
274
275 if (!IS_IME_HKL(hKL))
276 {
277 TRACE("\n");
278 return NULL;
279 }
280
281 if (!ImmGetImeInfoEx(&ImeInfoEx, ImeInfoExKeyboardLayout, &hKL))
282 {
283 ERR("\n");
284 return NULL;
285 }
286
287 if (ImeInfoEx.fLoadFlag == 1)
288 {
289 ERR("\n");
290 return NULL;
291 }
292
293 pImeDpiNew = ImmLocalAlloc(HEAP_ZERO_MEMORY, sizeof(IMEDPI));
294 if (IS_NULL_UNEXPECTEDLY(pImeDpiNew))
295 return NULL;
296
297 pImeDpiNew->hKL = hKL;
298
299 lcid = LOWORD(hKL);
301 uCodePage = ci.ciACP;
302 else
303 uCodePage = CP_ACP;
304 pImeDpiNew->uCodePage = uCodePage;
305
306 if (!Imm32LoadIME(&ImeInfoEx, pImeDpiNew))
307 {
308 ERR("\n");
309 ImmLocalFree(pImeDpiNew);
310 return FALSE;
311 }
312
314
315 pImeDpiFound = Imm32FindImeDpi(hKL);
316 if (pImeDpiFound)
317 {
318 if (!bLock)
319 pImeDpiFound->dwFlags &= ~IMEDPI_FLAG_LOCKED;
320
322 Imm32FreeIME(pImeDpiNew, FALSE);
323 ImmLocalFree(pImeDpiNew);
324 return pImeDpiFound;
325 }
326 else
327 {
328 if (bLock)
329 {
330 pImeDpiNew->dwFlags |= IMEDPI_FLAG_LOCKED;
331 pImeDpiNew->cLockObj = 1;
332 }
333
334 pImeDpiNew->pNext = gpImeDpiList;
335 gpImeDpiList = pImeDpiNew;
336
338 return pImeDpiNew;
339 }
340}
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
PIMEDPI APIENTRY Imm32FindImeDpi(HKL hKL)
Definition: ime.c:20
VOID APIENTRY Imm32FreeIME(PIMEDPI pImeDpi, BOOL bDestroy)
Definition: ime.c:36
BOOL APIENTRY Imm32LoadIME(PIMEINFOEX pImeInfoEx, PIMEDPI pImeDpi)
Definition: ime.c:198
BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey)
Definition: ime.c:932
LPVOID APIENTRY ImmLocalAlloc(DWORD dwFlags, DWORD dwBytes)
Definition: utils.c:415
#define ImmLocalFree(lpData)
Definition: precomp.h:89
#define IMEDPI_FLAG_LOCKED
Definition: imm32_undoc.h:108
@ ImeInfoExKeyboardLayout
Definition: imm32_undoc.h:48
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
DWORD LCID
Definition: nls.h:13
DWORD dwFlags
Definition: imm32_undoc.h:67
DWORD cLockObj
Definition: imm32_undoc.h:66
uint32_t DWORD_PTR
Definition: typedefs.h:65
uint32_t * LPDWORD
Definition: typedefs.h:59
#define TCI_SRCLOCALE
Definition: wingdi.h:964
BOOL WINAPI TranslateCharsetInfo(_Inout_ PDWORD, _Out_ LPCHARSETINFO, _In_ DWORD)

Referenced by Imm32FindOrLoadImeDpi(), and ImmLoadIME().

◆ Imm32ReleaseIME()

BOOL APIENTRY Imm32ReleaseIME ( HKL  hKL)

Definition at line 371 of file ime.c.

372{
373 BOOL ret = TRUE;
374 PIMEDPI pImeDpi0, pImeDpi1;
375
377
378 for (pImeDpi0 = gpImeDpiList; pImeDpi0; pImeDpi0 = pImeDpi0->pNext)
379 {
380 if (pImeDpi0->hKL == hKL)
381 break;
382 }
383
384 if (!pImeDpi0)
385 goto Quit;
386
387 if (pImeDpi0->cLockObj)
388 {
389 pImeDpi0->dwFlags |= IMEDPI_FLAG_UNLOADED;
390 ret = FALSE;
391 goto Quit;
392 }
393
394 if (gpImeDpiList == pImeDpi0)
395 {
396 gpImeDpiList = pImeDpi0->pNext;
397 }
398 else if (gpImeDpiList)
399 {
400 for (pImeDpi1 = gpImeDpiList; pImeDpi1; pImeDpi1 = pImeDpi1->pNext)
401 {
402 if (pImeDpi1->pNext == pImeDpi0)
403 {
404 pImeDpi1->pNext = pImeDpi0->pNext;
405 break;
406 }
407 }
408 }
409
410 Imm32FreeIME(pImeDpi0, TRUE);
411 ImmLocalFree(pImeDpi0);
412
413Quit:
415 return ret;
416}
#define IMEDPI_FLAG_UNLOADED
Definition: imm32_undoc.h:107

Referenced by ImmFreeLayout().

◆ ImmConfigureIMEA()

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

Definition at line 2000 of file ime.c.

2001{
2002 BOOL ret = FALSE;
2003 PIMEDPI pImeDpi;
2004 REGISTERWORDW RegWordW;
2005 LPREGISTERWORDA pRegWordA;
2006
2007 TRACE("(%p, %p, 0x%lX, %p)\n", hKL, hWnd, dwMode, lpData);
2008
2010 return FALSE;
2011
2012 pImeDpi = Imm32FindOrLoadImeDpi(hKL);
2013 if (IS_NULL_UNEXPECTEDLY(pImeDpi))
2014 return FALSE;
2015
2016 RtlZeroMemory(&RegWordW, sizeof(RegWordW));
2017
2018 if (!ImeDpi_IsUnicode(pImeDpi) || !lpData || dwMode != IME_CONFIG_REGISTERWORD)
2019 goto DoIt; /* No conversion needed */
2020
2021 pRegWordA = lpData;
2022
2023 if (pRegWordA->lpReading)
2024 {
2025 RegWordW.lpReading = Imm32WideFromAnsi(pImeDpi->uCodePage, pRegWordA->lpReading);
2026 if (IS_NULL_UNEXPECTEDLY(RegWordW.lpReading))
2027 goto Quit;
2028 }
2029
2030 if (pRegWordA->lpWord)
2031 {
2032 RegWordW.lpWord = Imm32WideFromAnsi(pImeDpi->uCodePage, pRegWordA->lpWord);
2033 if (IS_NULL_UNEXPECTEDLY(RegWordW.lpWord))
2034 goto Quit;
2035 }
2036
2037 lpData = &RegWordW;
2038
2039DoIt:
2040 SendMessageW(hWnd, WM_IME_SYSTEM, 0x1B, 0);
2041 ret = pImeDpi->ImeConfigure(hKL, hWnd, dwMode, lpData);
2042 SendMessageW(hWnd, WM_IME_SYSTEM, 0x1A, 0);
2043
2044Quit:
2045 ImmLocalFree(RegWordW.lpReading);
2046 ImmLocalFree(RegWordW.lpWord);
2047 ImmUnlockImeDpi(pImeDpi);
2048 TRACE("ret: %d\n", ret);
2049 return ret;
2050}
HWND hWnd
Definition: settings.c:17
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:1007
PIMEDPI APIENTRY Imm32FindOrLoadImeDpi(HKL hKL)
Definition: ime.c:343
#define ValidateHwnd(hwnd)
Definition: precomp.h:85
#define IS_CROSS_PROCESS_HWND(hWnd)
Definition: precomp.h:149
#define ImeDpi_IsUnicode(pImeDpi)
Definition: precomp.h:150
LPWSTR APIENTRY Imm32WideFromAnsi(UINT uCodePage, LPCSTR pszA)
Definition: utils.c:227
#define IME_CONFIG_REGISTERWORD
Definition: imm.h:406
LPWSTR lpWord
Definition: dimm.idl:36
LPWSTR lpReading
Definition: dimm.idl:35
LPSTR lpReading
Definition: imm.h:28
LPSTR lpWord
Definition: imm.h:29
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by ActiveIMMApp_ConfigureIMEA(), and test_ImmIME().

◆ ImmConfigureIMEW()

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

Definition at line 2055 of file ime.c.

2056{
2057 BOOL ret = FALSE;
2058 PIMEDPI pImeDpi;
2059 REGISTERWORDA RegWordA;
2060 LPREGISTERWORDW pRegWordW;
2061
2062 TRACE("(%p, %p, 0x%lX, %p)\n", hKL, hWnd, dwMode, lpData);
2063
2065 return FALSE;
2066
2067 pImeDpi = Imm32FindOrLoadImeDpi(hKL);
2068 if (IS_NULL_UNEXPECTEDLY(pImeDpi))
2069 return FALSE;
2070
2071 RtlZeroMemory(&RegWordA, sizeof(RegWordA));
2072
2073 if (ImeDpi_IsUnicode(pImeDpi) || !lpData || dwMode != IME_CONFIG_REGISTERWORD)
2074 goto DoIt; /* No conversion needed */
2075
2076 pRegWordW = lpData;
2077
2078 if (pRegWordW->lpReading)
2079 {
2080 RegWordA.lpReading = Imm32AnsiFromWide(pImeDpi->uCodePage, pRegWordW->lpReading);
2081 if (IS_NULL_UNEXPECTEDLY(RegWordA.lpReading))
2082 goto Quit;
2083 }
2084
2085 if (pRegWordW->lpWord)
2086 {
2087 RegWordA.lpWord = Imm32AnsiFromWide(pImeDpi->uCodePage, pRegWordW->lpWord);
2088 if (IS_NULL_UNEXPECTEDLY(RegWordA.lpWord))
2089 goto Quit;
2090 }
2091
2092 lpData = &RegWordA;
2093
2094DoIt:
2095 SendMessageW(hWnd, WM_IME_SYSTEM, 0x1B, 0);
2096 ret = pImeDpi->ImeConfigure(hKL, hWnd, dwMode, lpData);
2097 SendMessageW(hWnd, WM_IME_SYSTEM, 0x1A, 0);
2098
2099Quit:
2100 ImmLocalFree(RegWordA.lpReading);
2101 ImmLocalFree(RegWordA.lpWord);
2102 ImmUnlockImeDpi(pImeDpi);
2103 TRACE("ret: %d\n", ret);
2104 return ret;
2105}
LPSTR APIENTRY Imm32AnsiFromWide(UINT uCodePage, LPCWSTR pszW)
Definition: utils.c:238
LPSTR lpReading
Definition: dimm.idl:30
LPSTR lpWord
Definition: dimm.idl:31
LPWSTR lpReading
Definition: imm.h:33
LPWSTR lpWord
Definition: imm.h:34

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

◆ ImmDisableIME()

BOOL WINAPI ImmDisableIME ( DWORD  dwThreadId)

Definition at line 1074 of file ime.c.

1075{
1077}
DWORD dwThreadId
Definition: fdebug.c:31
BOOL NTAPI NtUserDisableThreadIme(DWORD dwThreadID)
Definition: ime.c:852

Referenced by ActiveIMMApp_DisableIME(), and test_default_ime_disabled_cb().

◆ ImmEscapeA()

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

Definition at line 1277 of file ime.c.

1278{
1279 LRESULT ret;
1280 PIMEDPI pImeDpi;
1281 INT cch;
1284
1285 TRACE("(%p, %p, %u, %p)\n", hKL, hIMC, uSubFunc, lpData);
1286
1287 pImeDpi = Imm32FindOrLoadImeDpi(hKL);
1288 if (IS_NULL_UNEXPECTEDLY(pImeDpi))
1289 return 0;
1290
1291 if (!ImeDpi_IsUnicode(pImeDpi) || !lpData) /* No conversion needed */
1292 {
1293 ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
1294 ImmUnlockImeDpi(pImeDpi);
1295 return ret;
1296 }
1297
1298 switch (uSubFunc)
1299 {
1301 ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
1302
1303 cch = 0;
1304 if (HIWORD(ret))
1305 szW[cch++] = HIWORD(ret);
1306 if (LOWORD(ret))
1307 szW[cch++] = LOWORD(ret);
1308
1309 cch = WideCharToMultiByte(pImeDpi->uCodePage, 0, szW, cch, szA, _countof(szA),
1310 NULL, NULL);
1311 switch (cch)
1312 {
1313 case 1:
1314 ret = MAKEWORD(szA[0], 0);
1315 break;
1316 case 2:
1317 ret = MAKEWORD(szA[1], szA[0]);
1318 break;
1319 case 3:
1320 ret = MAKELONG(MAKEWORD(szA[2], szA[1]), MAKEWORD(szA[0], 0));
1321 break;
1322 case 4:
1323 ret = MAKELONG(MAKEWORD(szA[3], szA[2]), MAKEWORD(szA[1], szA[0]));
1324 break;
1325 default:
1326 ret = 0;
1327 break;
1328 }
1329 break;
1330
1332 case IME_ESC_IME_NAME:
1334 ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, szW, hKL);
1335 if (ret)
1336 {
1337 szW[_countof(szW) - 1] = UNICODE_NULL; /* Avoid buffer overrun */
1338 WideCharToMultiByte(pImeDpi->uCodePage, 0, szW, -1,
1339 lpData, MAX_IMM_FILENAME, NULL, NULL);
1340 ((LPSTR)lpData)[MAX_IMM_FILENAME - 1] = 0;
1341 }
1342 break;
1343
1345 case IME_ESC_HANJA_MODE:
1347 lpData, -1, szW, _countof(szW));
1348 szW[_countof(szW) - 1] = UNICODE_NULL; /* Avoid buffer overrun */
1349 ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, szW, hKL);
1350 break;
1351
1352 default:
1353 ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
1354 break;
1355 }
1356
1357 ImmUnlockImeDpi(pImeDpi);
1358 TRACE("ret: %p\n", ret);
1359 return ret;
1360}
#define WideCharToMultiByte
Definition: compat.h:111
static LRESULT APIENTRY ImeDpi_Escape(PIMEDPI pImeDpi, HIMC hIMC, UINT uSubFunc, LPVOID lpData, HKL hKL)
Definition: ime.c:360
#define MAX_IMM_FILENAME
Definition: precomp.h:54
#define IME_ESC_SET_EUDC_DICTIONARY
Definition: imm.h:417
#define IME_ESC_HANJA_MODE
Definition: imm.h:421
#define IME_ESC_GETHELPFILENAME
Definition: imm.h:424
#define IME_ESC_GET_EUDC_DICTIONARY
Definition: imm.h:416
#define IME_ESC_IME_NAME
Definition: imm.h:419
#define IME_ESC_SEQUENCE_TO_INTERNAL
Definition: imm.h:415
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
#define MAKEWORD(a, b)
Definition: typedefs.h:248
int32_t INT
Definition: typedefs.h:58
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define HIWORD(l)
Definition: typedefs.h:247
LONG_PTR LRESULT
Definition: windef.h:209
char CHAR
Definition: xmlstorage.h:175

Referenced by ActiveIMMApp_EscapeA().

◆ ImmEscapeW()

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

Definition at line 1365 of file ime.c.

1366{
1367 LRESULT ret;
1368 PIMEDPI pImeDpi;
1369 INT cch;
1372 WORD word;
1373
1374 TRACE("(%p, %p, %u, %p)\n", hKL, hIMC, uSubFunc, lpData);
1375
1376 pImeDpi = Imm32FindOrLoadImeDpi(hKL);
1377 if (IS_NULL_UNEXPECTEDLY(pImeDpi))
1378 return 0;
1379
1380 if (ImeDpi_IsUnicode(pImeDpi) || !lpData) /* No conversion needed */
1381 {
1382 ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
1383 ImmUnlockImeDpi(pImeDpi);
1384 return ret;
1385 }
1386
1387 switch (uSubFunc)
1388 {
1390 ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
1391
1392 word = LOWORD(ret);
1393 cch = 0;
1394 if (HIBYTE(word))
1395 szA[cch++] = HIBYTE(word);
1396 if (LOBYTE(word))
1397 szA[cch++] = LOBYTE(word);
1398
1400 szA, cch, szW, _countof(szW));
1401 switch (cch)
1402 {
1403 case 1: ret = szW[0]; break;
1404 case 2: ret = MAKELONG(szW[1], szW[0]); break;
1405 default: ret = 0; break;
1406 }
1407 break;
1408
1410 case IME_ESC_IME_NAME:
1412 ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, szA, hKL);
1413 if (ret)
1414 {
1415 szA[_countof(szA) - 1] = 0;
1417 szA, -1, lpData, MAX_IMM_FILENAME);
1418 ((LPWSTR)lpData)[MAX_IMM_FILENAME - 1] = UNICODE_NULL; /* Avoid buffer overrun */
1419 }
1420 break;
1421
1423 case IME_ESC_HANJA_MODE:
1424 WideCharToMultiByte(pImeDpi->uCodePage, 0,
1425 lpData, -1, szA, _countof(szA), NULL, NULL);
1426 szA[_countof(szA) - 1] = 0;
1427 ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, szA, hKL);
1428 break;
1429
1430 default:
1431 ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
1432 break;
1433 }
1434
1435 ImmUnlockImeDpi(pImeDpi);
1436 TRACE("ret: %p\n", ret);
1437 return ret;
1438}
unsigned short WORD
Definition: ntddk_ex.h:93
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
const WCHAR * word
Definition: lex.c:36
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by ActiveIMMApp_EscapeW(), and User32DoImeHelp().

◆ ImmGetCompositionFontA()

BOOL WINAPI ImmGetCompositionFontA ( HIMC  hIMC,
LPLOGFONTA  lplf 
)

Definition at line 1615 of file ime.c.

1616{
1617 PCLIENTIMC pClientImc;
1618 BOOL ret = FALSE, bWide;
1619 LPINPUTCONTEXT pIC;
1620
1621 TRACE("(%p, %p)\n", hIMC, lplf);
1622
1623 pClientImc = ImmLockClientImc(hIMC);
1624 if (IS_NULL_UNEXPECTEDLY(pClientImc))
1625 return FALSE;
1626
1627 bWide = (pClientImc->dwFlags & CLIENTIMC_WIDE);
1628 ImmUnlockClientImc(pClientImc);
1629
1630 pIC = ImmLockIMC(hIMC);
1631 if (IS_NULL_UNEXPECTEDLY(pIC))
1632 return FALSE;
1633
1634 if (pIC->fdwInit & INIT_LOGFONT)
1635 {
1636 if (bWide)
1637 LogFontWideToAnsi(&pIC->lfFont.W, lplf);
1638 else
1639 *lplf = pIC->lfFont.A;
1640
1641 ret = TRUE;
1642 }
1643
1644 ImmUnlockIMC(hIMC);
1645 return ret;
1646}
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1066
VOID WINAPI ImmUnlockClientImc(PCLIENTIMC pClientImc)
Definition: imm.c:983
PCLIENTIMC WINAPI ImmLockClientImc(HIMC hImc)
Definition: imm.c:937
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1057
VOID APIENTRY LogFontWideToAnsi(const LOGFONTW *plfW, LPLOGFONTA plfA)
Definition: utils.c:312
#define CLIENTIMC_WIDE
Definition: imm32_undoc.h:138
#define INIT_LOGFONT
Definition: immdev.h:176
union _tagINPUTCONTEXT::@2050 lfFont
DWORD fdwInit
Definition: immdev.h:147
LOGFONTA A
Definition: immdev.h:136
LOGFONTW W
Definition: immdev.h:137

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

◆ ImmGetCompositionFontW()

BOOL WINAPI ImmGetCompositionFontW ( HIMC  hIMC,
LPLOGFONTW  lplf 
)

Definition at line 1651 of file ime.c.

1652{
1653 PCLIENTIMC pClientImc;
1654 BOOL bWide;
1655 LPINPUTCONTEXT pIC;
1656 BOOL ret = FALSE;
1657
1658 TRACE("(%p, %p)\n", hIMC, lplf);
1659
1660 pClientImc = ImmLockClientImc(hIMC);
1661 if (IS_NULL_UNEXPECTEDLY(pClientImc))
1662 return FALSE;
1663
1664 bWide = (pClientImc->dwFlags & CLIENTIMC_WIDE);
1665 ImmUnlockClientImc(pClientImc);
1666
1667 pIC = ImmLockIMC(hIMC);
1668 if (IS_NULL_UNEXPECTEDLY(pIC))
1669 return FALSE;
1670
1671 if (pIC->fdwInit & INIT_LOGFONT)
1672 {
1673 if (bWide)
1674 *lplf = pIC->lfFont.W;
1675 else
1676 LogFontAnsiToWide(&pIC->lfFont.A, lplf);
1677
1678 ret = TRUE;
1679 }
1680
1681 ImmUnlockIMC(hIMC);
1682 return ret;
1683}
VOID APIENTRY LogFontAnsiToWide(const LOGFONTA *plfA, LPLOGFONTW plfW)
Definition: utils.c:299

Referenced by ActiveIMMApp_GetCompositionFontW(), and ImeWnd_OnImeControl().

◆ ImmGetCompositionWindow()

BOOL WINAPI ImmGetCompositionWindow ( HIMC  hIMC,
LPCOMPOSITIONFORM  lpCompForm 
)

Definition at line 1559 of file ime.c.

1560{
1561 LPINPUTCONTEXT pIC;
1562 BOOL ret = FALSE;
1563
1564 TRACE("(%p, %p)\n", hIMC, lpCompForm);
1565
1566 pIC = ImmLockIMC(hIMC);
1567 if (IS_NULL_UNEXPECTEDLY(pIC))
1568 return FALSE;
1569
1570 if (pIC->fdwInit & INIT_COMPFORM)
1571 {
1572 *lpCompForm = pIC->cfCompForm;
1573 ret = TRUE;
1574 }
1575
1576 ImmUnlockIMC(hIMC);
1577 return ret;
1578}
#define INIT_COMPFORM
Definition: immdev.h:177
COMPOSITIONFORM cfCompForm
Definition: immdev.h:139

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

◆ ImmGetConversionListA()

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

Definition at line 1801 of file ime.c.

1803{
1804 DWORD ret = 0;
1805 UINT cb;
1806 LPWSTR pszSrcW = NULL;
1807 LPCANDIDATELIST pCL = NULL;
1808 PIMEDPI pImeDpi;
1809
1810 TRACE("(%p, %p, %s, %p, %lu, 0x%lX)\n", hKL, hIMC, debugstr_a(pSrc),
1811 lpDst, dwBufLen, uFlag);
1812
1813 pImeDpi = Imm32FindOrLoadImeDpi(hKL);
1814 if (IS_NULL_UNEXPECTEDLY(pImeDpi))
1815 return 0;
1816
1817 if (!ImeDpi_IsUnicode(pImeDpi)) /* No conversion needed */
1818 {
1819 ret = pImeDpi->ImeConversionList(hIMC, pSrc, lpDst, dwBufLen, uFlag);
1820 ImmUnlockImeDpi(pImeDpi);
1821 return ret;
1822 }
1823
1824 if (pSrc)
1825 {
1826 pszSrcW = Imm32WideFromAnsi(pImeDpi->uCodePage, pSrc);
1827 if (IS_NULL_UNEXPECTEDLY(pszSrcW))
1828 goto Quit;
1829 }
1830
1831 cb = pImeDpi->ImeConversionList(hIMC, pszSrcW, NULL, 0, uFlag);
1833 goto Quit;
1834
1835 pCL = ImmLocalAlloc(0, cb);
1836 if (IS_NULL_UNEXPECTEDLY(pCL))
1837 goto Quit;
1838
1839 cb = pImeDpi->ImeConversionList(hIMC, pszSrcW, pCL, cb, uFlag);
1841 goto Quit;
1842
1843 ret = CandidateListWideToAnsi(pCL, lpDst, dwBufLen, pImeDpi->uCodePage);
1844
1845Quit:
1846 ImmLocalFree(pszSrcW);
1847 ImmLocalFree(pCL);
1848 ImmUnlockImeDpi(pImeDpi);
1849 TRACE("ret: 0x%X\n", ret);
1850 return ret;
1851}
DWORD APIENTRY CandidateListWideToAnsi(const CANDIDATELIST *pWideCL, LPCANDIDATELIST pAnsiCL, DWORD dwBufLen, UINT uCodePage)
Definition: candidate.c:14
#define IS_ZERO_UNEXPECTEDLY(p)
Definition: precomp.h:129
#define debugstr_a
Definition: kernel32.h:31
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_ DWORD _In_ DWORD dwBufLen
Definition: wincrypt.h:4246

Referenced by ActiveIMMApp_GetConversionListA().

◆ ImmGetConversionListW()

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

Definition at line 1857 of file ime.c.

1859{
1860 DWORD ret = 0;
1861 INT cb;
1862 PIMEDPI pImeDpi;
1863 LPCANDIDATELIST pCL = NULL;
1864 LPSTR pszSrcA = NULL;
1865
1866 TRACE("(%p, %p, %s, %p, %lu, 0x%lX)\n", hKL, hIMC, debugstr_w(pSrc),
1867 lpDst, dwBufLen, uFlag);
1868
1869 pImeDpi = Imm32FindOrLoadImeDpi(hKL);
1870 if (IS_NULL_UNEXPECTEDLY(pImeDpi))
1871 return 0;
1872
1873 if (ImeDpi_IsUnicode(pImeDpi)) /* No conversion needed */
1874 {
1875 ret = pImeDpi->ImeConversionList(hIMC, pSrc, lpDst, dwBufLen, uFlag);
1876 ImmUnlockImeDpi(pImeDpi);
1877 return ret;
1878 }
1879
1880 if (pSrc)
1881 {
1882 pszSrcA = Imm32AnsiFromWide(pImeDpi->uCodePage, pSrc);
1883 if (IS_NULL_UNEXPECTEDLY(pszSrcA))
1884 goto Quit;
1885 }
1886
1887 cb = pImeDpi->ImeConversionList(hIMC, pszSrcA, NULL, 0, uFlag);
1889 goto Quit;
1890
1891 pCL = ImmLocalAlloc(0, cb);
1892 if (IS_NULL_UNEXPECTEDLY(pCL))
1893 goto Quit;
1894
1895 cb = pImeDpi->ImeConversionList(hIMC, pszSrcA, pCL, cb, uFlag);
1897 goto Quit;
1898
1899 ret = CandidateListAnsiToWide(pCL, lpDst, dwBufLen, pImeDpi->uCodePage);
1900
1901Quit:
1902 ImmLocalFree(pszSrcA);
1903 ImmLocalFree(pCL);
1904 ImmUnlockImeDpi(pImeDpi);
1905 TRACE("ret: 0x%X\n", ret);
1906 return ret;
1907}
DWORD APIENTRY CandidateListAnsiToWide(const CANDIDATELIST *pAnsiCL, LPCANDIDATELIST pWideCL, DWORD dwBufLen, UINT uCodePage)
Definition: candidate.c:84

Referenced by ActiveIMMApp_GetConversionListW().

◆ ImmGetConversionStatus()

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

Definition at line 1912 of file ime.c.

1913{
1914 LPINPUTCONTEXT pIC;
1915
1916 TRACE("(%p %p %p)\n", hIMC, lpfdwConversion, lpfdwSentence);
1917
1918 pIC = ImmLockIMC(hIMC);
1919 if (IS_NULL_UNEXPECTEDLY(pIC))
1920 return FALSE;
1921
1922 if (lpfdwConversion)
1923 {
1924 *lpfdwConversion = pIC->fdwConversion;
1925 TRACE("0x%X\n", *lpfdwConversion);
1926 }
1927
1928 if (lpfdwSentence)
1929 {
1930 *lpfdwSentence = pIC->fdwSentence;
1931 TRACE("0x%X\n", *lpfdwSentence);
1932 }
1933
1934 ImmUnlockIMC(hIMC);
1935 return TRUE;
1936}
DWORD fdwConversion
Definition: immdev.h:133
DWORD fdwSentence
Definition: immdev.h:134

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

◆ ImmGetDefaultIMEWnd()

◆ ImmGetDescriptionA()

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

Definition at line 1082 of file ime.c.

1083{
1085 size_t cch;
1086
1087 TRACE("(%p,%p,%d)\n", hKL, lpszDescription, uBufLen);
1088
1089 if (!IS_IME_HKL(hKL))
1090 {
1091 TRACE("\n");
1092 return 0;
1093 }
1094
1096 {
1097 ERR("\n");
1098 return 0;
1099 }
1100
1101 StringCchLengthW(info.wszImeDescription, _countof(info.wszImeDescription), &cch);
1102 cch = WideCharToMultiByte(CP_ACP, 0, info.wszImeDescription, (INT)cch,
1103 lpszDescription, uBufLen, NULL, NULL);
1104 if (uBufLen)
1105 lpszDescription[cch] = 0;
1106 return (UINT)cch;
1107}
STRSAFEAPI StringCchLengthW(STRSAFE_LPCWSTR psz, size_t cchMax, size_t *pcchLength)
Definition: strsafe.h:842

Referenced by ActiveIMMApp_GetDescriptionA(), and test_ImmGetDescription().

◆ ImmGetDescriptionW()

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

Definition at line 1112 of file ime.c.

1113{
1115 size_t cch;
1116
1117 TRACE("(%p, %p, %d)\n", hKL, lpszDescription, uBufLen);
1118
1119 if (!IS_IME_HKL(hKL))
1120 {
1121 TRACE("\n");
1122 return 0;
1123 }
1124
1126 {
1127 ERR("\n");
1128 return 0;
1129 }
1130
1131 if (uBufLen != 0)
1132 StringCchCopyW(lpszDescription, uBufLen, info.wszImeDescription);
1133
1134 StringCchLengthW(info.wszImeDescription, _countof(info.wszImeDescription), &cch);
1135 return (UINT)cch;
1136}

Referenced by ActiveIMMApp_GetDescriptionW(), GetHKLDesctription(), and test_ImmGetDescription().

◆ ImmGetIMEFileNameA()

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

Definition at line 1141 of file ime.c.

1142{
1143 BOOL bDefUsed;
1145 size_t cch;
1146
1147 TRACE("(%p, %p, %u)\n", hKL, lpszFileName, uBufLen);
1148
1149 if (!IS_IME_HKL(hKL))
1150 {
1151 TRACE("\n");
1152 if (uBufLen > 0)
1153 lpszFileName[0] = 0;
1154 return 0;
1155 }
1156
1158 {
1159 ERR("\n");
1160 if (uBufLen > 0)
1161 lpszFileName[0] = 0;
1162 return 0;
1163 }
1164
1165 StringCchLengthW(info.wszImeFile, _countof(info.wszImeFile), &cch);
1166
1167 cch = WideCharToMultiByte(CP_ACP, 0, info.wszImeFile, (INT)cch,
1168 lpszFileName, uBufLen, NULL, &bDefUsed);
1169 if (uBufLen == 0)
1170 return (UINT)cch;
1171
1172 if (cch > uBufLen - 1)
1173 cch = uBufLen - 1;
1174
1175 lpszFileName[cch] = 0;
1176 return (UINT)cch;
1177}

Referenced by ActiveIMMApp_GetIMEFileNameA().

◆ ImmGetIMEFileNameW()

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

Definition at line 1182 of file ime.c.

1183{
1185 size_t cch;
1186
1187 TRACE("(%p, %p, %u)\n", hKL, lpszFileName, uBufLen);
1188
1189 if (!IS_IME_HKL(hKL))
1190 {
1191 TRACE("\n");
1192 if (uBufLen > 0)
1193 lpszFileName[0] = 0;
1194 return 0;
1195 }
1196
1198 {
1199 ERR("\n");
1200 if (uBufLen > 0)
1201 lpszFileName[0] = 0;
1202 return 0;
1203 }
1204
1205 StringCchLengthW(info.wszImeFile, _countof(info.wszImeFile), &cch);
1206 if (uBufLen == 0)
1207 return (UINT)cch;
1208
1209 StringCchCopyNW(lpszFileName, uBufLen, info.wszImeFile, cch);
1210
1211 if (cch > uBufLen - 1)
1212 cch = uBufLen - 1;
1213
1214 lpszFileName[cch] = 0;
1215 return (UINT)cch;
1216}
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236

Referenced by ActiveIMMApp_GetIMEFileNameW(), and GetHKLDesctription().

◆ ImmGetImeInfoEx()

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

Definition at line 932 of file ime.c.

933{
934 HKL hKL;
935 if (SearchType == ImeInfoExKeyboardLayout || SearchType == ImeInfoExKeyboardLayoutTFS)
936 {
937 hKL = *(HKL*)pvSearchKey;
938 pImeInfoEx->hkl = hKL;
939
940 if (SearchType == ImeInfoExKeyboardLayoutTFS)
941 {
942 if (!IS_IME_HKL(hKL))
943 {
945 {
946 TRACE("\n");
947 return FALSE;
948 }
949 }
950
951 SearchType = ImeInfoExKeyboardLayout;
952 }
953 else
954 {
955 if (!IS_IME_HKL(hKL))
956 {
957 TRACE("\n");
958 return FALSE;
959 }
960 }
961 }
962 else if (SearchType == ImeInfoExImeFileName)
963 {
964 StringCchCopyW(pImeInfoEx->wszImeFile, _countof(pImeInfoEx->wszImeFile),
965 pvSearchKey);
966 }
967 else
968 {
969 return FALSE;
970 }
971
972 return NtUserGetImeInfoEx(pImeInfoEx, SearchType);
973}
BOOL WINAPI CtfImmIsTextFrameServiceDisabled(VOID)
Definition: ctf.c:1079
@ ImeInfoExImeFileName
Definition: imm32_undoc.h:51
@ ImeInfoExKeyboardLayoutTFS
Definition: imm32_undoc.h:49
BOOL NTAPI NtUserGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType)
Definition: ime.c:1008
UINT_PTR HKL
Definition: msctf.idl:143

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

◆ ImmGetImeMenuItemsA()

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

Definition at line 2111 of file ime.c.

2114{
2115 TRACE("(%p, 0x%lX, 0x%lX, %p, %p, 0x%lX)\n",
2116 hIMC, dwFlags, dwType, lpImeParentMenu, lpImeMenu, dwSize);
2117 return ImmGetImeMenuItemsAW(hIMC, dwFlags, dwType, lpImeParentMenu, lpImeMenu, dwSize, TRUE);
2118}
DWORD APIENTRY ImmGetImeMenuItemsAW(HIMC hIMC, DWORD dwFlags, DWORD dwType, LPVOID lpImeParentMenu, LPVOID lpImeMenu, DWORD dwSize, BOOL bTargetIsAnsi)
Definition: ime.c:609

Referenced by ActiveIMMApp_GetImeMenuItemsA(), and test_InvalidIMC().

◆ ImmGetImeMenuItemsAW()

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

Definition at line 609 of file ime.c.

611{
612 DWORD ret = 0, cbTotal, dwProcessId, dwThreadId, iItem;
613 LPINPUTCONTEXT pIC;
614 PIMEDPI pImeDpi = NULL;
615 IMEMENUITEMINFOA ParentA;
616 IMEMENUITEMINFOW ParentW;
617 LPIMEMENUITEMINFOA pItemA;
618 LPIMEMENUITEMINFOW pItemW;
619 LPVOID pNewItems = NULL, pNewParent = NULL;
620 BOOL bImcIsAnsi;
621 HKL hKL;
622
623 if (IS_NULL_UNEXPECTEDLY(hIMC))
624 return 0;
625
627 if (IS_ZERO_UNEXPECTEDLY(dwProcessId))
628 return 0;
629
630 if (dwProcessId != GetCurrentProcessId())
631 {
632 if (bTargetIsAnsi)
633 return 0;
634 return Imm32GetImeMenuItemWInterProcess(hIMC, dwFlags, dwType, lpImeParentMenu,
635 lpImeMenu, dwSize);
636 }
637
638 pIC = ImmLockIMC(hIMC);
639 if (IS_NULL_UNEXPECTEDLY(pIC))
640 return 0;
641
644 {
645 ImmUnlockIMC(hIMC);
646 return 0;
647 }
648
650 pImeDpi = ImmLockImeDpi(hKL);
651 if (IS_NULL_UNEXPECTEDLY(pImeDpi))
652 {
653 ImmUnlockIMC(hIMC);
654 return 0;
655 }
656
657 bImcIsAnsi = Imm32IsImcAnsi(hIMC);
658
659 if (bImcIsAnsi != bTargetIsAnsi)
660 {
661 if (bTargetIsAnsi)
662 {
663 if (lpImeParentMenu)
664 pNewParent = &ParentW;
665
666 if (lpImeMenu)
667 {
668 cbTotal = ((dwSize / sizeof(IMEMENUITEMINFOA)) * sizeof(IMEMENUITEMINFOW));
669 pNewItems = ImmLocalAlloc(0, cbTotal);
670 if (IS_NULL_UNEXPECTEDLY(pNewItems))
671 goto Quit;
672 }
673 }
674 else
675 {
676 if (lpImeParentMenu)
677 pNewParent = &ParentA;
678
679 if (lpImeMenu)
680 {
681 cbTotal = ((dwSize / sizeof(IMEMENUITEMINFOW)) * sizeof(IMEMENUITEMINFOA));
682 pNewItems = ImmLocalAlloc(0, cbTotal);
683 if (IS_NULL_UNEXPECTEDLY(pNewItems))
684 goto Quit;
685 }
686 }
687 }
688 else
689 {
690 pNewItems = lpImeMenu;
691 pNewParent = lpImeParentMenu;
692 }
693
694 ret = pImeDpi->ImeGetImeMenuItems(hIMC, dwFlags, dwType, pNewParent, pNewItems, dwSize);
695 if (IS_ZERO_UNEXPECTEDLY(ret) || !lpImeMenu)
696 goto Quit;
697
698 if (bImcIsAnsi != bTargetIsAnsi)
699 {
700 if (bTargetIsAnsi)
701 {
702 if (pNewParent)
703 Imm32ImeMenuWideToAnsi(pNewParent, lpImeParentMenu, pImeDpi->uCodePage);
704
705 pItemW = pNewItems;
706 pItemA = lpImeMenu;
707 for (iItem = 0; iItem < ret; ++iItem, ++pItemW, ++pItemA)
708 {
709 if (!Imm32ImeMenuWideToAnsi(pItemW, pItemA, pImeDpi->uCodePage))
710 {
711 ERR("\n");
712 ret = 0;
713 break;
714 }
715 }
716 }
717 else
718 {
719 if (pNewParent)
720 Imm32ImeMenuAnsiToWide(pNewParent, lpImeParentMenu, pImeDpi->uCodePage, TRUE);
721
722 pItemA = pNewItems;
723 pItemW = lpImeMenu;
724 for (iItem = 0; iItem < dwSize; ++iItem, ++pItemA, ++pItemW)
725 {
726 if (!Imm32ImeMenuAnsiToWide(pItemA, pItemW, pImeDpi->uCodePage, TRUE))
727 {
728 ERR("\n");
729 ret = 0;
730 break;
731 }
732 }
733 }
734 }
735
736Quit:
737 if (pNewItems != lpImeMenu)
738 ImmLocalFree(pNewItems);
739 ImmUnlockImeDpi(pImeDpi);
740 ImmUnlockIMC(hIMC);
741 TRACE("ret: 0x%X\n", ret);
742 return ret;
743}
DWORD APIENTRY Imm32GetImeMenuItemWInterProcess(HIMC hIMC, DWORD dwFlags, DWORD dwType, LPVOID lpImeParentMenu, LPVOID lpImeMenu, DWORD dwSize)
Definition: ime.c:525
BOOL WINAPI Imm32IsImcAnsi(HIMC hIMC)
Definition: utils.c:216
INT APIENTRY Imm32ImeMenuWideToAnsi(const IMEMENUITEMINFOW *pItemW, LPIMEMENUITEMINFOA pItemA, UINT uCodePage)
Definition: utils.c:528
INT APIENTRY Imm32ImeMenuAnsiToWide(const IMEMENUITEMINFOA *pItemA, LPIMEMENUITEMINFOW pItemW, UINT uCodePage, BOOL bBitmap)
Definition: utils.c:501
@ QIC_INPUTTHREADID
Definition: undocuser.h:393
@ QIC_INPUTPROCESSID
Definition: undocuser.h:392
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1158
HKL WINAPI GetKeyboardLayout(_In_ DWORD)

Referenced by ImmGetImeMenuItemsA(), and ImmGetImeMenuItemsW().

◆ ImmGetImeMenuItemsW()

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

Definition at line 2124 of file ime.c.

2127{
2128 TRACE("(%p, 0x%lX, 0x%lX, %p, %p, 0x%lX)\n",
2129 hIMC, dwFlags, dwType, lpImeParentMenu, lpImeMenu, dwSize);
2130 return ImmGetImeMenuItemsAW(hIMC, dwFlags, dwType, lpImeParentMenu, lpImeMenu, dwSize, FALSE);
2131}

Referenced by ActiveIMMApp_GetImeMenuItemsW(), and ImmPutImeMenuItemsIntoMappedFile().

◆ ImmGetOpenStatus()

BOOL WINAPI ImmGetOpenStatus ( HIMC  hIMC)

Definition at line 1443 of file ime.c.

1444{
1445 BOOL ret;
1446 LPINPUTCONTEXT pIC;
1447
1448 TRACE("(%p)\n", hIMC);
1449
1450 if (IS_NULL_UNEXPECTEDLY(hIMC))
1451 return FALSE;
1452
1453 pIC = ImmLockIMC(hIMC);
1454 if (IS_NULL_UNEXPECTEDLY(pIC))
1455 return FALSE;
1456
1457 ret = pIC->fOpen;
1458 ImmUnlockIMC(hIMC);
1459 TRACE("ret: %d\n", ret);
1460 return ret;
1461}

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

◆ ImmGetProperty()

DWORD WINAPI ImmGetProperty ( HKL  hKL,
DWORD  fdwIndex 
)

Definition at line 1221 of file ime.c.

1222{
1223 IMEINFOEX ImeInfoEx;
1224 LPIMEINFO pImeInfo;
1225 DWORD dwValue;
1226 PIMEDPI pImeDpi = NULL;
1227
1228 TRACE("(%p, %lu)\n", hKL, fdwIndex);
1229
1230 if (!IS_IME_HKL(hKL))
1231 {
1232 TRACE("\n");
1233 return FALSE;
1234 }
1235
1236 if (!ImmGetImeInfoEx(&ImeInfoEx, ImeInfoExKeyboardLayout, &hKL))
1237 {
1238 ERR("\n");
1239 return FALSE;
1240 }
1241
1242 if (fdwIndex == IGP_GETIMEVERSION)
1243 return ImeInfoEx.dwImeWinVersion;
1244
1245 if (ImeInfoEx.fLoadFlag != 2)
1246 {
1247 pImeDpi = Imm32FindOrLoadImeDpi(hKL);
1248 if (IS_NULL_UNEXPECTEDLY(pImeDpi))
1249 return FALSE;
1250
1251 pImeInfo = &pImeDpi->ImeInfo;
1252 }
1253 else
1254 {
1255 pImeInfo = &ImeInfoEx.ImeInfo;
1256 }
1257
1258 switch (fdwIndex)
1259 {
1260 case IGP_PROPERTY: dwValue = pImeInfo->fdwProperty; break;
1261 case IGP_CONVERSION: dwValue = pImeInfo->fdwConversionCaps; break;
1262 case IGP_SENTENCE: dwValue = pImeInfo->fdwSentenceCaps; break;
1263 case IGP_UI: dwValue = pImeInfo->fdwUICaps; break;
1264 case IGP_SETCOMPSTR: dwValue = pImeInfo->fdwSCSCaps; break;
1265 case IGP_SELECT: dwValue = pImeInfo->fdwSelectCaps; break;
1266 default: dwValue = 0; break;
1267 }
1268
1269 if (pImeDpi)
1270 ImmUnlockImeDpi(pImeDpi);
1271 return dwValue;
1272}
#define IGP_SELECT
Definition: imm.h:305
#define IGP_SETCOMPSTR
Definition: imm.h:304
#define IGP_GETIMEVERSION
Definition: imm.h:299
#define IGP_PROPERTY
Definition: imm.h:300
#define IGP_SENTENCE
Definition: imm.h:302
#define IGP_CONVERSION
Definition: imm.h:301
#define IGP_UI
Definition: imm.h:303
DWORD dwImeWinVersion
Definition: imm32_undoc.h:36

Referenced by ActiveIMMApp_GetProperty(), and test_ImmGetCompositionString().

◆ ImmGetStatusWindowPos()

BOOL WINAPI ImmGetStatusWindowPos ( HIMC  hIMC,
LPPOINT  lpptPos 
)

Definition at line 1509 of file ime.c.

1510{
1511 LPINPUTCONTEXT pIC;
1512 BOOL ret;
1513
1514 TRACE("(%p, %p)\n", hIMC, lpptPos);
1515
1516 pIC = ImmLockIMC(hIMC);
1517 if (IS_NULL_UNEXPECTEDLY(pIC))
1518 return FALSE;
1519
1520 ret = !!(pIC->fdwInit & INIT_STATUSWNDPOS);
1521 if (ret)
1522 *lpptPos = pIC->ptStatusWndPos;
1523
1524 ImmUnlockIMC(hIMC);
1525 return ret;
1526}
#define INIT_STATUSWNDPOS
Definition: immdev.h:173
POINT ptStatusWndPos
Definition: immdev.h:131

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

◆ ImmInstallIMEA()

HKL WINAPI ImmInstallIMEA ( LPCSTR  lpszIMEFileName,
LPCSTR  lpszLayoutText 
)

Definition at line 748 of file ime.c.

749{
750 HKL hKL = NULL;
751 LPWSTR pszFileNameW = NULL, pszLayoutTextW = NULL;
752
753 TRACE("(%s, %s)\n", debugstr_a(lpszIMEFileName), debugstr_a(lpszLayoutText));
754
755 pszFileNameW = Imm32WideFromAnsi(CP_ACP, lpszIMEFileName);
756 if (IS_NULL_UNEXPECTEDLY(pszFileNameW))
757 goto Quit;
758
759 pszLayoutTextW = Imm32WideFromAnsi(CP_ACP, lpszLayoutText);
760 if (IS_NULL_UNEXPECTEDLY(pszLayoutTextW))
761 goto Quit;
762
763 hKL = ImmInstallIMEW(pszFileNameW, pszLayoutTextW);
764
765Quit:
766 ImmLocalFree(pszFileNameW);
767 ImmLocalFree(pszLayoutTextW);
768 return hKL;
769}
HKL WINAPI ImmInstallIMEW(LPCWSTR lpszIMEFileName, LPCWSTR lpszLayoutText)
Definition: ime.c:774

Referenced by ActiveIMMApp_InstallIMEA().

◆ ImmInstallIMEW()

HKL WINAPI ImmInstallIMEW ( LPCWSTR  lpszIMEFileName,
LPCWSTR  lpszLayoutText 
)

Definition at line 774 of file ime.c.

775{
776 WCHAR szImeFileName[MAX_PATH], szImeDestPath[MAX_PATH], szImeKey[20];
777 IMEINFOEX InfoEx;
778 LPWSTR pchFilePart;
779 UINT iLayout, cLayouts;
780 HKL hNewKL;
781 WORD wLangID;
782 PREG_IME pLayouts = NULL;
783
784 TRACE("(%s, %s)\n", debugstr_w(lpszIMEFileName), debugstr_w(lpszLayoutText));
785
786 GetFullPathNameW(lpszIMEFileName, _countof(szImeFileName), szImeFileName, &pchFilePart);
787 CharUpperW(szImeFileName);
788 if (IS_NULL_UNEXPECTEDLY(pchFilePart))
789 return NULL;
790
791 /* Load the IME version info */
792 InfoEx.hkl = hNewKL = NULL;
793 StringCchCopyW(InfoEx.wszImeFile, _countof(InfoEx.wszImeFile), pchFilePart);
794 if (!Imm32LoadImeVerInfo(&InfoEx) || !InfoEx.hkl)
795 {
796 ERR("\n");
797 return NULL;
798 }
799 wLangID = LOWORD(InfoEx.hkl);
800
801 /* Get the IME layouts from registry */
802 cLayouts = Imm32GetImeLayout(NULL, 0);
803 if (cLayouts)
804 {
805 pLayouts = ImmLocalAlloc(0, cLayouts * sizeof(REG_IME));
806 if (IS_NULL_UNEXPECTEDLY(pLayouts))
807 return NULL;
808
809 if (!Imm32GetImeLayout(pLayouts, cLayouts))
810 {
811 ERR("\n");
812 ImmLocalFree(pLayouts);
813 return NULL;
814 }
815
816 for (iLayout = 0; iLayout < cLayouts; ++iLayout)
817 {
818 if (lstrcmpiW(pLayouts[iLayout].szFileName, pchFilePart) == 0)
819 {
820 if (wLangID != LOWORD(pLayouts[iLayout].hKL))
821 {
822 ERR("\n");
823 goto Quit; /* The language is different */
824 }
825
826 hNewKL = pLayouts[iLayout].hKL; /* Found */
827 break;
828 }
829 }
830 }
831
832 /* If the IME for the specified filename is valid, then unload it now */
833 if (ImmGetImeInfoEx(&InfoEx, ImeInfoExImeFileName, pchFilePart) &&
834 !UnloadKeyboardLayout(InfoEx.hkl))
835 {
836 ERR("\n");
837 hNewKL = NULL;
838 goto Quit;
839 }
840
841 Imm32GetSystemLibraryPath(szImeDestPath, _countof(szImeDestPath), pchFilePart);
842 CharUpperW(szImeDestPath);
843
844 /* If the source and the destination pathnames were different, then copy the IME file */
845 if (lstrcmpiW(szImeFileName, szImeDestPath) != 0 &&
846 !Imm32CopyImeFile(szImeFileName, szImeDestPath))
847 {
848 ERR("\n");
849 hNewKL = NULL;
850 goto Quit;
851 }
852
853 if (hNewKL == NULL)
854 hNewKL = Imm32AssignNewLayout(cLayouts, pLayouts, wLangID);
855
856 if (hNewKL)
857 {
858 /* Write the IME layout to registry */
859 if (Imm32WriteImeLayout(hNewKL, pchFilePart, lpszLayoutText))
860 {
861 /* Load the keyboard layout */
862 StringCchPrintfW(szImeKey, _countof(szImeKey), L"%08X", (DWORD)(DWORD_PTR)hNewKL);
863 hNewKL = LoadKeyboardLayoutW(szImeKey, KLF_REPLACELANG);
864 }
865 else
866 {
867 ERR("\n");
868 hNewKL = NULL;
869 }
870 }
871
872Quit:
873 ImmLocalFree(pLayouts);
874 return hNewKL;
875}
BOOL APIENTRY Imm32WriteImeLayout(HKL hKL, LPCWSTR pchFilePart, LPCWSTR pszLayoutText)
Definition: utils.c:1023
BOOL APIENTRY Imm32CopyImeFile(LPWSTR pszOldFile, LPCWSTR pszNewFile)
Definition: utils.c:1120
UINT APIENTRY Imm32GetImeLayout(PREG_IME pLayouts, UINT cLayouts)
Definition: utils.c:948
BOOL APIENTRY Imm32LoadImeVerInfo(PIMEINFOEX pImeInfoEx)
Definition: utils.c:845
HKL APIENTRY Imm32AssignNewLayout(UINT cKLs, const REG_IME *pLayouts, WORD wLangID)
Definition: utils.c:902
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4261
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
HKL hKL
Definition: precomp.h:66
BOOL WINAPI UnloadKeyboardLayout(_In_ HKL)
#define KLF_REPLACELANG
Definition: winuser.h:115
HKL WINAPI LoadKeyboardLayoutW(_In_ LPCWSTR, _In_ UINT)
LPWSTR WINAPI CharUpperW(_Inout_ LPWSTR)

Referenced by ActiveIMMApp_InstallIMEW(), and ImmInstallIMEA().

◆ ImmIsIME()

◆ ImmLoadIME()

BOOL WINAPI ImmLoadIME ( HKL  hKL)

Definition at line 1055 of file ime.c.

1056{
1057 PIMEDPI pImeDpi;
1058
1059 if (!IS_IME_HKL(hKL) && (!IS_CICERO_MODE() || IS_16BIT_MODE()))
1060 {
1061 TRACE("\n");
1062 return FALSE;
1063 }
1064
1065 pImeDpi = Imm32FindImeDpi(hKL);
1066 if (pImeDpi == NULL)
1067 pImeDpi = Imm32LoadImeDpi(hKL, FALSE);
1068 return (pImeDpi != NULL);
1069}

Referenced by CtfImmTIMActivate(), CtfLoadThreadLayout(), and ImmActivateLayout().

◆ ImmLockImeDpi()

PIMEDPI WINAPI ImmLockImeDpi ( HKL  hKL)

Definition at line 978 of file ime.c.

979{
980 PIMEDPI pImeDpi = NULL;
981
982 TRACE("(%p)\n", hKL);
983
985
986 /* Find by hKL */
987 for (pImeDpi = gpImeDpiList; pImeDpi; pImeDpi = pImeDpi->pNext)
988 {
989 if (pImeDpi->hKL == hKL) /* found */
990 {
991 /* lock if possible */
992 if (pImeDpi->dwFlags & IMEDPI_FLAG_UNLOADED)
993 pImeDpi = NULL;
994 else
995 ++(pImeDpi->cLockObj);
996 break;
997 }
998 }
999
1001 return pImeDpi;
1002}

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

◆ ImmNotifyIME()

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

Definition at line 907 of file ime.c.

908{
909 HKL hKL;
910 PIMEDPI pImeDpi;
911 BOOL ret;
912
913 TRACE("(%p, %lu, %lu, %lu)\n", hIMC, dwAction, dwIndex, dwValue);
914
915 if (hIMC && IS_CROSS_THREAD_HIMC(hIMC))
916 return FALSE;
917
918 hKL = GetKeyboardLayout(0);
919 pImeDpi = ImmLockImeDpi(hKL);
920 if (IS_NULL_UNEXPECTEDLY(pImeDpi))
921 return FALSE;
922
923 ret = pImeDpi->NotifyIME(hIMC, dwAction, dwIndex, dwValue);
924 ImmUnlockImeDpi(pImeDpi);
925 return ret;
926}
#define IS_CROSS_THREAD_HIMC(hIMC)
Definition: precomp.h:148

Referenced by ActiveIMMApp_NotifyIME(), EDIT_WindowProc(), Imm32NotifyIMEProc(), ImmSystemHandler(), ME_HandleMessage(), CicBridge::SetActiveContextAlways(), CicBridge::SetCompositionString(), test_ImmGetCompositionString(), and test_ImmNotifyIME().

◆ ImmPutImeMenuItemsIntoMappedFile()

LRESULT WINAPI ImmPutImeMenuItemsIntoMappedFile ( HIMC  hIMC)

Definition at line 448 of file ime.c.

449{
450 LRESULT ret = FALSE;
451 HANDLE hMapping;
452 PIMEMENU pView;
453 LPIMEMENUITEMINFOW pParent = NULL, pItems = NULL;
454 DWORD i, cItems, cbItems = 0;
455
456 hMapping = OpenFileMappingW(FILE_MAP_ALL_ACCESS, FALSE, L"ImmMenuInfo");
457 pView = MapViewOfFile(hMapping, FILE_MAP_ALL_ACCESS, 0, 0, 0);
458 if (IS_NULL_UNEXPECTEDLY(pView))
459 goto Quit;
460
461 if (pView->dwVersion != 1)
462 {
463 ERR("\n");
464 goto Quit;
465 }
466
467 if (pView->Parent.cbSize > 0)
468 pParent = &pView->Parent;
469
470 if (pView->dwItemCount > 0)
471 {
472 cbItems = pView->dwItemCount * sizeof(IMEMENUITEMINFOW);
475 goto Quit;
476 }
477
478 cItems = ImmGetImeMenuItemsW(hIMC, pView->dwFlags, pView->dwType, pParent, pItems, cbItems);
479 pView->dwItemCount = cItems;
480 if (IS_ZERO_UNEXPECTEDLY(cItems))
481 goto Quit;
482
483 if (pItems)
484 {
485 for (i = 0; i < cItems; ++i)
486 {
487 pView->Items[i].Info = pItems[i];
488
489 // store bitmaps to bytes
490 if (pItems[i].hbmpChecked)
491 {
492 Imm32StoreBitmapToBytes(pItems[i].hbmpChecked, pView->Items[i].abChecked,
494 DeleteObject(pItems[i].hbmpChecked);
495 }
496 if (pItems[i].hbmpUnchecked)
497 {
498 Imm32StoreBitmapToBytes(pItems[i].hbmpUnchecked, pView->Items[i].abUnchecked,
500 DeleteObject(pItems[i].hbmpUnchecked);
501 }
502 if (pItems[i].hbmpItem)
503 {
504 Imm32StoreBitmapToBytes(pItems[i].hbmpItem, pView->Items[i].abItem,
506 DeleteObject(pItems[i].hbmpItem);
507 }
508 }
509 }
510
511 ret = TRUE;
512
513Quit:
514 if (pItems)
516 if (pView)
517 UnmapViewOfFile(pView);
518 if (hMapping)
519 CloseHandle(hMapping);
520 return ret;
521}
DWORD WINAPI ImmGetImeMenuItemsW(HIMC hIMC, DWORD dwFlags, DWORD dwType, LPIMEMENUITEMINFOW lpImeParentMenu, LPIMEMENUITEMINFOW lpImeMenu, DWORD dwSize)
Definition: ime.c:2124
#define MAX_IMEMENU_BITMAP_BYTES
Definition: ime.c:421
BOOL Imm32StoreBitmapToBytes(HBITMAP hbm, LPBYTE pbData, DWORD cbDataMax)
Definition: utils.c:143
HANDLE NTAPI OpenFileMappingW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
Definition: filemap.c:297
FxObject * pParent
Definition: fxdpcapi.cpp:86
pKey DeleteObject()
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEM * pItems
Definition: usp10.c:62
#define FILE_MAP_ALL_ACCESS
Definition: winbase.h:156

Referenced by ImeWnd_OnImeSystem().

◆ ImmSetCompositionFontA()

BOOL WINAPI ImmSetCompositionFontA ( HIMC  hIMC,
LPLOGFONTA  lplf 
)

Definition at line 1688 of file ime.c.

1689{
1690 LOGFONTW lfW;
1691 PCLIENTIMC pClientImc;
1692 BOOL bWide;
1693 LPINPUTCONTEXTDX pIC;
1694 LANGID LangID;
1695 HWND hWnd;
1696
1697 TRACE("(%p, %p)\n", hIMC, lplf);
1698
1699 if (IS_CROSS_THREAD_HIMC(hIMC))
1700 return FALSE;
1701
1702 pClientImc = ImmLockClientImc(hIMC);
1703 if (IS_NULL_UNEXPECTEDLY(pClientImc))
1704 return FALSE;
1705
1706 bWide = (pClientImc->dwFlags & CLIENTIMC_WIDE);
1707 ImmUnlockClientImc(pClientImc);
1708
1709 if (bWide)
1710 {
1711 LogFontAnsiToWide(lplf, &lfW);
1712 return ImmSetCompositionFontW(hIMC, &lfW);
1713 }
1714
1715 pIC = (LPINPUTCONTEXTDX)ImmLockIMC(hIMC);
1716 if (IS_NULL_UNEXPECTEDLY(pIC))
1717 return FALSE;
1718
1719 if (GetWin32ClientInfo()->dwExpWinVer < _WIN32_WINNT_NT4) /* old version (3.x)? */
1720 {
1723 !(pIC->dwUIFlags & 2) &&
1724 pIC->cfCompForm.dwStyle != CFS_DEFAULT)
1725 {
1727 }
1728 }
1729
1730 pIC->lfFont.A = *lplf;
1731 pIC->fdwInit |= INIT_LOGFONT;
1732 hWnd = pIC->hWnd;
1733
1734 ImmUnlockIMC(hIMC);
1735
1738 return TRUE;
1739}
BOOL WINAPI ImmSetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf)
Definition: ime.c:1744
BOOL APIENTRY Imm32MakeIMENotify(HIMC hIMC, HWND hwnd, DWORD dwAction, DWORD_PTR dwIndex, DWORD_PTR dwValue, DWORD_PTR dwCommand, DWORD_PTR dwData)
Definition: utils.c:428
LCID WINAPI GetSystemDefaultLCID(void)
Definition: locale.c:1229
struct INPUTCONTEXTDX * LPINPUTCONTEXTDX
#define IMN_SETCOMPOSITIONFONT
Definition: imm.h:381
#define CFS_DEFAULT
Definition: imm.h:323
#define IMC_SETCOMPOSITIONFONT
Definition: imm.h:151
#define WM_IME_REPORT
Definition: immdev.h:188
#define NI_CONTEXTUPDATED
Definition: immdev.h:397
#define IR_CHANGECONVERT
Definition: immdev.h:195
USHORT LANGID
Definition: mui.h:9
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define LANG_JAPANESE
Definition: nls.h:76
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define _WIN32_WINNT_NT4
Definition: sdkddkver.h:20
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT _In_ UCHAR _In_opt_ USHORT LangID
Definition: wdfusb.h:1083
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

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

◆ ImmSetCompositionFontW()

BOOL WINAPI ImmSetCompositionFontW ( HIMC  hIMC,
LPLOGFONTW  lplf 
)

Definition at line 1744 of file ime.c.

1745{
1746 LOGFONTA lfA;
1747 PCLIENTIMC pClientImc;
1748 BOOL bWide;
1749 HWND hWnd;
1750 LPINPUTCONTEXTDX pIC;
1751 LANGID LangID;
1752
1753 TRACE("(%p, %p)\n", hIMC, lplf);
1754
1755 if (IS_CROSS_THREAD_HIMC(hIMC))
1756 return FALSE;
1757
1758 pClientImc = ImmLockClientImc(hIMC);
1759 if (IS_NULL_UNEXPECTEDLY(pClientImc))
1760 return FALSE;
1761
1762 bWide = (pClientImc->dwFlags & CLIENTIMC_WIDE);
1763 ImmUnlockClientImc(pClientImc);
1764
1765 if (!bWide)
1766 {
1767 LogFontWideToAnsi(lplf, &lfA);
1768 return ImmSetCompositionFontA(hIMC, &lfA);
1769 }
1770
1771 pIC = (LPINPUTCONTEXTDX)ImmLockIMC(hIMC);
1772 if (IS_NULL_UNEXPECTEDLY(pIC))
1773 return FALSE;
1774
1775 if (GetWin32ClientInfo()->dwExpWinVer < _WIN32_WINNT_NT4) /* old version (3.x)? */
1776 {
1779 !(pIC->dwUIFlags & 2) &&
1780 pIC->cfCompForm.dwStyle != CFS_DEFAULT)
1781 {
1783 }
1784 }
1785
1786 pIC->lfFont.W = *lplf;
1787 pIC->fdwInit |= INIT_LOGFONT;
1788 hWnd = pIC->hWnd;
1789
1790 ImmUnlockIMC(hIMC);
1791
1794 return TRUE;
1795}
BOOL WINAPI ImmSetCompositionFontA(HIMC hIMC, LPLOGFONTA lplf)
Definition: ime.c:1688
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by ActiveIMMApp_SetCompositionFontW(), EDIT_WM_SetFont(), ImeWnd_OnImeControl(), ImeWnd_OnImeSystem(), ImmSetCompositionFontA(), ME_HandleMessage(), and update_caret().

◆ ImmSetCompositionWindow()

BOOL WINAPI ImmSetCompositionWindow ( HIMC  hIMC,
LPCOMPOSITIONFORM  lpCompForm 
)

Definition at line 1583 of file ime.c.

1584{
1585 LPINPUTCONTEXTDX pIC;
1586 HWND hWnd;
1587
1588 if (IS_CROSS_THREAD_HIMC(hIMC))
1589 return FALSE;
1590
1591 pIC = (LPINPUTCONTEXTDX)ImmLockIMC(hIMC);
1592 if (IS_NULL_UNEXPECTEDLY(pIC))
1593 return FALSE;
1594
1595 pIC->cfCompForm = *lpCompForm;
1596 pIC->fdwInit |= INIT_COMPFORM;
1597
1598 if (pIC->dwUIFlags & 0x8)
1599 pIC->dwUIFlags &= ~0x8;
1600 else
1601 pIC->dwUIFlags &= ~0x2;
1602
1603 hWnd = pIC->hWnd;
1604
1605 ImmUnlockIMC(hIMC);
1606
1609 return TRUE;
1610}
#define IMC_SETCOMPOSITIONWINDOW
Definition: imm.h:153
#define IMN_SETCOMPOSITIONWINDOW
Definition: imm.h:382

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

◆ ImmSetConversionStatus()

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

Definition at line 1941 of file ime.c.

1942{
1943 HKL hKL;
1944 LPINPUTCONTEXT pIC;
1945 DWORD dwOldConversion, dwOldSentence;
1946 BOOL fOpen = FALSE, fConversionChange = FALSE, fSentenceChange = FALSE, fUseCicero = FALSE;
1947 HWND hWnd;
1948
1949 TRACE("(%p, 0x%lX, 0x%lX)\n", hIMC, fdwConversion, fdwSentence);
1950
1951 hKL = GetKeyboardLayout(0);
1952 if (!IS_IME_HKL(hKL) && IS_CICERO_MODE() && !IS_16BIT_MODE())
1953 fUseCicero = TRUE;
1954
1955 if (IS_CROSS_THREAD_HIMC(hIMC))
1956 return FALSE;
1957
1958 pIC = ImmLockIMC(hIMC);
1959 if (IS_NULL_UNEXPECTEDLY(pIC))
1960 return FALSE;
1961
1962 if (pIC->fdwConversion != fdwConversion)
1963 {
1964 dwOldConversion = pIC->fdwConversion;
1965 pIC->fdwConversion = fdwConversion;
1966 fConversionChange = TRUE;
1967 }
1968
1969 if (pIC->fdwSentence != fdwSentence)
1970 {
1971 dwOldSentence = pIC->fdwSentence;
1972 pIC->fdwSentence = fdwSentence;
1973 fSentenceChange = TRUE;
1974 }
1975
1976 hWnd = pIC->hWnd;
1977 fOpen = pIC->fOpen;
1978 ImmUnlockIMC(hIMC);
1979
1980 if (fConversionChange || fUseCicero)
1981 {
1982 Imm32MakeIMENotify(hIMC, hWnd, NI_CONTEXTUPDATED, dwOldConversion,
1984 if (fConversionChange)
1985 NtUserNotifyIMEStatus(hWnd, fOpen, fdwConversion);
1986 }
1987
1988 if (fSentenceChange || fUseCicero)
1989 {
1990 Imm32MakeIMENotify(hIMC, hWnd, NI_CONTEXTUPDATED, dwOldSentence,
1992 }
1993
1994 return TRUE;
1995}
#define IMN_SETSENTENCEMODE
Definition: imm.h:378
#define IMN_SETCONVERSIONMODE
Definition: imm.h:377
#define IMC_SETCONVERSIONMODE
Definition: immdev.h:392
#define IMC_SETSENTENCEMODE
Definition: immdev.h:393
DWORD NTAPI NtUserNotifyIMEStatus(HWND hwnd, BOOL fOpen, DWORD dwConversion)
Definition: ime.c:803

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

◆ ImmSetOpenStatus()

BOOL WINAPI ImmSetOpenStatus ( HIMC  hIMC,
BOOL  fOpen 
)

Definition at line 1466 of file ime.c.

1467{
1468 DWORD dwConversion;
1469 LPINPUTCONTEXT pIC;
1470 HWND hWnd;
1471 BOOL bHasChange = FALSE;
1472
1473 TRACE("(%p, %d)\n", hIMC, fOpen);
1474
1475 if (IS_CROSS_THREAD_HIMC(hIMC))
1476 return FALSE;
1477
1478 pIC = ImmLockIMC(hIMC);
1479 if (IS_NULL_UNEXPECTEDLY(pIC))
1480 return FALSE;
1481
1482 if (pIC->fOpen != fOpen)
1483 {
1484 pIC->fOpen = fOpen;
1485 hWnd = pIC->hWnd;
1486 dwConversion = pIC->fdwConversion;
1487 bHasChange = TRUE;
1488 }
1489
1490 ImmUnlockIMC(hIMC);
1491
1492 if (bHasChange)
1493 {
1496 NtUserNotifyIMEStatus(hWnd, fOpen, dwConversion);
1497 }
1498 else
1499 {
1500 TRACE("No change.\n");
1501 }
1502
1503 return TRUE;
1504}
#define IMN_SETOPENSTATUS
Definition: imm.h:379
#define IMC_SETOPENSTATUS
Definition: immdev.h:394

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

◆ ImmSetStatusWindowPos()

BOOL WINAPI ImmSetStatusWindowPos ( HIMC  hIMC,
LPPOINT  lpptPos 
)

Definition at line 1531 of file ime.c.

1532{
1533 LPINPUTCONTEXT pIC;
1534 HWND hWnd;
1535
1536 TRACE("(%p, {%ld, %ld})\n", hIMC, lpptPos->x, lpptPos->y);
1537
1538 if (IS_CROSS_THREAD_HIMC(hIMC))
1539 return FALSE;
1540
1541 pIC = ImmLockIMC(hIMC);
1542 if (IS_NULL_UNEXPECTEDLY(pIC))
1543 return FALSE;
1544
1545 hWnd = pIC->hWnd;
1546 pIC->ptStatusWndPos = *lpptPos;
1547 pIC->fdwInit |= INIT_STATUSWNDPOS;
1548
1549 ImmUnlockIMC(hIMC);
1550
1553 return TRUE;
1554}
#define IMN_SETSTATUSWINDOWPOS
Definition: imm.h:383
#define IMC_SETSTATUSWINDOWPOS
Definition: imm.h:155
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48

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

◆ ImmUnlockImeDpi()

VOID WINAPI ImmUnlockImeDpi ( PIMEDPI  pImeDpi)

Definition at line 1007 of file ime.c.

1008{
1009 PIMEDPI *ppEntry;
1010
1011 TRACE("(%p)\n", pImeDpi);
1012
1013 if (pImeDpi == NULL)
1014 return;
1015
1017
1018 /* unlock */
1019 --(pImeDpi->cLockObj);
1020 if (pImeDpi->cLockObj != 0)
1021 {
1023 return;
1024 }
1025
1026 if ((pImeDpi->dwFlags & IMEDPI_FLAG_UNLOADED) == 0)
1027 {
1028 if ((pImeDpi->dwFlags & IMEDPI_FLAG_LOCKED) == 0 ||
1029 (pImeDpi->ImeInfo.fdwProperty & IME_PROP_END_UNLOAD) == 0)
1030 {
1032 return;
1033 }
1034 }
1035
1036 /* Remove from list */
1037 for (ppEntry = &gpImeDpiList; *ppEntry; ppEntry = &((*ppEntry)->pNext))
1038 {
1039 if (*ppEntry == pImeDpi) /* found */
1040 {
1041 *ppEntry = pImeDpi->pNext;
1042 break;
1043 }
1044 }
1045
1046 Imm32FreeIME(pImeDpi, TRUE);
1047 ImmLocalFree(pImeDpi);
1048
1050}

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

◆ ImmWINNLSEnableIME()

BOOL WINAPI ImmWINNLSEnableIME ( HWND  hWnd,
BOOL  enable 
)

Definition at line 2136 of file ime.c.

2137{
2138 HIMC hIMC;
2139 PCLIENTIMC pClientImc;
2140 HWND hImeWnd;
2141 BOOL bImeWnd, ret;
2142
2143 TRACE("(%p, %d)\n", hWnd, enable);
2144
2146 {
2148 return FALSE;
2149 }
2150
2152 if (IS_NULL_UNEXPECTEDLY(hIMC))
2153 return FALSE;
2154
2155 pClientImc = ImmLockClientImc(hIMC);
2156 if (IS_NULL_UNEXPECTEDLY(pClientImc))
2157 return FALSE;
2158
2159 ret = !(pClientImc->dwFlags & CLIENTIMC_DISABLEIME);
2160 if (!!enable == ret)
2161 {
2162 TRACE("Same\n");
2163 ImmUnlockClientImc(pClientImc);
2164 return ret;
2165 }
2166
2167 if (!IsWindow(hWnd))
2168 hWnd = GetFocus();
2169
2170 hImeWnd = ImmGetDefaultIMEWnd(hWnd);
2171 bImeWnd = IsWindow(hImeWnd);
2172 if (bImeWnd)
2174
2175 if (enable)
2176 pClientImc->dwFlags &= ~CLIENTIMC_DISABLEIME;
2177 else
2178 pClientImc->dwFlags |= CLIENTIMC_DISABLEIME;
2179
2180 ImmUnlockClientImc(pClientImc);
2181
2182 if (bImeWnd)
2183 ImmSetActiveContext(hWnd, (enable ? hIMC : NULL), TRUE);
2184
2185 return ret;
2186}
DWORD HIMC
Definition: dimm.idl:75
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define SetLastError(x)
Definition: compat.h:752
HWND WINAPI ImmGetDefaultIMEWnd(HWND hWnd)
Definition: ime.c:890
BOOL WINAPI ImmSetActiveContext(HWND hWnd, HIMC hIMC, BOOL fActive)
Definition: imm.c:1124
BOOL APIENTRY Imm32IsSystemJapaneseOrKorean(VOID)
Definition: utils.c:69
GLboolean enable
Definition: glext.h:11120
#define CLIENTIMC_DISABLEIME
Definition: imm32_undoc.h:142
@ THREADSTATE_DEFAULTINPUTCONTEXT
Definition: ntuser.h:2476
HWND WINAPI GetFocus(void)
Definition: window.c:1893

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

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( imm  )

Variable Documentation

◆ gcsImeDpi

◆ gpImeDpiList

PIMEDPI gpImeDpiList = NULL