1 /* 2 * PROJECT: ReactOS Kernel 3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) 4 * PURPOSE: Private header for imm32.dll 5 * COPYRIGHT: Copyright 2021 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com> 6 */ 7 8 #pragma once 9 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 14 #include <immdev.h> 15 16 #define IME_MASK (0xE0000000UL) 17 #define SUBST_MASK (0xD0000000UL) 18 #define SPECIAL_MASK (0xF0000000UL) 19 20 #define IS_IME_HKL(hKL) ((((ULONG_PTR)(hKL)) & 0xF0000000) == IME_MASK) 21 #define IS_SPECIAL_HKL(hKL) ((((ULONG_PTR)(hKL)) & 0xF0000000) == SPECIAL_MASK) 22 #define SPECIALIDFROMHKL(hKL) ((WORD)(HIWORD(hKL) & 0x0FFF)) 23 24 #define IS_IME_KLID(dwKLID) ((((ULONG)(dwKLID)) & 0xF0000000) == IME_MASK) 25 #define IS_SUBST_KLID(dwKLID) ((((ULONG)(dwKLID)) & 0xF0000000) == SUBST_MASK) 26 27 /* The special values for ImmFreeLayout hKL */ 28 #define HKL_SWITCH_TO_NON_IME ((HKL)UlongToHandle(1)) 29 #define HKL_RELEASE_IME ((HKL)UlongToHandle(2)) 30 31 typedef struct tagIMEINFOEX 32 { 33 HKL hkl; 34 IMEINFO ImeInfo; 35 WCHAR wszUIClass[16]; 36 ULONG fdwInitConvMode; 37 INT fInitOpen; 38 INT fLoadFlag; 39 DWORD dwProdVersion; 40 DWORD dwImeWinVersion; 41 WCHAR wszImeDescription[50]; 42 WCHAR wszImeFile[80]; 43 struct 44 { 45 INT fSysWow64Only:1; 46 INT fCUASLayer:1; 47 }; 48 } IMEINFOEX, *PIMEINFOEX, NEAR *NPIMEINFOEX, FAR *LPIMEINFOEX; 49 50 typedef enum IMEINFOEXCLASS 51 { 52 ImeInfoExKeyboardLayout, 53 ImeInfoExKeyboardLayoutTFS, 54 ImeInfoExImeWindow, 55 ImeInfoExImeFileName 56 } IMEINFOEXCLASS; 57 58 #define DEFINE_IME_ENTRY(type, name, params, extended) typedef type (WINAPI *FN_##name) params; 59 #include <imetable.h> 60 #undef DEFINE_IME_ENTRY 61 62 typedef struct IMEDPI 63 { 64 struct IMEDPI *pNext; 65 HINSTANCE hInst; 66 HKL hKL; 67 IMEINFO ImeInfo; 68 UINT uCodePage; 69 WCHAR szUIClass[16]; 70 DWORD cLockObj; 71 DWORD dwFlags; 72 #define DEFINE_IME_ENTRY(type, name, params, extended) FN_##name name; 73 #include <imetable.h> 74 #undef DEFINE_IME_ENTRY 75 } IMEDPI, *PIMEDPI, NEAR *NPIMEDPI, FAR *LPIMEDPI; 76 77 #ifndef _WIN64 78 C_ASSERT(offsetof(IMEDPI, pNext) == 0x0); 79 C_ASSERT(offsetof(IMEDPI, hInst) == 0x4); 80 C_ASSERT(offsetof(IMEDPI, hKL) == 0x8); 81 C_ASSERT(offsetof(IMEDPI, ImeInfo) == 0xc); 82 C_ASSERT(offsetof(IMEDPI, uCodePage) == 0x28); 83 C_ASSERT(offsetof(IMEDPI, szUIClass) == 0x2c); 84 C_ASSERT(offsetof(IMEDPI, cLockObj) == 0x4c); 85 C_ASSERT(offsetof(IMEDPI, dwFlags) == 0x50); 86 C_ASSERT(offsetof(IMEDPI, ImeInquire) == 0x54); 87 C_ASSERT(offsetof(IMEDPI, ImeConversionList) == 0x58); 88 C_ASSERT(offsetof(IMEDPI, ImeRegisterWord) == 0x5c); 89 C_ASSERT(offsetof(IMEDPI, ImeUnregisterWord) == 0x60); 90 C_ASSERT(offsetof(IMEDPI, ImeGetRegisterWordStyle) == 0x64); 91 C_ASSERT(offsetof(IMEDPI, ImeEnumRegisterWord) == 0x68); 92 C_ASSERT(offsetof(IMEDPI, ImeConfigure) == 0x6c); 93 C_ASSERT(offsetof(IMEDPI, ImeDestroy) == 0x70); 94 C_ASSERT(offsetof(IMEDPI, ImeEscape) == 0x74); 95 C_ASSERT(offsetof(IMEDPI, ImeProcessKey) == 0x78); 96 C_ASSERT(offsetof(IMEDPI, ImeSelect) == 0x7c); 97 C_ASSERT(offsetof(IMEDPI, ImeSetActiveContext) == 0x80); 98 C_ASSERT(offsetof(IMEDPI, ImeToAsciiEx) == 0x84); 99 C_ASSERT(offsetof(IMEDPI, NotifyIME) == 0x88); 100 C_ASSERT(offsetof(IMEDPI, ImeSetCompositionString) == 0x8c); 101 C_ASSERT(offsetof(IMEDPI, ImeGetImeMenuItems) == 0x90); 102 C_ASSERT(offsetof(IMEDPI, CtfImeInquireExW) == 0x94); 103 C_ASSERT(offsetof(IMEDPI, CtfImeSelectEx) == 0x98); 104 C_ASSERT(offsetof(IMEDPI, CtfImeEscapeEx) == 0x9c); 105 C_ASSERT(offsetof(IMEDPI, CtfImeGetGuidAtom) == 0xa0); 106 C_ASSERT(offsetof(IMEDPI, CtfImeIsGuidMapEnable) == 0xa4); 107 C_ASSERT(sizeof(IMEDPI) == 0xa8); 108 #endif 109 110 /* flags for IMEDPI.dwFlags */ 111 #define IMEDPI_FLAG_UNLOADED 0x1 112 #define IMEDPI_FLAG_LOCKED 0x2 113 114 PIMEDPI WINAPI ImmLockImeDpi(_In_ HKL hKL); 115 VOID WINAPI ImmUnlockImeDpi(_Inout_ PIMEDPI pImeDpi); 116 117 /* unconfirmed */ 118 typedef struct tagCLIENTIMC 119 { 120 HANDLE hInputContext; /* LocalAlloc'ed LHND */ 121 LONG cLockObj; 122 DWORD dwFlags; 123 DWORD dwCompatFlags; 124 RTL_CRITICAL_SECTION cs; 125 UINT uCodePage; 126 HKL hKL; 127 BOOL bCtfIme; 128 } CLIENTIMC, *PCLIENTIMC, NEAR *NPCLIENTIMC, FAR *LPCLIENTIMC; 129 130 #ifndef _WIN64 131 C_ASSERT(offsetof(CLIENTIMC, hInputContext) == 0x0); 132 C_ASSERT(offsetof(CLIENTIMC, cLockObj) == 0x4); 133 C_ASSERT(offsetof(CLIENTIMC, dwFlags) == 0x8); 134 C_ASSERT(offsetof(CLIENTIMC, dwCompatFlags) == 0xc); 135 C_ASSERT(offsetof(CLIENTIMC, cs) == 0x10); 136 C_ASSERT(offsetof(CLIENTIMC, uCodePage) == 0x28); 137 C_ASSERT(offsetof(CLIENTIMC, hKL) == 0x2c); 138 C_ASSERT(sizeof(CLIENTIMC) == 0x34); 139 #endif 140 141 /* flags for CLIENTIMC */ 142 #define CLIENTIMC_WIDE 0x1 143 #define CLIENTIMC_ACTIVE 0x2 144 #define CLIENTIMC_UNKNOWN4 0x20 145 #define CLIENTIMC_DESTROY 0x40 146 #define CLIENTIMC_DISABLEIME 0x80 147 #define CLIENTIMC_UNKNOWN2 0x100 148 149 PCLIENTIMC WINAPI ImmLockClientImc(_In_ HIMC hImc); 150 VOID WINAPI ImmUnlockClientImc(_Inout_ PCLIENTIMC pClientImc); 151 152 struct IME_STATE; 153 154 /* unconfirmed */ 155 #ifdef __cplusplus 156 typedef struct INPUTCONTEXTDX : INPUTCONTEXT 157 { 158 #else 159 typedef struct INPUTCONTEXTDX 160 { 161 INPUTCONTEXT; 162 #endif 163 UINT nVKey; // +0x140 164 BOOL bNeedsTrans; // +0x144 165 DWORD dwUnknown1; 166 DWORD dwUIFlags; // +0x14c 167 DWORD dwUnknown2; 168 struct IME_STATE *pState; // +0x154 169 DWORD dwChange; // +0x158 170 HIMCC hCtfImeContext; 171 } INPUTCONTEXTDX, *PINPUTCONTEXTDX, NEAR *NPINPUTCONTEXTDX, FAR *LPINPUTCONTEXTDX; 172 173 typedef struct IME_SUBSTATE 174 { 175 struct IME_SUBSTATE *pNext; 176 HKL hKL; 177 DWORD dwValue; 178 } IME_SUBSTATE, *PIME_SUBSTATE, NEAR *NPIME_SUBSTATE, FAR *PIME_SUBSTATE; 179 180 #ifndef _WIN64 181 C_ASSERT(sizeof(IME_SUBSTATE) == 0xc); 182 #endif 183 184 typedef struct IME_STATE 185 { 186 struct IME_STATE *pNext; 187 WORD wLang; 188 WORD fOpen; 189 DWORD dwConversion; 190 DWORD dwSentence; 191 DWORD dwInit; 192 PIME_SUBSTATE pSubState; 193 } IME_STATE, *PIME_STATE, NEAR *NPIME_STATE, FAR *LPIME_STATE; 194 195 #ifndef _WIN64 196 C_ASSERT(sizeof(IME_STATE) == 0x18); 197 #endif 198 199 /* for WM_IME_REPORT IR_UNDETERMINE */ 200 typedef struct tagUNDETERMINESTRUCT 201 { 202 DWORD dwSize; 203 UINT uDefIMESize; 204 UINT uDefIMEPos; 205 UINT uUndetTextLen; 206 UINT uUndetTextPos; 207 UINT uUndetAttrPos; 208 UINT uCursorPos; 209 UINT uDeltaStart; 210 UINT uDetermineTextLen; 211 UINT uDetermineTextPos; 212 UINT uDetermineDelimPos; 213 UINT uYomiTextLen; 214 UINT uYomiTextPos; 215 UINT uYomiDelimPos; 216 } UNDETERMINESTRUCT, *PUNDETERMINESTRUCT, *LPUNDETERMINESTRUCT; 217 218 UINT WINAPI GetKeyboardLayoutCP(_In_ LANGID wLangId); 219 220 BOOL WINAPI 221 ImmGetImeInfoEx( 222 _Out_ PIMEINFOEX pImeInfoEx, 223 _In_ IMEINFOEXCLASS SearchType, 224 _In_ PVOID pvSearchKey); 225 226 BOOL WINAPI ImmLoadLayout(_In_ HKL hKL, _Inout_ PIMEINFOEX pImeInfoEx); 227 DWORD WINAPI ImmGetAppCompatFlags(_In_ HIMC hIMC); 228 BOOL WINAPI ImmSetActiveContext(_In_ HWND hwnd, _In_ HIMC hIMC, _In_ BOOL fFlag); 229 BOOL WINAPI ImmLoadIME(_In_ HKL hKL); 230 DWORD WINAPI ImmProcessKey(_In_ HWND, _In_ HKL, _In_ UINT, _In_ LPARAM, _In_ DWORD); 231 232 HRESULT WINAPI CtfAImmActivate(_Out_opt_ HINSTANCE *phinstCtfIme); 233 HRESULT WINAPI CtfAImmDeactivate(_In_ BOOL bDestroy); 234 BOOL WINAPI CtfAImmIsIME(_In_ HKL hKL); 235 BOOL WINAPI CtfImmIsCiceroStartedInThread(VOID); 236 VOID WINAPI CtfImmSetCiceroStartInThread(_In_ BOOL bStarted); 237 VOID WINAPI CtfImmSetAppCompatFlags(_In_ DWORD dwFlags); 238 DWORD WINAPI CtfImmHideToolbarWnd(VOID); 239 VOID WINAPI CtfImmRestoreToolbarWnd(_In_ LPVOID pUnused, _In_ DWORD dwShowFlags); 240 BOOL WINAPI CtfImmGenerateMessage(_In_ HIMC hIMC, _In_ BOOL bSend); 241 VOID WINAPI CtfImmCoUninitialize(VOID); 242 VOID WINAPI CtfImmEnterCoInitCountSkipMode(VOID); 243 BOOL WINAPI CtfImmLeaveCoInitCountSkipMode(VOID); 244 HRESULT WINAPI CtfImmLastEnabledWndDestroy(_In_ BOOL bCreate); 245 BOOL WINAPI CtfImmIsCiceroStartedInThread(VOID); 246 HRESULT WINAPI CtfImmTIMActivate(_In_ HKL hKL); 247 BOOL WINAPI CtfImmIsTextFrameServiceDisabled(VOID); 248 249 LRESULT WINAPI 250 CtfImmDispatchDefImeMessage( 251 _In_ HWND hWnd, 252 _In_ UINT uMsg, 253 _In_ WPARAM wParam, 254 _In_ LPARAM lParam); 255 256 #ifdef __cplusplus 257 } // extern "C" 258 #endif 259