ReactOS  0.4.15-dev-4869-g35a816a
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)
 

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)
 
BOOL APIENTRY CliSaveImeHotKey (DWORD dwID, UINT uModifiers, UINT uVirtualKey, HKL hKL, BOOL bDelete)
 
BOOL WINAPI CliImmSetHotKey (DWORD dwID, UINT uModifiers, UINT uVirtualKey, 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)
 
HKL WINAPI LoadKeyboardLayoutW (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

◆ 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 274 of file input.c.

275 {
276  HKEY hKey;
277  LONG error;
278  BOOL ret = FALSE;
279  DWORD dwIndex, cchKeyName;
280  WCHAR szKeyName[16];
281 
283  L"Control Panel\\Input Method\\Hot Keys",
284  0,
286  &hKey);
287  if (error != ERROR_SUCCESS)
288  return ret;
289 
290  for (dwIndex = 0; ; ++dwIndex)
291  {
292  cchKeyName = _countof(szKeyName);
293  error = RegEnumKeyExW(hKey, dwIndex, szKeyName, &cchKeyName, NULL, NULL, NULL, NULL);
295  break;
296 
297  szKeyName[_countof(szKeyName) - 1] = 0;
298 
299  if (CliSetSingleHotKey(szKeyName, hKey))
300  ret = TRUE;
301  }
302 
303  RegCloseKey(hKey);
304  return ret;
305 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define TRUE
Definition: types.h:120
#define HKEY_CURRENT_USER
Definition: winreg.h:11
BOOL FASTCALL CliSetSingleHotKey(LPCWSTR pszSubKey, HANDLE hKey)
Definition: input.c:249
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
FxAutoRegKey hKey
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define NULL
Definition: types.h:112
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
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:2527
#define RegCloseKey(hKey)
Definition: registry.h:47

Referenced by CliImmInitializeHotKeys().

◆ CliGetPreloadKeyboardLayouts()

VOID APIENTRY CliGetPreloadKeyboardLayouts ( PBYTE  pbFlags)

Definition at line 307 of file input.c.

308 {
309  WCHAR szValueName[8], szValue[16];
310  UNICODE_STRING ustrValue;
311  DWORD dwKL, cbValue, dwType;
312  UINT iNumber;
313  HKEY hKey;
314  LONG error;
315 
316  error = RegOpenKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Preload", 0, KEY_READ, &hKey);
317  if (error != ERROR_SUCCESS)
318  return;
319 
320  for (iNumber = 1; iNumber < 1000; ++iNumber)
321  {
322  StringCchPrintfW(szValueName, _countof(szValueName), L"%u", iNumber);
323 
324  cbValue = sizeof(szValue);
325  error = RegQueryValueExW(hKey, szValueName, NULL, &dwType, (LPBYTE)szValue, &cbValue);
326  if (error != ERROR_SUCCESS || dwType != REG_SZ)
327  break;
328 
329  szValue[_countof(szValue) - 1] = 0;
330 
331  RtlInitUnicodeString(&ustrValue, szValue);
332  RtlUnicodeStringToInteger(&ustrValue, 16, &dwKL);
333 
334  IntSetFeKeyboardFlags(LOWORD(dwKL), pbFlags);
335  }
336 
337  RegCloseKey(hKey);
338 }
VOID FASTCALL IntSetFeKeyboardFlags(LANGID LangID, PBYTE pbFlags)
Definition: input.c:70
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
#define KEY_READ
Definition: nt_native.h:1023
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
long LONG
Definition: pedump.c:60
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToInteger(PUNICODE_STRING String, ULONG Base, PULONG Value)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define LOWORD(l)
Definition: pedump.c:82
#define RegCloseKey(hKey)
Definition: registry.h:47
#define REG_SZ
Definition: layer.c:22

Referenced by CliImmInitializeHotKeys().

◆ CliImmInitializeHotKeys()

VOID APIENTRY CliImmInitializeHotKeys ( DWORD  dwAction,
HKL  hKL 
)

Definition at line 359 of file input.c.

360 {
361  UINT nCount;
362  LPHKL pList;
363  UINT iIndex;
364  LANGID LangID;
365  BYTE bFlags = 0;
366  BOOL bCheck;
367 
369 
370  bCheck = CliGetImeHotKeysFromRegistry();
371 
372  if (dwAction == SETIMEHOTKEY_DELETEALL)
373  {
375  IntSetFeKeyboardFlags(LangID, &bFlags);
376 
378  }
379  else
380  {
381  nCount = NtUserGetKeyboardLayoutList(0, NULL);
382  if (!nCount)
383  return;
384 
385  pList = RtlAllocateHeap(RtlGetProcessHeap(), 0, nCount * sizeof(HKL));
386  if (!pList)
387  return;
388 
390 
391  for (iIndex = 0; iIndex < nCount; ++iIndex)
392  {
393  LangID = LOWORD(pList[iIndex]);
394  IntSetFeKeyboardFlags(LangID, &bFlags);
395  }
396 
397  RtlFreeHeap(RtlGetProcessHeap(), 0, pList);
398  }
399 
400  if (bFlags & FE_JAPANESE)
402 
403  if (bFlags & FE_CHINESE_TRADITIONAL)
405 
406  if (bFlags & FE_CHINESE_SIMPLIFIED)
408 }
VOID FASTCALL IntSetFeKeyboardFlags(LANGID LangID, PBYTE pbFlags)
Definition: input.c:70
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
WORD LANGID
Definition: typedefs.h:81
LCID WINAPI GetUserDefaultLCID(void)
Definition: lang.c:772
VOID APIENTRY CliGetPreloadKeyboardLayouts(PBYTE pbFlags)
Definition: input.c:307
IMEHOTKEYENTRY DefaultHotKeyTableC[]
Definition: input.c:56
BOOL FASTCALL CliGetImeHotKeysFromRegistry(VOID)
Definition: input.c:274
unsigned int BOOL
Definition: ntddk_ex.h:94
FxChildList * pList
IMEHOTKEYENTRY DefaultHotKeyTableT[]
Definition: input.c:49
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
#define FE_CHINESE_SIMPLIFIED
Definition: input.c:65
#define _countof(array)
Definition: sndvol32.h:68
#define LANGIDFROMLCID(l)
Definition: nls.h:18
UINT_PTR HKL
Definition: msctf.idl:101
unsigned char BYTE
Definition: xxhash.c:193
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
IMEHOTKEYENTRY DefaultHotKeyTableJ[]
Definition: input.c:43
#define FE_CHINESE_TRADITIONAL
Definition: input.c:64
BOOL NTAPI NtUserSetImeHotKey(DWORD dwHotKeyId, UINT uModifiers, UINT uVirtualKey, HKL hKL, DWORD dwAction)
Definition: ime.c:459
VOID APIENTRY CliSetDefaultImeHotKeys(PIMEHOTKEYENTRY pEntries, UINT nCount, BOOL bCheck)
Definition: input.c:340
UINT NTAPI NtUserGetKeyboardLayoutList(ULONG nItems, HKL *pHklBuff)
Definition: kbdlayout.c:549
#define FE_JAPANESE
Definition: input.c:63
_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:1075
#define LOWORD(l)
Definition: pedump.c:82

Referenced by UnloadKeyboardLayout().

◆ CliImmSetHotKey()

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

Definition at line 225 of file input.c.

226 {
227  BOOL ret;
228 
229  if (uVirtualKey == 0) // Delete?
230  {
231  ret = CliSaveImeHotKey(dwID, uModifiers, uVirtualKey, hKL, TRUE);
232  if (ret)
233  CliImmSetHotKeyWorker(dwID, uModifiers, uVirtualKey, hKL, SETIMEHOTKEY_DELETE);
234  return ret;
235  }
236 
237  // Add
238  ret = CliImmSetHotKeyWorker(dwID, uModifiers, uVirtualKey, hKL, SETIMEHOTKEY_ADD);
239  if (ret)
240  {
241  ret = CliSaveImeHotKey(dwID, uModifiers, uVirtualKey, hKL, FALSE);
242  if (!ret) // Failure?
243  CliImmSetHotKeyWorker(dwID, uModifiers, uVirtualKey, hKL, SETIMEHOTKEY_DELETE);
244  }
245 
246  return ret;
247 }
#define TRUE
Definition: types.h:120
BOOL APIENTRY CliSaveImeHotKey(DWORD dwID, UINT uModifiers, UINT uVirtualKey, HKL hKL, BOOL bDelete)
Definition: input.c:147
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL APIENTRY CliImmSetHotKeyWorker(DWORD dwHotKeyId, UINT uModifiers, UINT uVirtualKey, HKL hKL, DWORD dwAction)
Definition: input.c:111
int ret

◆ CliImmSetHotKeyWorker()

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

Definition at line 111 of file input.c.

112 {
113  if (dwAction == SETIMEHOTKEY_ADD)
114  {
115  if (IME_HOTKEY_DSWITCH_FIRST <= dwHotKeyId && dwHotKeyId <= IME_HOTKEY_DSWITCH_LAST)
116  {
117  if (!hKL)
118  goto Failure;
119  }
120  else
121  {
122  if (hKL)
123  goto Failure;
124 
125  if (IME_KHOTKEY_SHAPE_TOGGLE <= dwHotKeyId &&
126  dwHotKeyId < IME_THOTKEY_IME_NONIME_TOGGLE)
127  {
128  // The Korean cannot set the IME hotkeys
129  goto Failure;
130  }
131  }
132 
133 #define MOD_ALL_MODS (MOD_ALT | MOD_CONTROL | MOD_SHIFT | MOD_WIN)
134  if ((uModifiers & MOD_ALL_MODS) && !(uModifiers & (MOD_LEFT | MOD_RIGHT)))
135  goto Failure;
136 #undef MOD_ALL_MODS
137  }
138 
139  return NtUserSetImeHotKey(dwHotKeyId, uModifiers, uVirtualKey, hKL, dwAction);
140 
141 Failure:
143  return FALSE;
144 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define MOD_ALL_MODS
#define IME_KHOTKEY_SHAPE_TOGGLE
Definition: imm.h:339
#define FALSE
Definition: types.h:117
#define IME_HOTKEY_DSWITCH_LAST
Definition: imm.h:349
#define MOD_LEFT
Definition: imm.h:323
#define IME_THOTKEY_IME_NONIME_TOGGLE
Definition: imm.h:343
#define SetLastError(x)
Definition: compat.h:611
#define IME_HOTKEY_DSWITCH_FIRST
Definition: imm.h:348
#define MOD_RIGHT
Definition: imm.h:324
BOOL NTAPI NtUserSetImeHotKey(DWORD dwHotKeyId, UINT uModifiers, UINT uVirtualKey, HKL hKL, DWORD dwAction)
Definition: ime.c:459

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

◆ CliReadRegistryValue()

DWORD FASTCALL CliReadRegistryValue ( HANDLE  hKey,
LPCWSTR  pszName 
)

Definition at line 97 of file input.c.

98 {
99  DWORD dwValue, cbValue;
100  LONG error;
101 
102  cbValue = sizeof(dwValue);
103  error = RegQueryValueExW(hKey, pszName, NULL, NULL, (LPBYTE)&dwValue, &cbValue);
104  if (error != ERROR_SUCCESS || cbValue < sizeof(DWORD))
105  return 0;
106 
107  return dwValue;
108 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
unsigned char * LPBYTE
Definition: typedefs.h:53
long LONG
Definition: pedump.c:60
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
#define NULL
Definition: types.h:112

Referenced by CliSetSingleHotKey().

◆ CliSaveImeHotKey()

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

Definition at line 147 of file input.c.

148 {
150  LONG error;
151  HKEY hControlPanel = NULL, hInputMethod = NULL, hHotKeys = NULL, hKey = NULL;
152  BOOL ret = FALSE, bRevertOnFailure = FALSE;
153 
154  if (bDelete)
155  {
157  L"Control Panel\\Input Method\\Hot Keys\\%08lX", dwID);
159  return (error == ERROR_SUCCESS);
160  }
161 
162  // Open "Control Panel"
163  error = RegCreateKeyExW(HKEY_CURRENT_USER, L"Control Panel", 0, NULL, 0, KEY_ALL_ACCESS,
164  NULL, &hControlPanel, NULL);
165  if (error == ERROR_SUCCESS)
166  {
167  // Open "Input Method"
168  error = RegCreateKeyExW(hControlPanel, L"Input Method", 0, NULL, 0, KEY_ALL_ACCESS,
169  NULL, &hInputMethod, NULL);
170  if (error == ERROR_SUCCESS)
171  {
172  // Open "Hot Keys"
173  error = RegCreateKeyExW(hInputMethod, L"Hot Keys", 0, NULL, 0, KEY_ALL_ACCESS,
174  NULL, &hHotKeys, NULL);
175  if (error == ERROR_SUCCESS)
176  {
177  // Open "Key"
178  StringCchPrintfW(szName, _countof(szName), L"%08lX", dwID);
179  error = RegCreateKeyExW(hHotKeys, szName, 0, NULL, 0, KEY_ALL_ACCESS,
180  NULL, &hKey, NULL);
181  if (error == ERROR_SUCCESS)
182  {
183  bRevertOnFailure = TRUE;
184 
185  // Set "Virtual Key"
186  error = RegSetValueExW(hKey, L"Virtual Key", 0, REG_BINARY,
187  (LPBYTE)&uVirtualKey, sizeof(uVirtualKey));
188  if (error == ERROR_SUCCESS)
189  {
190  // Set "Key Modifiers"
191  error = RegSetValueExW(hKey, L"Key Modifiers", 0, REG_BINARY,
192  (LPBYTE)&uModifiers, sizeof(uModifiers));
193  if (error == ERROR_SUCCESS)
194  {
195  // Set "Target IME"
196  error = RegSetValueExW(hKey, L"Target IME", 0, REG_BINARY,
197  (LPBYTE)&hKL, sizeof(hKL));
198  if (error == ERROR_SUCCESS)
199  {
200  // Success!
201  ret = TRUE;
202  bRevertOnFailure = FALSE;
203  }
204  }
205  }
206  RegCloseKey(hKey);
207  }
208  RegCloseKey(hHotKeys);
209  }
210  RegCloseKey(hInputMethod);
211  }
212  RegCloseKey(hControlPanel);
213  }
214 
215  if (bRevertOnFailure)
216  CliSaveImeHotKey(dwID, uVirtualKey, uModifiers, hKL, TRUE);
217 
218  return ret;
219 }
static const WCHAR szName[]
Definition: powrprof.c:45
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
#define REG_BINARY
Definition: nt_native.h:1496
#define TRUE
Definition: types.h:120
#define HKEY_CURRENT_USER
Definition: winreg.h:11
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
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:1091
BOOL APIENTRY CliSaveImeHotKey(DWORD dwID, UINT uModifiers, UINT uVirtualKey, HKL hKL, BOOL bDelete)
Definition: input.c:147
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
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:4899
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
int ret
FxAutoRegKey hKey
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
#define NULL
Definition: types.h:112
#define RegCloseKey(hKey)
Definition: registry.h:47

Referenced by CliImmSetHotKey().

◆ CliSetDefaultImeHotKeys()

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

Definition at line 340 of file input.c.

341 {
342  UINT uVirtualKey, uModifiers;
343  HKL hKL;
344 
345  while (nCount-- > 0)
346  {
347  if (!bCheck || !NtUserGetImeHotKey(pEntries->dwHotKeyId, &uModifiers, &uVirtualKey, &hKL))
348  {
350  pEntries->uModifiers,
351  pEntries->uVirtualKey,
352  pEntries->hKL,
354  }
355  ++pEntries;
356  }
357 }
DWORD dwHotKeyId
Definition: input.c:36
UINT uModifiers
Definition: input.c:38
UINT uVirtualKey
Definition: input.c:37
BOOL APIENTRY CliImmSetHotKeyWorker(DWORD dwHotKeyId, UINT uModifiers, UINT uVirtualKey, HKL hKL, DWORD dwAction)
Definition: input.c:111
UINT_PTR HKL
Definition: msctf.idl:101
BOOL NTAPI NtUserGetImeHotKey(DWORD dwHotKeyId, LPUINT lpuModifiers, LPUINT lpuVirtualKey, LPHKL lphKL)
Definition: ime.c:416
unsigned int UINT
Definition: ndis.h:50

Referenced by CliImmInitializeHotKeys().

◆ CliSetSingleHotKey()

BOOL FASTCALL CliSetSingleHotKey ( LPCWSTR  pszSubKey,
HANDLE  hKey 
)

Definition at line 249 of file input.c.

250 {
251  LONG error;
252  HKEY hSubKey;
253  DWORD dwHotKeyId = 0;
254  UINT uModifiers = 0, uVirtualKey = 0;
255  HKL hKL = NULL;
256  UNICODE_STRING ustrName;
257 
258  error = RegOpenKeyExW(hKey, pszSubKey, 0, KEY_READ, &hSubKey);
259  if (error != ERROR_SUCCESS)
260  return FALSE;
261 
262  RtlInitUnicodeString(&ustrName, pszSubKey);
263  RtlUnicodeStringToInteger(&ustrName, 16, &dwHotKeyId);
264 
265  uModifiers = CliReadRegistryValue(hSubKey, L"Key Modifiers");
266  hKL = (HKL)(ULONG_PTR)CliReadRegistryValue(hSubKey, L"Target IME");
267  uVirtualKey = CliReadRegistryValue(hSubKey, L"Virtual Key");
268 
269  RegCloseKey(hSubKey);
270 
271  return CliImmSetHotKeyWorker(dwHotKeyId, uModifiers, uVirtualKey, hKL, SETIMEHOTKEY_ADD);
272 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
#define KEY_READ
Definition: nt_native.h:1023
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
DWORD FASTCALL CliReadRegistryValue(HANDLE hKey, LPCWSTR pszName)
Definition: input.c:97
BOOL APIENTRY CliImmSetHotKeyWorker(DWORD dwHotKeyId, UINT uModifiers, UINT uVirtualKey, HKL hKL, DWORD dwAction)
Definition: input.c:111
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT_PTR HKL
Definition: msctf.idl:101
FxAutoRegKey hKey
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToInteger(PUNICODE_STRING String, ULONG Base, PULONG Value)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RegCloseKey(hKey)
Definition: registry.h:47

Referenced by CliGetImeHotKeysFromRegistry().

◆ DragDetect()

BOOL WINAPI DragDetect ( HWND  hWnd,
POINT  pt 
)

Definition at line 415 of file input.c.

418 {
419  return NtUserDragDetect(hWnd, pt);
420 #if 0
421  MSG msg;
422  RECT rect;
423  POINT tmp;
426 
427  rect.left = pt.x - dx;
428  rect.right = pt.x + dx;
429  rect.top = pt.y - dy;
430  rect.bottom = pt.y + dy;
431 
432  SetCapture(hWnd);
433 
434  for (;;)
435  {
436  while (
439  )
440  {
441  if (msg.message == WM_LBUTTONUP)
442  {
443  ReleaseCapture();
444  return FALSE;
445  }
446  if (msg.message == WM_MOUSEMOVE)
447  {
448  tmp.x = LOWORD(msg.lParam);
449  tmp.y = HIWORD(msg.lParam);
450  if (!PtInRect(&rect, tmp))
451  {
452  ReleaseCapture();
453  return TRUE;
454  }
455  }
456  if (msg.message == WM_KEYDOWN)
457  {
458  if (msg.wParam == VK_ESCAPE)
459  {
460  ReleaseCapture();
461  return TRUE;
462  }
463  }
464  }
465  WaitMessage();
466  }
467  return 0;
468 #endif
469 }
#define WM_MOUSEFIRST
Definition: winuser.h:1761
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
BOOL WINAPI WaitMessage(void)
Definition: ntwrapper.h:350
GLint dy
Definition: linetemp.h:97
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
HWND hWnd
Definition: settings.c:17
#define VK_ESCAPE
Definition: winuser.h:2194
& rect
Definition: startmenu.cpp:1413
#define WM_KEYFIRST
Definition: winuser.h:1701
#define FALSE
Definition: types.h:117
#define WM_KEYDOWN
Definition: winuser.h:1702
#define SM_CXDRAG
Definition: winuser.h:1022
#define WM_MOUSELAST
Definition: winuser.h:1788
int WINAPI GetSystemMetrics(_In_ int)
#define WM_KEYLAST
Definition: winuser.h:1715
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define WM_LBUTTONUP
Definition: winuser.h:1764
#define WM_MOUSEMOVE
Definition: winuser.h:1762
GLint dx
Definition: linetemp.h:97
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define HIWORD(l)
Definition: typedefs.h:247
unsigned int ULONG
Definition: retypes.h:1
#define SM_CYDRAG
Definition: winuser.h:1023
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PM_REMOVE
Definition: winuser.h:1186
#define LOWORD(l)
Definition: pedump.c:82
BOOL NTAPI NtUserDragDetect(HWND hWnd, POINT pt)
Definition: message.c:2156

◆ EnableWindow()

BOOL WINAPI EnableWindow ( HWND  hWnd,
BOOL  bEnable 
)

Definition at line 475 of file input.c.

476 {
478 }
HWND hWnd
Definition: settings.c:17
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 486 of file input.c.

487 {
488  if (vKey < 0 || vKey > 256)
489  return 0;
490  return (SHORT)NtUserGetAsyncKeyState((DWORD)vKey);
491 }
short SHORT
Definition: pedump.c:59
unsigned long DWORD
Definition: ntddk_ex.h:95
SHORT NTAPI NtUserGetAsyncKeyState(INT Key)
Definition: keyboard.c:632

Referenced by hook_proc(), and test_get_async_key_state().

◆ GetKBCodePage()

UINT WINAPI GetKBCodePage ( VOID  )

Definition at line 508 of file input.c.

509 {
510  return GetOEMCP();
511 }
UINT WINAPI GetOEMCP(VOID)
Definition: nls.c:2233

◆ GetKeyboardLayout()

HKL WINAPI GetKeyboardLayout ( DWORD  idThread)

Definition at line 498 of file input.c.

499 {
500  return NtUserxGetKeyboardLayout(idThread);
501 }
EXTINLINE HKL NtUserxGetKeyboardLayout(DWORD idThread)
Definition: ntwrapper.h:626

Referenced by MapVirtualKeyA(), MapVirtualKeyW(), test_Input_blackbox(), test_key_map(), test_keyboard_layout_name(), test_ToAscii(), and test_ToUnicode().

◆ GetKeyboardLayoutNameA()

BOOL WINAPI GetKeyboardLayoutNameA ( LPSTR  pwszKLID)

Definition at line 568 of file input.c.

569 {
571 
573  return FALSE;
574 
575  if (!WideCharToMultiByte(CP_ACP, 0, buf, -1, pwszKLID, KL_NAMELENGTH, NULL, NULL))
576  return FALSE;
577 
578  return TRUE;
579 }
#define KL_NAMELENGTH
Definition: winuser.h:122
#define WideCharToMultiByte
Definition: compat.h:111
#define TRUE
Definition: types.h:120
#define CP_ACP
Definition: compat.h:109
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define FALSE
Definition: types.h:117
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI GetKeyboardLayoutNameW(LPWSTR pwszKLID)
Definition: input.c:585
#define NULL
Definition: types.h:112

Referenced by test_keyboard_layout_name().

◆ GetKeyboardLayoutNameW()

BOOL WINAPI GetKeyboardLayoutNameW ( LPWSTR  pwszKLID)

Definition at line 585 of file input.c.

586 {
587  return NtUserGetKeyboardLayoutName(pwszKLID);
588 }
BOOL NTAPI NtUserGetKeyboardLayoutName(LPWSTR lpszName)
Definition: kbdlayout.c:610

Referenced by GetKeyboardLayoutNameA(), and test_keyboard_layout_name().

◆ GetKeyboardType()

int WINAPI GetKeyboardType ( int  nTypeFlag)

Definition at line 594 of file input.c.

595 {
596  return NtUserxGetKeyboardType(nTypeFlag);
597 }
EXTINLINE INT NtUserxGetKeyboardType(INT nTypeFlag)
Definition: ntwrapper.h:631

◆ GetKeyNameTextA()

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

Definition at line 518 of file input.c.

521 {
522  LPWSTR pwszBuf;
523  UINT cchBuf = 0;
524  int iRet = 0;
525  BOOL defChar = FALSE;
526 
527  pwszBuf = HeapAlloc(GetProcessHeap(), 0, nSize * sizeof(WCHAR));
528  if (!pwszBuf)
529  return 0;
530 
531  cchBuf = NtUserGetKeyNameText(lParam, pwszBuf, nSize);
532 
533  iRet = WideCharToMultiByte(CP_ACP, 0,
534  pwszBuf, cchBuf,
535  lpString, nSize, ".", &defChar); // FIXME: do we need defChar?
536  lpString[iRet] = 0;
537  HeapFree(GetProcessHeap(), 0, pwszBuf);
538 
539  return iRet;
540 }
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2058
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned int UINT
Definition: ndis.h:50
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPARAM lParam
Definition: combotst.c:139
#define HeapFree(x, y, z)
Definition: compat.h:594
DWORD NTAPI NtUserGetKeyNameText(LONG lParam, LPWSTR lpString, int nSize)
Definition: keyboard.c:1451

Referenced by test_key_names(), and test_keynames().

◆ GetKeyNameTextW()

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

Definition at line 546 of file input.c.

549 {
550  return NtUserGetKeyNameText(lParam, lpString, nSize);
551 }
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2058
LPARAM lParam
Definition: combotst.c:139
DWORD NTAPI NtUserGetKeyNameText(LONG lParam, LPWSTR lpString, int nSize)
Definition: keyboard.c:1451

Referenced by test_key_names().

◆ GetKeyState()

SHORT WINAPI DECLSPEC_HOTPATCH GetKeyState ( int  nVirtKey)

Definition at line 559 of file input.c.

560 {
561  return (SHORT)NtUserGetKeyState((DWORD)nVirtKey);
562 }
short SHORT
Definition: pedump.c:59
SHORT NTAPI NtUserGetKeyState(INT VirtKey)
Definition: msgqueue.c:2591
unsigned long DWORD
Definition: ntddk_ex.h:95

Referenced by get_key_state_thread().

◆ GetLastInputInfo()

BOOL WINAPI GetLastInputInfo ( PLASTINPUTINFO  plii)

Definition at line 603 of file input.c.

604 {
605  TRACE("%p\n", plii);
606 
607  if (plii->cbSize != sizeof (*plii))
608  {
610  return FALSE;
611  }
612 
613  plii->dwTime = gpsi->dwLastRITEventTickCount;
614  return TRUE;
615 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define TRUE
Definition: types.h:120
PSERVERINFO gpsi
Definition: imm.c:17
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
#define SetLastError(x)
Definition: compat.h:611

◆ IntSetFeKeyboardFlags()

VOID FASTCALL IntSetFeKeyboardFlags ( LANGID  LangID,
PBYTE  pbFlags 
)

Definition at line 70 of file input.c.

71 {
72  switch (LangID)
73  {
75  *pbFlags |= FE_JAPANESE;
76  break;
77 
80  *pbFlags |= FE_CHINESE_TRADITIONAL;
81  break;
82 
85  *pbFlags |= FE_CHINESE_SIMPLIFIED;
86  break;
87 
89  *pbFlags |= FE_KOREAN;
90  break;
91 
92  default:
93  break;
94  }
95 }
#define SUBLANG_CHINESE_TRADITIONAL
Definition: nls.h:208
#define SUBLANG_DEFAULT
Definition: nls.h:168
#define SUBLANG_CHINESE_HONGKONG
Definition: nls.h:210
#define SUBLANG_CHINESE_SINGAPORE
Definition: nls.h:211
#define LANG_JAPANESE
Definition: nls.h:76
#define FE_CHINESE_SIMPLIFIED
Definition: input.c:65
#define SUBLANG_CHINESE_SIMPLIFIED
Definition: nls.h:209
#define SUBLANG_KOREAN
Definition: nls.h:280
#define FE_KOREAN
Definition: input.c:66
#define FE_CHINESE_TRADITIONAL
Definition: input.c:64
#define LANG_CHINESE
Definition: nls.h:42
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LANG_KOREAN
Definition: nls.h:84
#define FE_JAPANESE
Definition: input.c:63
_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:1075

Referenced by CliGetPreloadKeyboardLayouts(), and CliImmInitializeHotKeys().

◆ keybd_event()

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

Definition at line 942 of file input.c.

947 {
948  INPUT Input;
949 
950  Input.type = INPUT_KEYBOARD;
951  Input.ki.wVk = bVk;
952  Input.ki.wScan = bScan;
953  Input.ki.dwFlags = dwFlags;
954  Input.ki.time = 0;
955  Input.ki.dwExtraInfo = dwExtraInfo;
956 
957  NtUserSendInput(1, &Input, sizeof(INPUT));
958 }
Definition: arc.h:84
#define INPUT_KEYBOARD
Definition: winable.h:10
UINT APIENTRY NtUserSendInput(UINT nInputs, LPINPUT pInput, INT cbSize)
Definition: input.c:708
BOOL bScan
Definition: wlanconf.c:24
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

Referenced by test_GetKeyState().

◆ LoadKeyboardLayoutA()

HKL WINAPI LoadKeyboardLayoutA ( LPCSTR  pszKLID,
UINT  Flags 
)

Definition at line 621 of file input.c.

623 {
624  WCHAR wszKLID[16];
625 
626  if (!MultiByteToWideChar(CP_ACP, 0, pszKLID, -1,
627  wszKLID, sizeof(wszKLID)/sizeof(wszKLID[0])))
628  {
629  return FALSE;
630  }
631 
632  return LoadKeyboardLayoutW(wszKLID, Flags);
633 }
HKL WINAPI LoadKeyboardLayoutW(LPCWSTR pwszKLID, UINT Flags)
Definition: input.c:639
#define CP_ACP
Definition: compat.h:109
#define FALSE
Definition: types.h:117
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MultiByteToWideChar
Definition: compat.h:110

◆ LoadKeyboardLayoutW()

HKL WINAPI LoadKeyboardLayoutW ( LPCWSTR  pwszKLID,
UINT  Flags 
)

Definition at line 639 of file input.c.

641 {
642  DWORD dwhkl, dwType, dwSize;
643  UNICODE_STRING ustrKbdName;
644  UNICODE_STRING ustrKLID;
645  WCHAR wszRegKey[256] = L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\";
646  WCHAR wszLayoutId[10], wszNewKLID[10];
647  HKEY hKey;
648 
649  /* LOWORD of dwhkl is Locale Identifier */
650  dwhkl = LOWORD(wcstoul(pwszKLID, NULL, 16));
651 
652  if (Flags & KLF_SUBSTITUTE_OK)
653  {
654  /* Check substitutes key */
655  if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Substitutes", 0,
657  {
658  dwSize = sizeof(wszNewKLID);
659  if (RegQueryValueExW(hKey, pwszKLID, NULL, &dwType, (LPBYTE)wszNewKLID, &dwSize) == ERROR_SUCCESS)
660  {
661  /* Use new KLID value */
662  pwszKLID = wszNewKLID;
663  }
664 
665  /* Close the key now */
666  RegCloseKey(hKey);
667  }
668  }
669 
670  /* Append KLID at the end of registry key */
671  StringCbCatW(wszRegKey, sizeof(wszRegKey), pwszKLID);
672 
673  /* Open layout registry key for read */
674  if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszRegKey, 0,
676  {
677  dwSize = sizeof(wszLayoutId);
678  if (RegQueryValueExW(hKey, L"Layout Id", NULL, &dwType, (LPBYTE)wszLayoutId, &dwSize) == ERROR_SUCCESS)
679  {
680  /* If Layout Id is specified, use this value | f000 as HIWORD */
681  /* FIXME: Microsoft Office expects this value to be something specific
682  * for Japanese and Korean Windows with an IME the value is 0xe001
683  * We should probably check to see if an IME exists and if so then
684  * set this word properly.
685  */
686  dwhkl |= (0xf000 | wcstol(wszLayoutId, NULL, 16)) << 16;
687  }
688 
689  /* Close the key now */
690  RegCloseKey(hKey);
691  }
692  else
693  {
694  ERR("Could not find keyboard layout %S.\n", pwszKLID);
695  return NULL;
696  }
697 
698  /* If Layout Id is not given HIWORD == LOWORD (for dwhkl) */
699  if (!HIWORD(dwhkl))
700  dwhkl |= dwhkl << 16;
701 
702  ZeroMemory(&ustrKbdName, sizeof(ustrKbdName));
703  RtlInitUnicodeString(&ustrKLID, pwszKLID);
704  return NtUserLoadKeyboardLayoutEx(NULL, 0, &ustrKbdName,
705  NULL, &ustrKLID,
706  dwhkl, Flags);
707 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define ZeroMemory
Definition: winbase.h:1667
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
STRSAFEAPI StringCbCatW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:342
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
#define KLF_SUBSTITUTE_OK
Definition: winuser.h:112
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
HKL NTAPI NtUserLoadKeyboardLayoutEx(IN HANDLE Handle, IN DWORD offTable, IN PUNICODE_STRING puszKeyboardName, IN HKL hKL, IN PUNICODE_STRING puszKLID, IN DWORD dwKLID, IN UINT Flags)
Definition: kbdlayout.c:649
#define ERR(fmt,...)
Definition: debug.h:110
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
#define HIWORD(l)
Definition: typedefs.h:247
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define LOWORD(l)
Definition: pedump.c:82
#define RegCloseKey(hKey)
Definition: registry.h:47
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by LoadKeyboardLayoutA().

◆ MapVirtualKeyA()

UINT WINAPI MapVirtualKeyA ( UINT  uCode,
UINT  uMapType 
)

Definition at line 725 of file input.c.

727 {
728  return MapVirtualKeyExA(uCode, uMapType, GetKeyboardLayout(0));
729 }
UINT WINAPI MapVirtualKeyExA(UINT uCode, UINT uMapType, HKL dwhkl)
Definition: input.c:735
HKL WINAPI GetKeyboardLayout(DWORD idThread)
Definition: input.c:498

◆ MapVirtualKeyExA()

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

Definition at line 735 of file input.c.

738 {
739  return MapVirtualKeyExW(uCode, uMapType, dwhkl);
740 }
UINT WINAPI MapVirtualKeyExW(UINT uCode, UINT uMapType, HKL dwhkl)
Definition: input.c:747

Referenced by MapVirtualKeyA(), and test_key_map().

◆ MapVirtualKeyExW()

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

Definition at line 747 of file input.c.

750 {
751  return NtUserMapVirtualKeyEx(uCode, uMapType, 0, dwhkl);
752 }
UINT NTAPI NtUserMapVirtualKeyEx(UINT keyCode, UINT transType, DWORD keyboardId, HKL dwhkl)
Definition: keyboard.c:1306

Referenced by MapVirtualKeyExA(), and MapVirtualKeyW().

◆ MapVirtualKeyW()

UINT WINAPI MapVirtualKeyW ( UINT  uCode,
UINT  uMapType 
)

Definition at line 759 of file input.c.

761 {
762  return MapVirtualKeyExW(uCode, uMapType, GetKeyboardLayout(0));
763 }
UINT WINAPI MapVirtualKeyExW(UINT uCode, UINT uMapType, HKL dwhkl)
Definition: input.c:747
HKL WINAPI GetKeyboardLayout(DWORD idThread)
Definition: input.c:498

Referenced by OemKeyScan(), test_OemKeyScan(), and test_ToUnicode().

◆ mouse_event()

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

Definition at line 966 of file input.c.

972 {
973  INPUT Input;
974 
975  Input.type = INPUT_MOUSE;
976  Input.mi.dx = dx;
977  Input.mi.dy = dy;
978  Input.mi.mouseData = dwData;
979  Input.mi.dwFlags = dwFlags;
980  Input.mi.time = 0;
981  Input.mi.dwExtraInfo = dwExtraInfo;
982 
983  NtUserSendInput(1, &Input, sizeof(INPUT));
984 }
GLint dy
Definition: linetemp.h:97
Definition: arc.h:84
static HANDLE ULONG_PTR dwData
Definition: file.c:35
UINT APIENTRY NtUserSendInput(UINT nInputs, LPINPUT pInput, INT cbSize)
Definition: input.c:708
#define INPUT_MOUSE
Definition: winable.h:9
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
GLint dx
Definition: linetemp.h:97

Referenced by test_mouse_ll_hook().

◆ OemKeyScan()

DWORD WINAPI OemKeyScan ( WORD  wOemChar)

Definition at line 770 of file input.c.

771 {
772  WCHAR p;
773  SHORT Vk;
774  UINT Scan;
775 
776  MultiByteToWideChar(CP_OEMCP, 0, (PCSTR)&wOemChar, 1, &p, 1);
777  Vk = VkKeyScanW(p);
778  Scan = MapVirtualKeyW((Vk & 0x00ff), 0);
779  if (!Scan) return -1;
780  /*
781  Page 450-1, MS W2k SuperBible by SAMS. Return, low word has the
782  scan code and high word has the shift state.
783  */
784  return ((Vk & 0xff00) << 8) | Scan;
785 }
SHORT WINAPI VkKeyScanW(WCHAR ch)
Definition: input.c:931
short SHORT
Definition: pedump.c:59
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned int UINT
Definition: ndis.h:50
#define MultiByteToWideChar
Definition: compat.h:110
const char * PCSTR
Definition: typedefs.h:52
GLfloat GLfloat p
Definition: glext.h:8902
UINT WINAPI MapVirtualKeyW(UINT uCode, UINT uMapType)
Definition: input.c:759
#define CP_OEMCP
Definition: winnls.h:231

Referenced by test_OemKeyScan().

◆ SetDoubleClickTime()

BOOL WINAPI SetDoubleClickTime ( UINT  uInterval)

Definition at line 792 of file input.c.

793 {
795  uInterval,
796  NULL,
797  0);
798 }
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SPI_SETDOUBLECLICKTIME
Definition: winuser.h:1368
BOOL NTAPI NtUserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2153
#define NULL
Definition: types.h:112

◆ SwapMouseButton()

BOOL WINAPI SwapMouseButton ( BOOL  fSwap)

Definition at line 806 of file input.c.

808 {
809  return NtUserxSwapMouseButton(fSwap);
810 }
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 817 of file input.c.

822 {
823  return ToAsciiEx(uVirtKey, uScanCode, lpKeyState, lpChar, uFlags, 0);
824 }
UINT uFlags
Definition: api.c:59
int WINAPI ToAsciiEx(UINT uVirtKey, UINT uScanCode, CONST BYTE *lpKeyState, LPWORD lpChar, UINT uFlags, HKL dwhkl)
Definition: input.c:831

Referenced by test_ToAscii().

◆ ToAsciiEx()

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

Definition at line 831 of file input.c.

837 {
838  WCHAR UniChars[2];
839  int Ret, CharCount;
840 
841  Ret = ToUnicodeEx(uVirtKey, uScanCode, lpKeyState, UniChars, 2, uFlags, dwhkl);
842  CharCount = (Ret < 0 ? 1 : Ret);
843  WideCharToMultiByte(CP_ACP, 0, UniChars, CharCount, (LPSTR)lpChar, 2, NULL, NULL);
844 
845  return Ret;
846 }
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
UINT uFlags
Definition: api.c:59
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI ToUnicodeEx(UINT wVirtKey, UINT wScanCode, CONST BYTE *lpKeyState, LPWSTR pwszBuff, int cchBuff, UINT wFlags, HKL dwhkl)
Definition: input.c:869
#define NULL
Definition: types.h:112

Referenced by test_ToAscii(), and ToAscii().

◆ ToUnicode()

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

Definition at line 853 of file input.c.

859 {
860  return ToUnicodeEx(wVirtKey, wScanCode, lpKeyState, pwszBuff, cchBuff,
861  wFlags, 0);
862 }
int WINAPI ToUnicodeEx(UINT wVirtKey, UINT wScanCode, CONST BYTE *lpKeyState, LPWSTR pwszBuff, int cchBuff, UINT wFlags, HKL dwhkl)
Definition: input.c:869
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531

Referenced by test_ToUnicode().

◆ ToUnicodeEx()

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

Definition at line 869 of file input.c.

876 {
877  return NtUserToUnicodeEx(wVirtKey, wScanCode, (PBYTE)lpKeyState, pwszBuff, cchBuff,
878  wFlags, dwhkl);
879 }
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531
INT NTAPI NtUserToUnicodeEx(UINT wVirtKey, UINT wScanCode, PBYTE lpKeyState, LPWSTR pwszBuff, int cchBuff, UINT wFlags, HKL dwhkl)
BYTE * PBYTE
Definition: pedump.c:66

Referenced by ConioProcessKey(), test_ToUnicode(), ToAsciiEx(), and ToUnicode().

◆ UnloadKeyboardLayout()

BOOL WINAPI UnloadKeyboardLayout ( HKL  hKL)

Definition at line 712 of file input.c.

713 {
714  if (!NtUserUnloadKeyboardLayout(hKL))
715  return FALSE;
716 
718  return TRUE;
719 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
VOID APIENTRY CliImmInitializeHotKeys(DWORD dwAction, HKL hKL)
Definition: input.c:359
BOOL NTAPI NtUserUnloadKeyboardLayout(HKL hKl)
Definition: kbdlayout.c:822

◆ VkKeyScanA()

SHORT WINAPI VkKeyScanA ( CHAR  ch)

Definition at line 887 of file input.c.

888 {
889  WCHAR wChar;
890 
891  if (IsDBCSLeadByte(ch))
892  return -1;
893 
894  MultiByteToWideChar(CP_ACP, 0, &ch, 1, &wChar, 1);
895  return VkKeyScanW(wChar);
896 }
#define CP_ACP
Definition: compat.h:109
SHORT WINAPI VkKeyScanW(WCHAR ch)
Definition: input.c:931
BOOL WINAPI IsDBCSLeadByte(BYTE TestByte)
Definition: nls.c:2270
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MultiByteToWideChar
Definition: compat.h:110

◆ VkKeyScanExA()

SHORT WINAPI VkKeyScanExA ( CHAR  ch,
HKL  dwhkl 
)

Definition at line 903 of file input.c.

905 {
906  WCHAR wChar;
907 
908  if (IsDBCSLeadByte(ch))
909  return -1;
910 
911  MultiByteToWideChar(CP_ACP, 0, &ch, 1, &wChar, 1);
912  return VkKeyScanExW(wChar, dwhkl);
913 }
#define CP_ACP
Definition: compat.h:109
BOOL WINAPI IsDBCSLeadByte(BYTE TestByte)
Definition: nls.c:2270
__wchar_t WCHAR
Definition: xmlstorage.h:180
SHORT WINAPI VkKeyScanExW(WCHAR ch, HKL dwhkl)
Definition: input.c:920
#define MultiByteToWideChar
Definition: compat.h:110

◆ VkKeyScanExW()

SHORT WINAPI VkKeyScanExW ( WCHAR  ch,
HKL  dwhkl 
)

Definition at line 920 of file input.c.

922 {
923  return (SHORT)NtUserVkKeyScanEx(ch, dwhkl, TRUE);
924 }
#define TRUE
Definition: types.h:120
short SHORT
Definition: pedump.c:59
DWORD NTAPI NtUserVkKeyScanEx(WCHAR wChar, HKL KeyboardLayout, BOOL bUsehHK)
Definition: keyboard.c:1576

Referenced by VkKeyScanExA().

◆ VkKeyScanW()

SHORT WINAPI VkKeyScanW ( WCHAR  ch)

Definition at line 931 of file input.c.

932 {
933  return (SHORT)NtUserVkKeyScanEx(ch, 0, FALSE);
934 }
#define FALSE
Definition: types.h:117
short SHORT
Definition: pedump.c:59
DWORD NTAPI NtUserVkKeyScanEx(WCHAR wChar, HKL KeyboardLayout, BOOL bUsehHK)
Definition: keyboard.c:1576

Referenced by OemKeyScan(), test_OemKeyScan(), test_ToUnicode(), and VkKeyScanA().

◆ 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:331
#define MOD_LEFT
Definition: imm.h:323
#define MOD_SHIFT
Definition: imm.h:321
#define IME_CHOTKEY_SHAPE_TOGGLE
Definition: imm.h:332
#define NULL
Definition: types.h:112
#define VK_SPACE
Definition: winuser.h:2199
#define MOD_RIGHT
Definition: imm.h:324
#define MOD_CONTROL
Definition: imm.h:320

Definition at line 56 of file input.c.

Referenced by CliImmInitializeHotKeys().

◆ DefaultHotKeyTableJ

IMEHOTKEYENTRY DefaultHotKeyTableJ[]
Initial value:
=
{
}
#define IME_JHOTKEY_CLOSE_OPEN
Definition: imm.h:336
#define VK_KANJI
Definition: winuser.h:2193
#define MOD_IGNORE_ALL_MODIFIER
Definition: imm.h:327
#define NULL
Definition: types.h:112

Definition at line 43 of file input.c.

Referenced by CliImmInitializeHotKeys().

◆ DefaultHotKeyTableT

IMEHOTKEYENTRY DefaultHotKeyTableT[]
Initial value:
=
{
}
#define IME_THOTKEY_SHAPE_TOGGLE
Definition: imm.h:344
#define MOD_LEFT
Definition: imm.h:323
#define MOD_SHIFT
Definition: imm.h:321
#define IME_THOTKEY_IME_NONIME_TOGGLE
Definition: imm.h:343
#define NULL
Definition: types.h:112
#define VK_SPACE
Definition: winuser.h:2199
#define MOD_RIGHT
Definition: imm.h:324
#define MOD_CONTROL
Definition: imm.h:320

Definition at line 49 of file input.c.

Referenced by CliImmInitializeHotKeys().