ReactOS 0.4.16-dev-2104-gb84fa49
input.c File Reference
#include <user32.h>
#include <strsafe.h>
Include dependency graph for input.c:

Go to the source code of this file.

Classes

struct  tagIMEHOTKEYENTRY
 

Macros

#define FE_JAPANESE   (1 << 0)
 
#define FE_CHINESE_TRADITIONAL   (1 << 1)
 
#define FE_CHINESE_SIMPLIFIED   (1 << 2)
 
#define FE_KOREAN   (1 << 3)
 
#define MOD_ALL_MODS   (MOD_ALT | MOD_CONTROL | MOD_SHIFT | MOD_WIN)
 
#define ENGLISH_US   MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)
 

Typedefs

typedef struct tagIMEHOTKEYENTRY IMEHOTKEYENTRY
 
typedef struct tagIMEHOTKEYENTRYPIMEHOTKEYENTRY
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (user32)
 
VOID FASTCALL IntSetFeKeyboardFlags (LANGID LangID, PBYTE pbFlags)
 
DWORD FASTCALL CliReadRegistryValue (HANDLE hKey, LPCWSTR pszName)
 
BOOL APIENTRY CliImmSetHotKeyWorker (DWORD dwHotKeyId, UINT uModifiers, UINT uVirtualKey, HKL hKL, DWORD dwAction)
 
VOID IntLoadPreloadKeyboardLayouts (VOID)
 
BOOL APIENTRY CliSaveImeHotKey (DWORD dwID, UINT uModifiers, UINT uVirtualKey, HKL hKL, BOOL bDelete)
 
BOOL WINAPI CliImmSetHotKey (_In_ DWORD dwID, _In_ UINT uModifiers, _In_ UINT uVirtualKey, _In_opt_ _When_((dwAction==SETIMEHOTKEY_ADD) &&!(IME_HOTKEY_DSWITCH_FIRST<=dwHotKeyId &&dwHotKeyId<=IME_HOTKEY_DSWITCH_LAST), _Null_) HKL hKL)
 
BOOL FASTCALL CliSetSingleHotKey (LPCWSTR pszSubKey, HANDLE hKey)
 
BOOL FASTCALL CliGetImeHotKeysFromRegistry (VOID)
 
VOID APIENTRY CliGetPreloadKeyboardLayouts (PBYTE pbFlags)
 
VOID APIENTRY CliSetDefaultImeHotKeys (PIMEHOTKEYENTRY pEntries, UINT nCount, BOOL bCheck)
 
VOID APIENTRY CliImmInitializeHotKeys (DWORD dwAction, HKL hKL)
 
BOOL WINAPI DragDetect (HWND hWnd, POINT pt)
 
BOOL WINAPI EnableWindow (HWND hWnd, BOOL bEnable)
 
SHORT WINAPI DECLSPEC_HOTPATCH GetAsyncKeyState (int vKey)
 
HKL WINAPI GetKeyboardLayout (DWORD idThread)
 
UINT WINAPI GetKBCodePage (VOID)
 
int WINAPI GetKeyNameTextA (LONG lParam, LPSTR lpString, int nSize)
 
int WINAPI GetKeyNameTextW (LONG lParam, LPWSTR lpString, int nSize)
 
SHORT WINAPI DECLSPEC_HOTPATCH GetKeyState (int nVirtKey)
 
BOOL WINAPI GetKeyboardLayoutNameA (LPSTR pwszKLID)
 
BOOL WINAPI GetKeyboardLayoutNameW (LPWSTR pwszKLID)
 
int WINAPI GetKeyboardType (int nTypeFlag)
 
BOOL WINAPI GetLastInputInfo (PLASTINPUTINFO plii)
 
HKL WINAPI LoadKeyboardLayoutA (LPCSTR pszKLID, UINT Flags)
 
static BOOL IsValidKLID (_In_ LPCWSTR pwszKLID)
 
VOID GetSystemLibraryPath (LPWSTR pszPath, INT cchPath, LPCWSTR pszFileName)
 
HKL APIENTRY IntLoadKeyboardLayout (_In_ HKL hklUnload, _In_z_ LPCWSTR pwszKLID, _In_ LANGID wLangID, _In_ UINT Flags, _In_ BOOL unknown5)
 
HKL WINAPI LoadKeyboardLayoutW (LPCWSTR pwszKLID, UINT Flags)
 
HKL WINAPI LoadKeyboardLayoutEx (HKL hklUnload, LPCWSTR pwszKLID, UINT Flags)
 
BOOL WINAPI UnloadKeyboardLayout (HKL hKL)
 
UINT WINAPI MapVirtualKeyA (UINT uCode, UINT uMapType)
 
UINT WINAPI MapVirtualKeyExA (UINT uCode, UINT uMapType, HKL dwhkl)
 
UINT WINAPI MapVirtualKeyExW (UINT uCode, UINT uMapType, HKL dwhkl)
 
UINT WINAPI MapVirtualKeyW (UINT uCode, UINT uMapType)
 
DWORD WINAPI OemKeyScan (WORD wOemChar)
 
BOOL WINAPI SetDoubleClickTime (UINT uInterval)
 
BOOL WINAPI SwapMouseButton (BOOL fSwap)
 
int WINAPI ToAscii (UINT uVirtKey, UINT uScanCode, CONST BYTE *lpKeyState, LPWORD lpChar, UINT uFlags)
 
int WINAPI ToAsciiEx (UINT uVirtKey, UINT uScanCode, CONST BYTE *lpKeyState, LPWORD lpChar, UINT uFlags, HKL dwhkl)
 
int WINAPI ToUnicode (UINT wVirtKey, UINT wScanCode, CONST BYTE *lpKeyState, LPWSTR pwszBuff, int cchBuff, UINT wFlags)
 
int WINAPI ToUnicodeEx (UINT wVirtKey, UINT wScanCode, CONST BYTE *lpKeyState, LPWSTR pwszBuff, int cchBuff, UINT wFlags, HKL dwhkl)
 
SHORT WINAPI VkKeyScanA (CHAR ch)
 
SHORT WINAPI VkKeyScanExA (CHAR ch, HKL dwhkl)
 
SHORT WINAPI VkKeyScanExW (WCHAR ch, HKL dwhkl)
 
SHORT WINAPI VkKeyScanW (WCHAR ch)
 
VOID WINAPI keybd_event (BYTE bVk, BYTE bScan, DWORD dwFlags, ULONG_PTR dwExtraInfo)
 
VOID WINAPI mouse_event (DWORD dwFlags, DWORD dx, DWORD dy, DWORD dwData, ULONG_PTR dwExtraInfo)
 

Variables

IMEHOTKEYENTRY DefaultHotKeyTableJ []
 
IMEHOTKEYENTRY DefaultHotKeyTableT []
 
IMEHOTKEYENTRY DefaultHotKeyTableC []
 

Macro Definition Documentation

◆ ENGLISH_US

Definition at line 700 of file input.c.

◆ FE_CHINESE_SIMPLIFIED

#define FE_CHINESE_SIMPLIFIED   (1 << 2)

Definition at line 65 of file input.c.

◆ FE_CHINESE_TRADITIONAL

#define FE_CHINESE_TRADITIONAL   (1 << 1)

Definition at line 64 of file input.c.

◆ FE_JAPANESE

#define FE_JAPANESE   (1 << 0)

Definition at line 63 of file input.c.

◆ FE_KOREAN

#define FE_KOREAN   (1 << 3)

Definition at line 66 of file input.c.

◆ MOD_ALL_MODS

#define MOD_ALL_MODS   (MOD_ALT | MOD_CONTROL | MOD_SHIFT | MOD_WIN)

Typedef Documentation

◆ IMEHOTKEYENTRY

◆ PIMEHOTKEYENTRY

Function Documentation

◆ CliGetImeHotKeysFromRegistry()

BOOL FASTCALL CliGetImeHotKeysFromRegistry ( VOID  )

Definition at line 318 of file input.c.

319{
320 HKEY hKey;
321 LONG error;
322 BOOL ret = FALSE;
323 DWORD dwIndex, cchKeyName;
324 WCHAR szKeyName[16];
325
327 L"Control Panel\\Input Method\\Hot Keys",
328 0,
329 KEY_READ,
330 &hKey);
331 if (error != ERROR_SUCCESS)
332 return ret;
333
334 for (dwIndex = 0; dwIndex < 1000; ++dwIndex)
335 {
336 cchKeyName = _countof(szKeyName);
337 error = RegEnumKeyExW(hKey, dwIndex, szKeyName, &cchKeyName, NULL, NULL, NULL, NULL);
338 if (error != ERROR_SUCCESS)
339 break;
340
341 szKeyName[_countof(szKeyName) - 1] = 0; /* Avoid stack overrun */
342
343 if (CliSetSingleHotKey(szKeyName, hKey))
344 ret = TRUE;
345 }
346
348 return ret;
349}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
#define error(str)
Definition: mkdosfs.c:1605
#define KEY_READ
Definition: nt_native.h:1026
long LONG
Definition: pedump.c:60
#define _countof(array)
Definition: sndvol32.h:70
BOOL FASTCALL CliSetSingleHotKey(LPCWSTR pszSubKey, HANDLE hKey)
Definition: input.c:293
#define HKEY_CURRENT_USER
Definition: winreg.h:11
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by CliImmInitializeHotKeys().

◆ CliGetPreloadKeyboardLayouts()

VOID APIENTRY CliGetPreloadKeyboardLayouts ( PBYTE  pbFlags)

Definition at line 351 of file input.c.

352{
353 WCHAR szValueName[33], szValue[16];
354 UNICODE_STRING ustrValue;
355 DWORD dwKL, cbValue, dwType;
356 UINT iNumber;
357 HKEY hKey;
358 LONG error;
359
360 error = RegOpenKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Preload", 0, KEY_READ, &hKey);
361 if (error != ERROR_SUCCESS)
362 return;
363
364 for (iNumber = 1; iNumber < 1000; ++iNumber)
365 {
366 _ultow(iNumber, szValueName, 10);
367
368 cbValue = sizeof(szValue);
369 error = RegQueryValueExW(hKey, szValueName, NULL, &dwType, (LPBYTE)szValue, &cbValue);
370 if (error != ERROR_SUCCESS)
371 break;
372
373 if (dwType != REG_SZ)
374 continue;
375
376 szValue[_countof(szValue) - 1] = 0; /* Avoid stack overrun */
377
378 RtlInitUnicodeString(&ustrValue, szValue);
379 RtlUnicodeStringToInteger(&ustrValue, 16, &dwKL);
380
381 IntSetFeKeyboardFlags(LOWORD(dwKL), pbFlags);
382 }
383
385}
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
_ACRTIMP wchar_t *__cdecl _ultow(__msvcrt_ulong, wchar_t *, int)
Definition: string.c:2199
#define REG_SZ
Definition: layer.c:22
unsigned int UINT
Definition: ndis.h:50
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToInteger(PUNICODE_STRING String, ULONG Base, PULONG Value)
#define LOWORD(l)
Definition: pedump.c:82
unsigned char * LPBYTE
Definition: typedefs.h:53
VOID FASTCALL IntSetFeKeyboardFlags(LANGID LangID, PBYTE pbFlags)
Definition: input.c:69

Referenced by CliImmInitializeHotKeys().

◆ CliImmInitializeHotKeys()

VOID APIENTRY CliImmInitializeHotKeys ( DWORD  dwAction,
HKL  hKL 
)

Definition at line 406 of file input.c.

407{
408 UINT nCount;
409 LPHKL pList;
410 UINT iIndex;
412 BYTE bFlags = 0;
413 BOOL bCheck;
414
416
418
419 if (dwAction == SETIMEHOTKEY_INITIALIZE)
420 {
423
425 }
426 else
427 {
429 if (!nCount)
430 return;
431
432 pList = RtlAllocateHeap(RtlGetProcessHeap(), 0, nCount * sizeof(HKL));
433 if (!pList)
434 return;
435
437
438 for (iIndex = 0; iIndex < nCount; ++iIndex)
439 {
440 LangID = LOWORD(pList[iIndex]);
442 }
443
444 RtlFreeHeap(RtlGetProcessHeap(), 0, pList);
445 }
446
447 if (bFlags & FE_JAPANESE)
449
450 if (bFlags & FE_CHINESE_TRADITIONAL)
452
453 if (bFlags & FE_CHINESE_SIMPLIFIED)
455}
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:616
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:634
LCID WINAPI GetUserDefaultLCID(void)
Definition: locale.c:1216
FxChildList * pList
HKL FAR * LPHKL
Definition: imm.h:24
UINT NTAPI NtUserGetKeyboardLayoutList(ULONG nItems, HKL *pHklBuff)
Definition: kbdlayout.c:1038
BOOL NTAPI NtUserSetImeHotKey(_In_ DWORD dwHotKeyId, _In_ UINT uModifiers, _In_ UINT uVirtualKey, _In_opt_ HKL hKL, _In_ DWORD dwAction)
Definition: ime.c:483
USHORT LANGID
Definition: mui.h:9
UINT_PTR HKL
Definition: msctf.idl:125
#define LANGIDFROMLCID(l)
Definition: nls.h:18
@ SETIMEHOTKEY_INITIALIZE
Definition: undocuser.h:423
_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
#define FE_JAPANESE
Definition: input.c:63
VOID APIENTRY CliGetPreloadKeyboardLayouts(PBYTE pbFlags)
Definition: input.c:351
IMEHOTKEYENTRY DefaultHotKeyTableT[]
Definition: input.c:49
IMEHOTKEYENTRY DefaultHotKeyTableC[]
Definition: input.c:56
#define FE_CHINESE_SIMPLIFIED
Definition: input.c:65
#define FE_CHINESE_TRADITIONAL
Definition: input.c:64
BOOL FASTCALL CliGetImeHotKeysFromRegistry(VOID)
Definition: input.c:318
IMEHOTKEYENTRY DefaultHotKeyTableJ[]
Definition: input.c:43
VOID APIENTRY CliSetDefaultImeHotKeys(PIMEHOTKEYENTRY pEntries, UINT nCount, BOOL bCheck)
Definition: input.c:387
unsigned char BYTE
Definition: xxhash.c:193

Referenced by IntLoadKeyboardLayout(), UnloadKeyboardLayout(), and UpdatePerUserSystemParameters().

◆ CliImmSetHotKey()

BOOL WINAPI CliImmSetHotKey ( _In_ DWORD  dwID,
_In_ UINT  uModifiers,
_In_ UINT  uVirtualKey,
_In_opt_ _When_((dwAction==SETIMEHOTKEY_ADD) &&!(IME_HOTKEY_DSWITCH_FIRST<=dwHotKeyId &&dwHotKeyId<=IME_HOTKEY_DSWITCH_LAST), _Null_) HKL  hKL 
)

@implemented

Note
Same as imm32!ImmSetHotKey.

Definition at line 263 of file input.c.

270{
271 BOOL ret;
272
273 if (uVirtualKey == 0) // Delete?
274 {
275 ret = CliSaveImeHotKey(dwID, uModifiers, uVirtualKey, hKL, TRUE);
276 if (ret)
277 CliImmSetHotKeyWorker(dwID, uModifiers, uVirtualKey, hKL, SETIMEHOTKEY_DELETE);
278 return ret;
279 }
280
281 // Add
282 ret = CliImmSetHotKeyWorker(dwID, uModifiers, uVirtualKey, hKL, SETIMEHOTKEY_ADD);
283 if (ret)
284 {
285 ret = CliSaveImeHotKey(dwID, uModifiers, uVirtualKey, hKL, FALSE);
286 if (!ret) // Failure?
287 CliImmSetHotKeyWorker(dwID, uModifiers, uVirtualKey, hKL, SETIMEHOTKEY_DELETE);
288 }
289
290 return ret;
291}
@ SETIMEHOTKEY_ADD
Definition: undocuser.h:422
@ SETIMEHOTKEY_DELETE
Definition: undocuser.h:421
BOOL APIENTRY CliImmSetHotKeyWorker(DWORD dwHotKeyId, UINT uModifiers, UINT uVirtualKey, HKL hKL, DWORD dwAction)
Definition: input.c:110
BOOL APIENTRY CliSaveImeHotKey(DWORD dwID, UINT uModifiers, UINT uVirtualKey, HKL hKL, BOOL bDelete)
Definition: input.c:207

◆ CliImmSetHotKeyWorker()

BOOL APIENTRY CliImmSetHotKeyWorker ( DWORD  dwHotKeyId,
UINT  uModifiers,
UINT  uVirtualKey,
HKL  hKL,
DWORD  dwAction 
)

Definition at line 110 of file input.c.

111{
112 if (dwAction == SETIMEHOTKEY_ADD)
113 {
114 if (IME_HOTKEY_DSWITCH_FIRST <= dwHotKeyId && dwHotKeyId <= IME_HOTKEY_DSWITCH_LAST)
115 {
116 if (!hKL)
117 goto Failure;
118 }
119 else
120 {
121 if (hKL)
122 goto Failure;
123
124 if (IME_KHOTKEY_SHAPE_TOGGLE <= dwHotKeyId &&
126 {
127 // The Korean cannot set the IME hotkeys
128 goto Failure;
129 }
130 }
131
132#define MOD_ALL_MODS (MOD_ALT | MOD_CONTROL | MOD_SHIFT | MOD_WIN)
133 if ((uModifiers & MOD_ALL_MODS) && !(uModifiers & (MOD_LEFT | MOD_RIGHT)))
134 goto Failure;
135#undef MOD_ALL_MODS
136 }
137
138 return NtUserSetImeHotKey(dwHotKeyId, uModifiers, uVirtualKey, hKL, dwAction);
139
140Failure:
142 return FALSE;
143}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define MOD_LEFT
Definition: imm.h:188
#define IME_THOTKEY_IME_NONIME_TOGGLE
Definition: imm.h:207
#define IME_KHOTKEY_SHAPE_TOGGLE
Definition: imm.h:203
#define IME_HOTKEY_DSWITCH_LAST
Definition: imm.h:213
#define IME_HOTKEY_DSWITCH_FIRST
Definition: imm.h:212
#define MOD_RIGHT
Definition: imm.h:189
#define MOD_ALL_MODS

Referenced by CliImmSetHotKey(), CliSetDefaultImeHotKeys(), and CliSetSingleHotKey().

◆ CliReadRegistryValue()

DWORD FASTCALL CliReadRegistryValue ( HANDLE  hKey,
LPCWSTR  pszName 
)

Definition at line 96 of file input.c.

97{
98 DWORD dwValue, cbValue;
99 LONG error;
100
101 cbValue = sizeof(dwValue);
102 error = RegQueryValueExW(hKey, pszName, NULL, NULL, (LPBYTE)&dwValue, &cbValue);
103 if (error != ERROR_SUCCESS || cbValue < sizeof(DWORD))
104 return 0;
105
106 return dwValue;
107}

Referenced by CliSetSingleHotKey().

◆ CliSaveImeHotKey()

BOOL APIENTRY CliSaveImeHotKey ( DWORD  dwID,
UINT  uModifiers,
UINT  uVirtualKey,
HKL  hKL,
BOOL  bDelete 
)

Definition at line 207 of file input.c.

208{
210 LONG error;
211 HKEY hKey;
212 BOOL ret = FALSE, bRevertOnFailure = FALSE;
213
215 L"Control Panel\\Input Method\\Hot Keys\\%08lX", dwID);
216
217 if (bDelete)
218 {
220 return (error == ERROR_SUCCESS);
221 }
222
224 if (error == ERROR_SUCCESS)
225 {
226 bRevertOnFailure = TRUE;
227
228 // Set "Virtual Key"
229 error = RegSetValueExW(hKey, L"Virtual Key", 0, REG_BINARY,
230 (LPBYTE)&uVirtualKey, sizeof(uVirtualKey));
231 if (error == ERROR_SUCCESS)
232 {
233 // Set "Key Modifiers"
234 error = RegSetValueExW(hKey, L"Key Modifiers", 0, REG_BINARY,
235 (LPBYTE)&uModifiers, sizeof(uModifiers));
236 if (error == ERROR_SUCCESS)
237 {
238 // Set "Target IME"
239 error = RegSetValueExW(hKey, L"Target IME", 0, REG_BINARY,
240 (LPBYTE)&hKL, sizeof(hKL));
241 if (error == ERROR_SUCCESS)
242 {
243 // Success!
244 ret = TRUE;
245 bRevertOnFailure = FALSE;
246 }
247 }
248 }
250 }
251
252 if (bRevertOnFailure)
253 CliSaveImeHotKey(dwID, uVirtualKey, uModifiers, hKL, TRUE);
254
255 return ret;
256}
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1239
#define MAX_PATH
Definition: compat.h:34
#define REG_BINARY
Definition: nt_native.h:1499
#define KEY_WRITE
Definition: nt_native.h:1034
static const WCHAR szName[]
Definition: powrprof.c:45
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530

Referenced by CliImmSetHotKey(), and CliSaveImeHotKey().

◆ CliSetDefaultImeHotKeys()

VOID APIENTRY CliSetDefaultImeHotKeys ( PIMEHOTKEYENTRY  pEntries,
UINT  nCount,
BOOL  bCheck 
)

Definition at line 387 of file input.c.

388{
389 UINT uVirtualKey, uModifiers;
390 HKL hKL;
391
392 while (nCount-- > 0)
393 {
394 if (!bCheck || !NtUserGetImeHotKey(pEntries->dwHotKeyId, &uModifiers, &uVirtualKey, &hKL))
395 {
397 pEntries->uModifiers,
398 pEntries->uVirtualKey,
399 pEntries->hKL,
401 }
402 ++pEntries;
403 }
404}
BOOL NTAPI NtUserGetImeHotKey(_In_ DWORD dwHotKeyId, _Out_ PUINT lpuModifiers, _Out_ PUINT lpuVirtualKey, _Out_opt_ LPHKL lphKL)
Definition: ime.c:434
UINT uVirtualKey
Definition: input.c:37
DWORD dwHotKeyId
Definition: input.c:36
UINT uModifiers
Definition: input.c:38

Referenced by CliImmInitializeHotKeys().

◆ CliSetSingleHotKey()

BOOL FASTCALL CliSetSingleHotKey ( LPCWSTR  pszSubKey,
HANDLE  hKey 
)

Definition at line 293 of file input.c.

294{
295 LONG error;
296 HKEY hSubKey;
297 DWORD dwHotKeyId = 0;
298 UINT uModifiers = 0, uVirtualKey = 0;
299 HKL hKL = NULL;
300 UNICODE_STRING ustrName;
301
302 error = RegOpenKeyExW(hKey, pszSubKey, 0, KEY_READ, &hSubKey);
303 if (error != ERROR_SUCCESS)
304 return FALSE;
305
307 RtlUnicodeStringToInteger(&ustrName, 16, &dwHotKeyId);
308
309 uModifiers = CliReadRegistryValue(hSubKey, L"Key Modifiers");
310 hKL = (HKL)(ULONG_PTR)CliReadRegistryValue(hSubKey, L"Target IME");
311 uVirtualKey = CliReadRegistryValue(hSubKey, L"Virtual Key");
312
313 RegCloseKey(hSubKey);
314
315 return CliImmSetHotKeyWorker(dwHotKeyId, uModifiers, uVirtualKey, hKL, SETIMEHOTKEY_ADD);
316}
_In_opt_ LPCSTR pszSubKey
Definition: shlwapi.h:783
uint32_t ULONG_PTR
Definition: typedefs.h:65
DWORD FASTCALL CliReadRegistryValue(HANDLE hKey, LPCWSTR pszName)
Definition: input.c:96

Referenced by CliGetImeHotKeysFromRegistry().

◆ DragDetect()

BOOL WINAPI DragDetect ( HWND  hWnd,
POINT  pt 
)

Definition at line 462 of file input.c.

465{
466 return NtUserDragDetect(hWnd, pt);
467#if 0
468 MSG msg;
469 RECT rect;
470 POINT tmp;
473
474 rect.left = pt.x - dx;
475 rect.right = pt.x + dx;
476 rect.top = pt.y - dy;
477 rect.bottom = pt.y + dy;
478
480
481 for (;;)
482 {
483 while (
486 )
487 {
488 if (msg.message == WM_LBUTTONUP)
489 {
491 return FALSE;
492 }
493 if (msg.message == WM_MOUSEMOVE)
494 {
495 tmp.x = LOWORD(msg.lParam);
496 tmp.y = HIWORD(msg.lParam);
497 if (!PtInRect(&rect, tmp))
498 {
500 return TRUE;
501 }
502 }
503 if (msg.message == WM_KEYDOWN)
504 {
505 if (msg.wParam == VK_ESCAPE)
506 {
508 return TRUE;
509 }
510 }
511 }
512 WaitMessage();
513 }
514 return 0;
515#endif
516}
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
#define pt(x, y)
Definition: drawing.c:79
BOOL NTAPI NtUserDragDetect(HWND hWnd, POINT pt)
Definition: message.c:2205
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
& rect
Definition: startmenu.cpp:1413
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
Definition: windef.h:99
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define WM_MOUSEFIRST
Definition: winuser.h:1802
#define SM_CXDRAG
Definition: winuser.h:1039
#define WM_MOUSELAST
Definition: winuser.h:1829
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define WM_KEYFIRST
Definition: winuser.h:1742
#define WM_MOUSEMOVE
Definition: winuser.h:1803
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PM_REMOVE
Definition: winuser.h:1207
BOOL WINAPI WaitMessage(void)
Definition: ntwrapper.h:350
#define WM_LBUTTONUP
Definition: winuser.h:1805
#define WM_KEYDOWN
Definition: winuser.h:1743
#define SM_CYDRAG
Definition: winuser.h:1040
#define WM_KEYLAST
Definition: winuser.h:1756
#define VK_ESCAPE
Definition: winuser.h:2250
int WINAPI GetSystemMetrics(_In_ int)

◆ EnableWindow()

BOOL WINAPI EnableWindow ( HWND  hWnd,
BOOL  bEnable 
)

Definition at line 522 of file input.c.

523{
525}
EXTINLINE BOOL NtUserxEnableWindow(HWND hWnd, BOOL bEnable)
Definition: ntwrapper.h:681
_In_ BOOL bEnable
Definition: winddi.h:3426

◆ GetAsyncKeyState()

SHORT WINAPI DECLSPEC_HOTPATCH GetAsyncKeyState ( int  vKey)

Definition at line 533 of file input.c.

534{
535 if (vKey < 0 || vKey > 256)
536 return 0;
537 return (SHORT)NtUserGetAsyncKeyState((DWORD)vKey);
538}
SHORT NTAPI NtUserGetAsyncKeyState(INT Key)
Definition: keyboard.c:634
short SHORT
Definition: pedump.c:59

◆ GetKBCodePage()

UINT WINAPI GetKBCodePage ( VOID  )

Definition at line 555 of file input.c.

556{
557 return GetOEMCP();
558}
UINT WINAPI GetOEMCP(void)
Definition: locale.c:2062

◆ GetKeyboardLayout()

HKL WINAPI GetKeyboardLayout ( DWORD  idThread)

Definition at line 545 of file input.c.

546{
547 return NtUserxGetKeyboardLayout(idThread);
548}
EXTINLINE HKL NtUserxGetKeyboardLayout(DWORD idThread)
Definition: ntwrapper.h:626

◆ GetKeyboardLayoutNameA()

BOOL WINAPI GetKeyboardLayoutNameA ( LPSTR  pwszKLID)

Definition at line 615 of file input.c.

616{
618
620 return FALSE;
621
622 if (!WideCharToMultiByte(CP_ACP, 0, buf, -1, pwszKLID, KL_NAMELENGTH, NULL, NULL))
623 return FALSE;
624
625 return TRUE;
626}
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
BOOL WINAPI GetKeyboardLayoutNameW(_Out_writes_(KL_NAMELENGTH) LPWSTR)
#define KL_NAMELENGTH
Definition: winuser.h:122

◆ GetKeyboardLayoutNameW()

BOOL WINAPI GetKeyboardLayoutNameW ( LPWSTR  pwszKLID)

Definition at line 632 of file input.c.

633{
635
636 RtlInitEmptyUnicodeString(&Name,
637 pwszKLID,
638 KL_NAMELENGTH * sizeof(WCHAR));
639
641}
LPWSTR Name
Definition: desk.c:124
BOOL NTAPI NtUserGetKeyboardLayoutName(_Inout_ PUNICODE_STRING pustrName)
Definition: kbdlayout.c:1092

◆ GetKeyboardType()

int WINAPI GetKeyboardType ( int  nTypeFlag)

Definition at line 647 of file input.c.

648{
649 return NtUserxGetKeyboardType(nTypeFlag);
650}
EXTINLINE INT NtUserxGetKeyboardType(INT nTypeFlag)
Definition: ntwrapper.h:631

◆ GetKeyNameTextA()

int WINAPI GetKeyNameTextA ( LONG  lParam,
LPSTR  lpString,
int  nSize 
)

Definition at line 565 of file input.c.

568{
569 LPWSTR pwszBuf;
570 UINT cchBuf = 0;
571 int iRet = 0;
572 BOOL defChar = FALSE;
573
574 pwszBuf = HeapAlloc(GetProcessHeap(), 0, nSize * sizeof(WCHAR));
575 if (!pwszBuf)
576 return 0;
577
579
580 iRet = WideCharToMultiByte(CP_ACP, 0,
581 pwszBuf, cchBuf,
582 lpString, nSize, ".", &defChar); // FIXME: do we need defChar?
583 lpString[iRet] = 0;
584 HeapFree(GetProcessHeap(), 0, pwszBuf);
585
586 return iRet;
587}
LPARAM lParam
Definition: combotst.c:139
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
DWORD NTAPI NtUserGetKeyNameText(LONG lParam, LPWSTR lpString, int nSize)
Definition: keyboard.c:1588
_In_ UINT cchBuf
Definition: shlwapi.h:378
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:1834
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ GetKeyNameTextW()

int WINAPI GetKeyNameTextW ( LONG  lParam,
LPWSTR  lpString,
int  nSize 
)

Definition at line 593 of file input.c.

596{
597 return NtUserGetKeyNameText(lParam, lpString, nSize);
598}

◆ GetKeyState()

SHORT WINAPI DECLSPEC_HOTPATCH GetKeyState ( int  nVirtKey)

Definition at line 606 of file input.c.

607{
608 return (SHORT)NtUserGetKeyState((DWORD)nVirtKey);
609}
SHORT NTAPI NtUserGetKeyState(INT VirtKey)
Definition: msgqueue.c:2562

◆ GetLastInputInfo()

BOOL WINAPI GetLastInputInfo ( PLASTINPUTINFO  plii)

Definition at line 656 of file input.c.

657{
658 TRACE("%p\n", plii);
659
660 if (plii->cbSize != sizeof (*plii))
661 {
663 return FALSE;
664 }
665
666 plii->dwTime = gpsi->dwLastRITEventTickCount;
667 return TRUE;
668}
PSERVERINFO gpsi
Definition: imm.c:18
#define TRACE(s)
Definition: solgame.cpp:4
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

◆ GetSystemLibraryPath()

VOID GetSystemLibraryPath ( LPWSTR  pszPath,
INT  cchPath,
LPCWSTR  pszFileName 
)

Definition at line 693 of file input.c.

694{
695 WCHAR szSysDir[MAX_PATH];
696 GetSystemDirectoryW(szSysDir, _countof(szSysDir));
697 StringCchPrintfW(pszPath, cchPath, L"%s\\%s", szSysDir, pszFileName);
698}
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:44

Referenced by IntLoadKeyboardLayout().

◆ IntLoadKeyboardLayout()

HKL APIENTRY IntLoadKeyboardLayout ( _In_ HKL  hklUnload,
_In_z_ LPCWSTR  pwszKLID,
_In_ LANGID  wLangID,
_In_ UINT  Flags,
_In_ BOOL  unknown5 
)

Definition at line 709 of file input.c.

715{
716 DWORD dwKLID, dwHKL, dwType, dwSize;
717 UNICODE_STRING ustrKLID;
718 WCHAR wszRegKey[256] = L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\";
719 WCHAR wszLayoutId[10], wszNewKLID[KL_NAMELENGTH], szImeFileName[80];
720 HKL hNewKL;
721 HKEY hKey;
722 BOOL bIsIME;
723 WORD wLow, wHigh;
724
725 if (!IsValidKLID(pwszKLID))
726 {
727 ERR("pwszKLID: %s\n", debugstr_w(pwszKLID));
729 }
730
731 dwKLID = wcstoul(pwszKLID, NULL, 16);
732 bIsIME = IS_IME_HKL(UlongToHandle(dwKLID));
733
734 wLow = LOWORD(dwKLID);
735 wHigh = HIWORD(dwKLID);
736
738 {
739 /* Check substitutes key */
740 if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Substitutes", 0,
742 {
743 dwSize = sizeof(wszNewKLID);
744 if (RegQueryValueExW(hKey, pwszKLID, NULL, &dwType, (LPBYTE)wszNewKLID,
745 &dwSize) == ERROR_SUCCESS &&
746 dwType == REG_SZ)
747 {
748 /* Use new KLID value */
749 pwszKLID = wszNewKLID;
750 dwKLID = wcstoul(pwszKLID, NULL, 16);
751 wHigh = LOWORD(dwKLID);
752 }
753
754 /* Close the key now */
756 }
757 }
758
759 /* Append KLID at the end of registry key */
760 StringCbCatW(wszRegKey, sizeof(wszRegKey), pwszKLID);
761
762 /* Open layout registry key for read */
764 {
765 dwSize = sizeof(wszLayoutId);
766 if (RegQueryValueExW(hKey, L"Layout Id", NULL, &dwType, (LPBYTE)wszLayoutId,
767 &dwSize) == ERROR_SUCCESS && dwType == REG_SZ)
768 {
769 /* If Layout Id is specified, use this value | f000 as HIWORD */
770 wHigh = (0xF000 | wcstoul(wszLayoutId, NULL, 16));
771 }
772
773 if (bIsIME)
774 {
775 /* Check "IME File" value */
776 dwSize = sizeof(szImeFileName);
777 if (RegQueryValueExW(hKey, L"IME File", NULL, &dwType, (LPBYTE)szImeFileName,
779 {
780 bIsIME = FALSE;
781 wHigh = 0;
782 ERR("0x%X\n", dwKLID);
783 }
784 else
785 {
787 szImeFileName[_countof(szImeFileName) - 1] = UNICODE_NULL;
788 GetSystemLibraryPath(szPath, _countof(szPath), szImeFileName);
789
790 /* We don't allow the invalid "IME File" values due to security reason */
791 if (dwType != REG_SZ || szImeFileName[0] == 0 ||
792 wcscspn(szImeFileName, L":\\/") != wcslen(szImeFileName) ||
793 GetFileAttributesW(szPath) == INVALID_FILE_ATTRIBUTES) /* Does not exist? */
794 {
795 bIsIME = FALSE;
796 wHigh = 0;
797 ERR("'%s'\n", debugstr_w(szPath));
798 }
799 }
800 }
801
802 /* Close the key now */
804 }
805 else
806 {
807 ERR("Could not find keyboard layout %S.\n", pwszKLID);
808 return NULL;
809 }
810
811 if (wHigh == 0)
812 wHigh = wLow;
813
814 dwHKL = MAKELONG(wLow, wHigh);
815
816 RtlInitUnicodeString(&ustrKLID, pwszKLID);
817 hNewKL = NtUserLoadKeyboardLayoutEx(NULL, 0, NULL, hklUnload, &ustrKLID, dwHKL, Flags);
819 return hNewKL;
820}
#define ERR(fmt,...)
Definition: precomp.h:57
#define UlongToHandle(ul)
Definition: basetsd.h:91
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
_ACRTIMP __msvcrt_ulong __cdecl wcstoul(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2912
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
_ACRTIMP size_t __cdecl wcscspn(const wchar_t *, const wchar_t *)
Definition: wcs.c:498
unsigned short WORD
Definition: ntddk_ex.h:93
#define IS_IME_HKL(hKL)
Definition: imm32_undoc.h:21
HKL NTAPI NtUserLoadKeyboardLayoutEx(IN HANDLE hFile, IN DWORD offTable, IN PVOID pTables, IN HKL hOldKL, IN PUNICODE_STRING puszKLID, IN DWORD dwNewKL, IN UINT Flags)
Definition: kbdlayout.c:1161
#define debugstr_w
Definition: kernel32.h:32
LPCWSTR szPath
Definition: env.c:37
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define UNICODE_NULL
STRSAFEAPI StringCbCatW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:342
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
VOID APIENTRY CliImmInitializeHotKeys(DWORD dwAction, HKL hKL)
Definition: input.c:406
#define ENGLISH_US
Definition: input.c:700
VOID GetSystemLibraryPath(LPWSTR pszPath, INT cchPath, LPCWSTR pszFileName)
Definition: input.c:693
static BOOL IsValidKLID(_In_ LPCWSTR pwszKLID)
Definition: input.c:688
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define KLF_SUBSTITUTE_OK
Definition: winuser.h:112
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by LoadKeyboardLayoutEx(), and LoadKeyboardLayoutW().

◆ IntLoadPreloadKeyboardLayouts()

VOID IntLoadPreloadKeyboardLayouts ( VOID  )

Definition at line 145 of file input.c.

146{
147 UINT nNumber, uFlags;
148 DWORD cbValue, dwType;
149 WCHAR szNumber[32], szValue[KL_NAMELENGTH];
150 HKEY hPreloadKey;
151 BOOL bOK = FALSE;
152 HKL hKL, hDefaultKL = NULL;
153
155 L"Keyboard Layout\\Preload",
156 &hPreloadKey) != ERROR_SUCCESS)
157 {
158 return;
159 }
160
161 for (nNumber = 1; nNumber <= 1000; ++nNumber)
162 {
163 _ultow(nNumber, szNumber, 10);
164
165 cbValue = sizeof(szValue);
166 if (RegQueryValueExW(hPreloadKey,
167 szNumber,
168 NULL,
169 &dwType,
170 (LPBYTE)szValue,
171 &cbValue) != ERROR_SUCCESS)
172 {
173 break;
174 }
175
176 if (dwType != REG_SZ)
177 continue;
178
179 if (nNumber == 1) /* The first entry is for default keyboard layout */
180 uFlags = KLF_SUBSTITUTE_OK | KLF_ACTIVATE | KLF_RESET;
181 else
183
184 hKL = LoadKeyboardLayoutW(szValue, uFlags);
185 if (hKL)
186 {
187 bOK = TRUE;
188 if (nNumber == 1) /* The first entry */
189 hDefaultKL = hKL;
190 }
191 }
192
193 RegCloseKey(hPreloadKey);
194
195 if (hDefaultKL)
196 SystemParametersInfoW(SPI_SETDEFAULTINPUTLANG, 0, &hDefaultKL, 0);
197
198 if (!bOK)
199 {
200 /* Fallback to English (US) */
201 LoadKeyboardLayoutW(L"00000409", KLF_SUBSTITUTE_OK | KLF_ACTIVATE | KLF_RESET);
202 }
203}
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
UINT uFlags
Definition: api.c:59
HKL WINAPI LoadKeyboardLayoutW(LPCWSTR pwszKLID, UINT Flags)
Definition: input.c:826
#define KLF_REPLACELANG
Definition: winuser.h:115
#define KLF_ACTIVATE
Definition: winuser.h:111
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define KLF_NOTELLSHELL
Definition: winuser.h:116

Referenced by UpdatePerUserSystemParameters().

◆ IntSetFeKeyboardFlags()

VOID FASTCALL IntSetFeKeyboardFlags ( LANGID  LangID,
PBYTE  pbFlags 
)

Definition at line 69 of file input.c.

70{
71 switch (LangID)
72 {
74 *pbFlags |= FE_JAPANESE;
75 break;
76
79 *pbFlags |= FE_CHINESE_TRADITIONAL;
80 break;
81
84 *pbFlags |= FE_CHINESE_SIMPLIFIED;
85 break;
86
88 *pbFlags |= FE_KOREAN;
89 break;
90
91 default:
92 break;
93 }
94}
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_CHINESE_SINGAPORE
Definition: nls.h:211
#define SUBLANG_CHINESE_TRADITIONAL
Definition: nls.h:208
#define SUBLANG_CHINESE_SIMPLIFIED
Definition: nls.h:209
#define SUBLANG_DEFAULT
Definition: nls.h:168
#define SUBLANG_CHINESE_HONGKONG
Definition: nls.h:210
#define LANG_CHINESE
Definition: nls.h:42
#define LANG_JAPANESE
Definition: nls.h:76
#define LANG_KOREAN
Definition: nls.h:84
#define SUBLANG_KOREAN
Definition: nls.h:280
#define FE_KOREAN
Definition: input.c:66

Referenced by CliGetPreloadKeyboardLayouts(), and CliImmInitializeHotKeys().

◆ IsValidKLID()

static BOOL IsValidKLID ( _In_ LPCWSTR  pwszKLID)
inlinestatic

Definition at line 688 of file input.c.

689{
690 return (pwszKLID != NULL) && (wcsspn(pwszKLID, L"0123456789ABCDEFabcdef") == (KL_NAMELENGTH - 1));
691}
_ACRTIMP size_t __cdecl wcsspn(const wchar_t *, const wchar_t *)
Definition: wcs.c:508

Referenced by IntLoadKeyboardLayout().

◆ keybd_event()

VOID WINAPI keybd_event ( BYTE  bVk,
BYTE  bScan,
DWORD  dwFlags,
ULONG_PTR  dwExtraInfo 
)

Definition at line 1080 of file input.c.

1085{
1086 INPUT Input;
1087
1088 Input.type = INPUT_KEYBOARD;
1089 Input.ki.wVk = bVk;
1090 Input.ki.wScan = bScan;
1091 Input.ki.dwFlags = dwFlags;
1092 Input.ki.time = 0;
1093 Input.ki.dwExtraInfo = dwExtraInfo;
1094
1095 NtUserSendInput(1, &Input, sizeof(INPUT));
1096}
UINT NTAPI NtUserSendInput(UINT nInputs, LPINPUT pInput, INT cbSize)
Definition: input.c:708
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
@ Input
Definition: arc.h:93
#define INPUT_KEYBOARD
Definition: winable.h:10
BOOL bScan
Definition: wlanconf.c:23

◆ LoadKeyboardLayoutA()

HKL WINAPI LoadKeyboardLayoutA ( LPCSTR  pszKLID,
UINT  Flags 
)

Definition at line 674 of file input.c.

676{
677 WCHAR wszKLID[16];
678
679 if (!MultiByteToWideChar(CP_ACP, 0, pszKLID, -1,
680 wszKLID, sizeof(wszKLID)/sizeof(wszKLID[0])))
681 {
682 return FALSE;
683 }
684
685 return LoadKeyboardLayoutW(wszKLID, Flags);
686}
#define MultiByteToWideChar
Definition: compat.h:110

◆ LoadKeyboardLayoutEx()

HKL WINAPI LoadKeyboardLayoutEx ( HKL  hklUnload,
LPCWSTR  pwszKLID,
UINT  Flags 
)

Definition at line 837 of file input.c.

840{
841 FIXME("(%p, %s, 0x%X)", hklUnload, debugstr_w(pwszKLID), Flags);
842 if (!hklUnload)
843 return NULL;
844 return IntLoadKeyboardLayout(hklUnload, pwszKLID, 0, Flags, FALSE);
845}
#define FIXME(fmt,...)
Definition: precomp.h:53
HKL APIENTRY IntLoadKeyboardLayout(_In_ HKL hklUnload, _In_z_ LPCWSTR pwszKLID, _In_ LANGID wLangID, _In_ UINT Flags, _In_ BOOL unknown5)
Definition: input.c:709

◆ LoadKeyboardLayoutW()

HKL WINAPI LoadKeyboardLayoutW ( LPCWSTR  pwszKLID,
UINT  Flags 
)

Definition at line 826 of file input.c.

828{
829 TRACE("(%s, 0x%X)\n", debugstr_w(pwszKLID), Flags);
830 return IntLoadKeyboardLayout(NULL, pwszKLID, 0, Flags, FALSE);
831}

Referenced by IntLoadPreloadKeyboardLayouts(), LoadKeyboardLayoutA(), and LoadKeyboardLayoutEx().

◆ MapVirtualKeyA()

UINT WINAPI MapVirtualKeyA ( UINT  uCode,
UINT  uMapType 
)

Definition at line 863 of file input.c.

865{
866 return MapVirtualKeyExA(uCode, uMapType, GetKeyboardLayout(0));
867}
HKL WINAPI GetKeyboardLayout(_In_ DWORD)
UINT WINAPI MapVirtualKeyExA(_In_ UINT, _In_ UINT, _In_opt_ HKL)

◆ MapVirtualKeyExA()

UINT WINAPI MapVirtualKeyExA ( UINT  uCode,
UINT  uMapType,
HKL  dwhkl 
)

Definition at line 873 of file input.c.

876{
877 return MapVirtualKeyExW(uCode, uMapType, dwhkl);
878}
UINT WINAPI MapVirtualKeyExW(UINT uCode, UINT uMapType, HKL dwhkl)
Definition: input.c:885

◆ MapVirtualKeyExW()

UINT WINAPI MapVirtualKeyExW ( UINT  uCode,
UINT  uMapType,
HKL  dwhkl 
)

Definition at line 885 of file input.c.

888{
889 return NtUserMapVirtualKeyEx(uCode, uMapType, 0, dwhkl);
890}
UINT NTAPI NtUserMapVirtualKeyEx(UINT keyCode, UINT transType, DWORD keyboardId, HKL dwhkl)
Definition: keyboard.c:1443

Referenced by MapVirtualKeyExA(), and MapVirtualKeyW().

◆ MapVirtualKeyW()

UINT WINAPI MapVirtualKeyW ( UINT  uCode,
UINT  uMapType 
)

Definition at line 897 of file input.c.

899{
900 return MapVirtualKeyExW(uCode, uMapType, GetKeyboardLayout(0));
901}

◆ mouse_event()

VOID WINAPI mouse_event ( DWORD  dwFlags,
DWORD  dx,
DWORD  dy,
DWORD  dwData,
ULONG_PTR  dwExtraInfo 
)

Definition at line 1104 of file input.c.

1110{
1111 INPUT Input;
1112
1113 Input.type = INPUT_MOUSE;
1114 Input.mi.dx = dx;
1115 Input.mi.dy = dy;
1116 Input.mi.mouseData = dwData;
1117 Input.mi.dwFlags = dwFlags;
1118 Input.mi.time = 0;
1119 Input.mi.dwExtraInfo = dwExtraInfo;
1120
1121 NtUserSendInput(1, &Input, sizeof(INPUT));
1122}
static HANDLE ULONG_PTR dwData
Definition: file.c:35
#define INPUT_MOUSE
Definition: winable.h:9

◆ OemKeyScan()

DWORD WINAPI OemKeyScan ( WORD  wOemChar)

Definition at line 908 of file input.c.

909{
910 WCHAR p;
911 SHORT Vk;
912 UINT Scan;
913
914 MultiByteToWideChar(CP_OEMCP, 0, (PCSTR)&wOemChar, 1, &p, 1);
915 Vk = VkKeyScanW(p);
916 Scan = MapVirtualKeyW((Vk & 0x00ff), 0);
917 if (!Scan) return -1;
918 /*
919 Page 450-1, MS W2k SuperBible by SAMS. Return, low word has the
920 scan code and high word has the shift state.
921 */
922 return ((Vk & 0xff00) << 8) | Scan;
923}
GLfloat GLfloat p
Definition: glext.h:8902
const char * PCSTR
Definition: typedefs.h:52
#define CP_OEMCP
Definition: winnls.h:249
UINT WINAPI MapVirtualKeyW(_In_ UINT, _In_ UINT)
SHORT WINAPI VkKeyScanW(_In_ WCHAR)

◆ SetDoubleClickTime()

BOOL WINAPI SetDoubleClickTime ( UINT  uInterval)

Definition at line 930 of file input.c.

931{
933 uInterval,
934 NULL,
935 0);
936}
BOOL NTAPI NtUserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2179
#define SPI_SETDOUBLECLICKTIME
Definition: winuser.h:1392

◆ SwapMouseButton()

BOOL WINAPI SwapMouseButton ( BOOL  fSwap)

Definition at line 944 of file input.c.

946{
947 return NtUserxSwapMouseButton(fSwap);
948}
EXTINLINE BOOL NtUserxSwapMouseButton(BOOL fSwap)
Definition: ntwrapper.h:596

◆ ToAscii()

int WINAPI ToAscii ( UINT  uVirtKey,
UINT  uScanCode,
CONST BYTE lpKeyState,
LPWORD  lpChar,
UINT  uFlags 
)

Definition at line 955 of file input.c.

960{
961 return ToAsciiEx(uVirtKey, uScanCode, lpKeyState, lpChar, uFlags, 0);
962}
int WINAPI ToAsciiEx(_In_ UINT, _In_ UINT, _In_reads_opt_(256) CONST BYTE *, _Out_ LPWORD, _In_ UINT, _In_opt_ HKL)

◆ ToAsciiEx()

int WINAPI ToAsciiEx ( UINT  uVirtKey,
UINT  uScanCode,
CONST BYTE lpKeyState,
LPWORD  lpChar,
UINT  uFlags,
HKL  dwhkl 
)

Definition at line 969 of file input.c.

975{
976 WCHAR UniChars[2];
977 int Ret, CharCount;
978
979 Ret = ToUnicodeEx(uVirtKey, uScanCode, lpKeyState, UniChars, 2, uFlags, dwhkl);
980 CharCount = (Ret < 0 ? 1 : Ret);
981 WideCharToMultiByte(CP_ACP, 0, UniChars, CharCount, (LPSTR)lpChar, 2, NULL, NULL);
982
983 return Ret;
984}
int WINAPI ToUnicodeEx(_In_ UINT wVirtKey, _In_ UINT wScanCode, _In_reads_bytes_(256) CONST BYTE *lpKeyState, _Out_writes_(cchBuff) LPWSTR pwszBuff, _In_ int cchBuff, _In_ UINT wFlags, _In_opt_ HKL dwhkl)
char * LPSTR
Definition: xmlstorage.h:182

◆ ToUnicode()

int WINAPI ToUnicode ( UINT  wVirtKey,
UINT  wScanCode,
CONST BYTE lpKeyState,
LPWSTR  pwszBuff,
int  cchBuff,
UINT  wFlags 
)

Definition at line 991 of file input.c.

997{
998 return ToUnicodeEx(wVirtKey, wScanCode, lpKeyState, pwszBuff, cchBuff,
999 wFlags, 0);
1000}
WINBASEAPI _In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon_undoc.h:337

◆ ToUnicodeEx()

int WINAPI ToUnicodeEx ( UINT  wVirtKey,
UINT  wScanCode,
CONST BYTE lpKeyState,
LPWSTR  pwszBuff,
int  cchBuff,
UINT  wFlags,
HKL  dwhkl 
)

Definition at line 1007 of file input.c.

1014{
1015 return NtUserToUnicodeEx(wVirtKey, wScanCode, (PBYTE)lpKeyState, pwszBuff, cchBuff,
1016 wFlags, dwhkl);
1017}
INT NTAPI NtUserToUnicodeEx(UINT wVirtKey, UINT wScanCode, PBYTE lpKeyState, LPWSTR pwszBuff, int cchBuff, UINT wFlags, HKL dwhkl)
BYTE * PBYTE
Definition: pedump.c:66

◆ UnloadKeyboardLayout()

BOOL WINAPI UnloadKeyboardLayout ( HKL  hKL)

Definition at line 850 of file input.c.

851{
853 return FALSE;
854
856 return TRUE;
857}
BOOL NTAPI NtUserUnloadKeyboardLayout(HKL hKl)
Definition: kbdlayout.c:1251

◆ VkKeyScanA()

SHORT WINAPI VkKeyScanA ( CHAR  ch)

Definition at line 1025 of file input.c.

1026{
1027 WCHAR wChar;
1028
1029 if (IsDBCSLeadByte(ch))
1030 return -1;
1031
1032 MultiByteToWideChar(CP_ACP, 0, &ch, 1, &wChar, 1);
1033 return VkKeyScanW(wChar);
1034}
BOOL WINAPI IsDBCSLeadByte(BYTE testchar)
Definition: locale.c:2126
unsigned char ch[4][2]
Definition: console.c:118

◆ VkKeyScanExA()

SHORT WINAPI VkKeyScanExA ( CHAR  ch,
HKL  dwhkl 
)

Definition at line 1041 of file input.c.

1043{
1044 WCHAR wChar;
1045
1046 if (IsDBCSLeadByte(ch))
1047 return -1;
1048
1049 MultiByteToWideChar(CP_ACP, 0, &ch, 1, &wChar, 1);
1050 return VkKeyScanExW(wChar, dwhkl);
1051}
SHORT WINAPI VkKeyScanExW(WCHAR ch, HKL dwhkl)
Definition: input.c:1058

◆ VkKeyScanExW()

SHORT WINAPI VkKeyScanExW ( WCHAR  ch,
HKL  dwhkl 
)

Definition at line 1058 of file input.c.

1060{
1061 return (SHORT)NtUserVkKeyScanEx(ch, dwhkl, TRUE);
1062}
DWORD NTAPI NtUserVkKeyScanEx(WCHAR wChar, HKL KeyboardLayout, BOOL bUsehHK)
Definition: keyboard.c:1713

Referenced by VkKeyScanExA().

◆ VkKeyScanW()

SHORT WINAPI VkKeyScanW ( WCHAR  ch)

Definition at line 1069 of file input.c.

1070{
1071 return (SHORT)NtUserVkKeyScanEx(ch, 0, FALSE);
1072}

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( user32  )

Variable Documentation

◆ DefaultHotKeyTableC

IMEHOTKEYENTRY DefaultHotKeyTableC[]
Initial value:
=
{
}
#define IME_CHOTKEY_IME_NONIME_TOGGLE
Definition: imm.h:195
#define MOD_SHIFT
Definition: imm.h:186
#define MOD_CONTROL
Definition: imm.h:185
#define IME_CHOTKEY_SHAPE_TOGGLE
Definition: imm.h:196
#define VK_SPACE
Definition: winuser.h:2255

Definition at line 56 of file input.c.

Referenced by CliImmInitializeHotKeys().

◆ DefaultHotKeyTableJ

IMEHOTKEYENTRY DefaultHotKeyTableJ[]
Initial value:
=
{
}
#define IME_JHOTKEY_CLOSE_OPEN
Definition: imm.h:200
#define MOD_IGNORE_ALL_MODIFIER
Definition: imm.h:192
#define VK_KANJI
Definition: winuser.h:2249

Definition at line 43 of file input.c.

Referenced by CliImmInitializeHotKeys().

◆ DefaultHotKeyTableT

IMEHOTKEYENTRY DefaultHotKeyTableT[]
Initial value:

Definition at line 49 of file input.c.

Referenced by CliImmInitializeHotKeys().