ReactOS  0.4.15-dev-4857-g47842d7
immdev.h
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS headers
3  * LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
4  * PURPOSE: Providing DDK-compatible <immdev.h> and IME/IMM development helper
5  * COPYRIGHT: Copyright 2021-2022 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6  */
7 
8 #ifndef _IMMDEV_
9 #define _IMMDEV_
10 
11 #pragma once
12 
13 #include <wingdi.h>
14 #include <imm.h>
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 /* wParam for WM_IME_CONTROL */
21 #define IMC_GETCONVERSIONMODE 0x0001
22 #define IMC_GETSENTENCEMODE 0x0003
23 #define IMC_GETOPENSTATUS 0x0005
24 #define IMC_GETSOFTKBDPOS 0x0013
25 #define IMC_SETSOFTKBDPOS 0x0014
26 
27 /* wParam for WM_IME_SYSTEM */
28 #define IMS_IMEACTIVATE 0x17
29 #define IMS_IMEDEACTIVATE 0x18
30 #define IMS_ACTIVATELAYOUT 0x19
31 
32 #define IMMGWL_IMC 0
33 #define IMMGWL_PRIVATE (sizeof(LONG))
34 
35 #define IMMGWLP_IMC 0
36 #define IMMGWLP_PRIVATE (sizeof(LONG_PTR))
37 
38 typedef struct _tagINPUTCONTEXT {
45  union {
48  } lfFont;
60 
61 #ifdef _WIN64
63 C_ASSERT(offsetof(INPUTCONTEXT, fOpen) == 0x8);
64 C_ASSERT(offsetof(INPUTCONTEXT, ptStatusWndPos) == 0xc);
65 C_ASSERT(offsetof(INPUTCONTEXT, ptSoftKbdPos) == 0x14);
66 C_ASSERT(offsetof(INPUTCONTEXT, fdwConversion) == 0x1c);
67 C_ASSERT(offsetof(INPUTCONTEXT, fdwSentence) == 0x20);
68 C_ASSERT(offsetof(INPUTCONTEXT, lfFont) == 0x24);
69 C_ASSERT(offsetof(INPUTCONTEXT, cfCompForm) == 0x80);
70 C_ASSERT(offsetof(INPUTCONTEXT, cfCandForm) == 0x9c);
71 C_ASSERT(offsetof(INPUTCONTEXT, hCompStr) == 0x120);
72 C_ASSERT(offsetof(INPUTCONTEXT, hCandInfo) == 0x128);
73 C_ASSERT(offsetof(INPUTCONTEXT, hGuideLine) == 0x130);
74 C_ASSERT(offsetof(INPUTCONTEXT, hPrivate) == 0x138);
75 C_ASSERT(offsetof(INPUTCONTEXT, dwNumMsgBuf) == 0x140);
76 C_ASSERT(offsetof(INPUTCONTEXT, hMsgBuf) == 0x148);
77 C_ASSERT(offsetof(INPUTCONTEXT, fdwInit) == 0x150);
78 C_ASSERT(offsetof(INPUTCONTEXT, dwReserve) == 0x154);
79 C_ASSERT(sizeof(INPUTCONTEXT) == 0x160);
80 #else
82 C_ASSERT(offsetof(INPUTCONTEXT, fOpen) == 0x4);
83 C_ASSERT(offsetof(INPUTCONTEXT, ptStatusWndPos) == 0x8);
84 C_ASSERT(offsetof(INPUTCONTEXT, ptSoftKbdPos) == 0x10);
85 C_ASSERT(offsetof(INPUTCONTEXT, fdwConversion) == 0x18);
86 C_ASSERT(offsetof(INPUTCONTEXT, fdwSentence) == 0x1c);
87 C_ASSERT(offsetof(INPUTCONTEXT, lfFont) == 0x20);
88 C_ASSERT(offsetof(INPUTCONTEXT, cfCompForm) == 0x7c);
89 C_ASSERT(offsetof(INPUTCONTEXT, cfCandForm) == 0x98);
90 C_ASSERT(offsetof(INPUTCONTEXT, hCompStr) == 0x118);
91 C_ASSERT(offsetof(INPUTCONTEXT, hCandInfo) == 0x11c);
92 C_ASSERT(offsetof(INPUTCONTEXT, hGuideLine) == 0x120);
93 C_ASSERT(offsetof(INPUTCONTEXT, hPrivate) == 0x124);
94 C_ASSERT(offsetof(INPUTCONTEXT, dwNumMsgBuf) == 0x128);
95 C_ASSERT(offsetof(INPUTCONTEXT, hMsgBuf) == 0x12c);
96 C_ASSERT(offsetof(INPUTCONTEXT, fdwInit) == 0x130);
97 C_ASSERT(offsetof(INPUTCONTEXT, dwReserve) == 0x134);
98 C_ASSERT(sizeof(INPUTCONTEXT) == 0x140);
99 #endif
100 
101 struct IME_STATE;
102 
103 typedef struct INPUTCONTEXTDX /* unconfirmed */
104 {
111  struct IME_STATE *pState;
115 
116 #ifndef _WIN64
117 C_ASSERT(offsetof(INPUTCONTEXTDX, nVKey) == 0x140);
118 C_ASSERT(offsetof(INPUTCONTEXTDX, bNeedsTrans) == 0x144);
119 C_ASSERT(offsetof(INPUTCONTEXTDX, dwUIFlags) == 0x14c);
120 C_ASSERT(offsetof(INPUTCONTEXTDX, pState) == 0x154);
121 C_ASSERT(offsetof(INPUTCONTEXTDX, dwChange) == 0x158);
122 C_ASSERT(sizeof(INPUTCONTEXTDX) == 0x160);
123 #endif
124 
125 // bits of fdwInit of INPUTCONTEXT
126 #define INIT_STATUSWNDPOS 0x00000001
127 #define INIT_CONVERSION 0x00000002
128 #define INIT_SENTENCE 0x00000004
129 #define INIT_LOGFONT 0x00000008
130 #define INIT_COMPFORM 0x00000010
131 #define INIT_SOFTKBDPOS 0x00000020
132 
133 // bits for INPUTCONTEXTDX.dwChange
134 #define INPUTCONTEXTDX_CHANGE_OPEN 0x1
135 #define INPUTCONTEXTDX_CHANGE_CONVERSION 0x2
136 #define INPUTCONTEXTDX_CHANGE_SENTENCE 0x4
137 #define INPUTCONTEXTDX_CHANGE_FORCE_OPEN 0x100
138 
139 #ifndef WM_IME_REPORT
140  #define WM_IME_REPORT 0x280
141 #endif
142 
143 // WM_IME_REPORT wParam
144 #define IR_STRINGSTART 0x100
145 #define IR_STRINGEND 0x101
146 #define IR_OPENCONVERT 0x120
147 #define IR_CHANGECONVERT 0x121
148 #define IR_CLOSECONVERT 0x122
149 #define IR_FULLCONVERT 0x123
150 #define IR_IMESELECT 0x130
151 #define IR_STRING 0x140
152 #define IR_DBCSCHAR 0x160
153 #define IR_UNDETERMINE 0x170
154 #define IR_STRINGEX 0x180
155 #define IR_MODEINFO 0x190
156 
157 // for IR_UNDETERMINE
158 typedef struct tagUNDETERMINESTRUCT
159 {
175 
177 
178 typedef struct IME_SUBSTATE
179 {
184 
185 #ifndef _WIN64
186 C_ASSERT(sizeof(IME_SUBSTATE) == 0xc);
187 #endif
188 
189 typedef struct IME_STATE
190 {
191  struct IME_STATE *pNext;
199 
200 #ifndef _WIN64
201 C_ASSERT(sizeof(IME_STATE) == 0x18);
202 #endif
203 
204 #ifdef __cplusplus
205 } // extern "C"
206 #endif
207 
208 #endif /* ndef _IMMDEV_ */
DWORD HIMCC
Definition: dimm.idl:76
LOGFONTA A
Definition: immdev.h:46
DWORD dwUIFlags
Definition: immdev.h:109
DWORD dwInit
Definition: immdev.h:196
GLint x0
Definition: linetemp.h:95
struct tagUNDETERMINESTRUCT * LPUNDETERMINESTRUCT
CANDIDATEFORM cfCandForm[4]
Definition: immdev.h:50
struct _tagINPUTCONTEXT INPUTCONTEXT
HWND hWnd
Definition: settings.c:17
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC)
Definition: imm.c:1023
struct tagUNDETERMINESTRUCT UNDETERMINESTRUCT
DWORD fdwConversion
Definition: immdev.h:43
DWORD dwChange
Definition: immdev.h:112
HIMCC hPrivate
Definition: immdev.h:54
struct INPUTCONTEXTDX INPUTCONTEXTDX
struct IME_STATE IME_STATE
POINT ptSoftKbdPos
Definition: immdev.h:42
struct _tagINPUTCONTEXT * LPINPUTCONTEXT
DWORD dwSentence
Definition: immdev.h:195
HIMCC hCandInfo
Definition: immdev.h:52
DWORD dwUnknown2
Definition: immdev.h:110
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL bNeedsTrans
Definition: immdev.h:107
WORD wLang
Definition: immdev.h:192
DWORD dwUnknown5
Definition: immdev.h:113
UINT nVKey
Definition: immdev.h:106
UINT uDetermineTextPos
Definition: immdev.h:169
DWORD dwReserve[3]
Definition: immdev.h:58
POINT ptStatusWndPos
Definition: immdev.h:41
#define offsetof(TYPE, MEMBER)
DWORD HIMC
Definition: dimm.idl:75
C_ASSERT(offsetof(INPUTCONTEXT, hWnd)==0x0)
struct _tagINPUTCONTEXT * PINPUTCONTEXT
DWORD dwUnknown1
Definition: immdev.h:108
WORD fOpen
Definition: immdev.h:193
#define WINAPI
Definition: msvc.h:6
struct INPUTCONTEXTDX * LPINPUTCONTEXTDX
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
COMPOSITIONFORM cfCompForm
Definition: immdev.h:49
HIMCC hMsgBuf
Definition: immdev.h:56
HIMCC hCompStr
Definition: immdev.h:51
UINT uDetermineDelimPos
Definition: immdev.h:170
DWORD fdwInit
Definition: immdev.h:57
UINT_PTR HKL
Definition: msctf.idl:101
PIME_SUBSTATE pSubState
Definition: immdev.h:197
DWORD dwValue
Definition: immdev.h:182
DWORD dwConversion
Definition: immdev.h:194
HIMCC hGuideLine
Definition: immdev.h:53
DWORD dwNumMsgBuf
Definition: immdev.h:55
struct IME_STATE * PIME_STATE
unsigned int UINT
Definition: ndis.h:50
struct IME_SUBSTATE * PIME_SUBSTATE
UINT uDetermineTextLen
Definition: immdev.h:168
struct IME_STATE * pState
Definition: immdev.h:111
DWORD fdwSentence
Definition: immdev.h:44
struct IME_SUBSTATE IME_SUBSTATE
struct IME_STATE * pNext
Definition: immdev.h:191
union _tagINPUTCONTEXT::@1999 lfFont
struct IME_SUBSTATE * pNext
Definition: immdev.h:180
LOGFONTW W
Definition: immdev.h:47
struct tagUNDETERMINESTRUCT * PUNDETERMINESTRUCT