ReactOS 0.4.17-dev-1421-g4623072
input.c
Go to the documentation of this file.
1/*
2 * ReactOS kernel
3 * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19/*
20 * PROJECT: ReactOS user32.dll
21 * FILE: win32ss/user/user32/windows/input.c
22 * PURPOSE: Input
23 * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
24 * UPDATE HISTORY:
25 * 09-05-2001 CSH Created
26 */
27
28#include <user32.h>
29#include <cjkcode.h>
30#include <strsafe.h>
31
33
34#define KLF_INITTIME 0x80000000
35#define KLF_FORCE 0x200
36
37#define KBDLAYOUTS_KEY L"System\\CurrentControlSet\\Control\\Keyboard Layouts"
38#define KBDLAYOUT_KEY L"System\\CurrentControlSet\\Control\\Keyboard Layout"
39#define ATTR_MASK 0x00FF0000
40#define LANGID_ENGLISH_US MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)
41
42/* Procedure ordinals of keyboard layout file */
43#define IFN_KbdLayerDescriptor MAKEINTRESOURCEA(1)
44#define IFN_KbdNlsLayerDescriptor MAKEINTRESOURCEA(2)
45#define IFN_KbdLayerRealDllFileNT4 MAKEINTRESOURCEA(3)
46#define IFN_KbdLayerRealDllFile MAKEINTRESOURCEA(5)
47#define IFN_KbdLayerMultiDescriptor MAKEINTRESOURCEA(6)
48
49/* The function types of keyboard layout file */
55
57{
58 return FALSE; /* FIXME */
59}
60
61typedef struct tagIMEHOTKEYENTRY
62{
68
69// Japanese
71{
73};
74
75// Chinese Traditional
77{
80};
81
82// Chinese Simplified
84{
87};
88
89// The far-east flags
90#define FE_JAPANESE (1 << 0)
91#define FE_CHINESE_TRADITIONAL (1 << 1)
92#define FE_CHINESE_SIMPLIFIED (1 << 2)
93#define FE_KOREAN (1 << 3)
94
95// Sets the far-east flags
97{
98 switch (LangID)
99 {
101 *pbFlags |= FE_JAPANESE;
102 break;
103
106 *pbFlags |= FE_CHINESE_TRADITIONAL;
107 break;
108
111 *pbFlags |= FE_CHINESE_SIMPLIFIED;
112 break;
113
115 *pbFlags |= FE_KOREAN;
116 break;
117
118 default:
119 break;
120 }
121}
122
124{
125 DWORD dwValue, cbValue;
126 LONG error;
127
128 cbValue = sizeof(dwValue);
129 error = RegQueryValueExW(hKey, pszName, NULL, NULL, (LPBYTE)&dwValue, &cbValue);
130 if (error != ERROR_SUCCESS || cbValue < sizeof(DWORD))
131 return 0;
132
133 return dwValue;
134}
135
137CliImmSetHotKeyWorker(DWORD dwHotKeyId, UINT uModifiers, UINT uVirtualKey, HKL hKL, DWORD dwAction)
138{
139 if (dwAction == SETIMEHOTKEY_ADD)
140 {
141 if (IME_HOTKEY_DSWITCH_FIRST <= dwHotKeyId && dwHotKeyId <= IME_HOTKEY_DSWITCH_LAST)
142 {
143 if (!hKL)
144 goto Failure;
145 }
146 else
147 {
148 if (hKL)
149 goto Failure;
150
151 if (IME_KHOTKEY_SHAPE_TOGGLE <= dwHotKeyId &&
153 {
154 // The Korean cannot set the IME hotkeys
155 goto Failure;
156 }
157 }
158
159#define MOD_ALL_MODS (MOD_ALT | MOD_CONTROL | MOD_SHIFT | MOD_WIN)
160 if ((uModifiers & MOD_ALL_MODS) && !(uModifiers & (MOD_LEFT | MOD_RIGHT)))
161 goto Failure;
162#undef MOD_ALL_MODS
163 }
164
165 return NtUserSetImeHotKey(dwHotKeyId, uModifiers, uVirtualKey, hKL, dwAction);
166
167Failure:
169 return FALSE;
170}
171
173{
174 UINT nNumber, uFlags;
175 DWORD cbValue, dwType;
176 WCHAR szNumber[32], szValue[KL_NAMELENGTH];
177 HKEY hPreloadKey;
178 BOOL bOK = FALSE;
179 HKL hKL, hDefaultKL = NULL;
180
182 L"Keyboard Layout\\Preload",
183 &hPreloadKey) != ERROR_SUCCESS)
184 {
185 return;
186 }
187
188 for (nNumber = 1; nNumber <= 1000; ++nNumber)
189 {
190 _ultow(nNumber, szNumber, 10);
191
192 cbValue = sizeof(szValue);
193 if (RegQueryValueExW(hPreloadKey,
194 szNumber,
195 NULL,
196 &dwType,
197 (LPBYTE)szValue,
198 &cbValue) != ERROR_SUCCESS)
199 {
200 break;
201 }
202
203 if (dwType != REG_SZ)
204 continue;
205
206 if (nNumber == 1) /* The first entry is for default keyboard layout */
207 uFlags = KLF_SUBSTITUTE_OK | KLF_ACTIVATE | KLF_RESET;
208 else
210
211 hKL = LoadKeyboardLayoutW(szValue, uFlags);
212 if (hKL)
213 {
214 bOK = TRUE;
215 if (nNumber == 1) /* The first entry */
216 hDefaultKL = hKL;
217 }
218 }
219
220 RegCloseKey(hPreloadKey);
221
222 if (hDefaultKL)
223 SystemParametersInfoW(SPI_SETDEFAULTINPUTLANG, 0, &hDefaultKL, 0);
224
225 if (!bOK)
226 {
227 /* Fallback to English (US) */
228 LoadKeyboardLayoutW(L"00000409", KLF_SUBSTITUTE_OK | KLF_ACTIVATE | KLF_RESET);
229 }
230}
231
232
234CliSaveImeHotKey(DWORD dwID, UINT uModifiers, UINT uVirtualKey, HKL hKL, BOOL bDelete)
235{
237 LONG error;
238 HKEY hKey;
239 BOOL ret = FALSE, bRevertOnFailure = FALSE;
240
242 L"Control Panel\\Input Method\\Hot Keys\\%08lX", dwID);
243
244 if (bDelete)
245 {
247 return (error == ERROR_SUCCESS);
248 }
249
251 if (error == ERROR_SUCCESS)
252 {
253 bRevertOnFailure = TRUE;
254
255 // Set "Virtual Key"
256 error = RegSetValueExW(hKey, L"Virtual Key", 0, REG_BINARY,
257 (LPBYTE)&uVirtualKey, sizeof(uVirtualKey));
258 if (error == ERROR_SUCCESS)
259 {
260 // Set "Key Modifiers"
261 error = RegSetValueExW(hKey, L"Key Modifiers", 0, REG_BINARY,
262 (LPBYTE)&uModifiers, sizeof(uModifiers));
263 if (error == ERROR_SUCCESS)
264 {
265 // Set "Target IME"
266 error = RegSetValueExW(hKey, L"Target IME", 0, REG_BINARY,
267 (LPBYTE)&hKL, sizeof(hKL));
268 if (error == ERROR_SUCCESS)
269 {
270 // Success!
271 ret = TRUE;
272 bRevertOnFailure = FALSE;
273 }
274 }
275 }
277 }
278
279 if (bRevertOnFailure)
280 CliSaveImeHotKey(dwID, uVirtualKey, uModifiers, hKL, TRUE);
281
282 return ret;
283}
284
291 _In_ DWORD dwID,
292 _In_ UINT uModifiers,
293 _In_ UINT uVirtualKey,
294 _In_opt_ _When_((dwAction == SETIMEHOTKEY_ADD) &&
295 !(IME_HOTKEY_DSWITCH_FIRST <= dwHotKeyId &&
296 dwHotKeyId <= IME_HOTKEY_DSWITCH_LAST), _Null_) HKL hKL)
297{
298 BOOL ret;
299
300 if (uVirtualKey == 0) // Delete?
301 {
302 ret = CliSaveImeHotKey(dwID, uModifiers, uVirtualKey, hKL, TRUE);
303 if (ret)
304 CliImmSetHotKeyWorker(dwID, uModifiers, uVirtualKey, hKL, SETIMEHOTKEY_DELETE);
305 return ret;
306 }
307
308 // Add
309 ret = CliImmSetHotKeyWorker(dwID, uModifiers, uVirtualKey, hKL, SETIMEHOTKEY_ADD);
310 if (ret)
311 {
312 ret = CliSaveImeHotKey(dwID, uModifiers, uVirtualKey, hKL, FALSE);
313 if (!ret) // Failure?
314 CliImmSetHotKeyWorker(dwID, uModifiers, uVirtualKey, hKL, SETIMEHOTKEY_DELETE);
315 }
316
317 return ret;
318}
319
321{
322 LONG error;
323 HKEY hSubKey;
324 DWORD dwHotKeyId = 0;
325 UINT uModifiers = 0, uVirtualKey = 0;
326 HKL hKL = NULL;
327 UNICODE_STRING ustrName;
328
329 error = RegOpenKeyExW(hKey, pszSubKey, 0, KEY_READ, &hSubKey);
330 if (error != ERROR_SUCCESS)
331 return FALSE;
332
334 RtlUnicodeStringToInteger(&ustrName, 16, &dwHotKeyId);
335
336 uModifiers = CliReadRegistryValue(hSubKey, L"Key Modifiers");
337 hKL = (HKL)(ULONG_PTR)CliReadRegistryValue(hSubKey, L"Target IME");
338 uVirtualKey = CliReadRegistryValue(hSubKey, L"Virtual Key");
339
340 RegCloseKey(hSubKey);
341
342 return CliImmSetHotKeyWorker(dwHotKeyId, uModifiers, uVirtualKey, hKL, SETIMEHOTKEY_ADD);
343}
344
346{
347 HKEY hKey;
348 LONG error;
349 BOOL ret = FALSE;
350 DWORD dwIndex, cchKeyName;
351 WCHAR szKeyName[16];
352
354 L"Control Panel\\Input Method\\Hot Keys",
355 0,
356 KEY_READ,
357 &hKey);
358 if (error != ERROR_SUCCESS)
359 return ret;
360
361 for (dwIndex = 0; dwIndex < 1000; ++dwIndex)
362 {
363 cchKeyName = _countof(szKeyName);
364 error = RegEnumKeyExW(hKey, dwIndex, szKeyName, &cchKeyName, NULL, NULL, NULL, NULL);
365 if (error != ERROR_SUCCESS)
366 break;
367
368 szKeyName[_countof(szKeyName) - 1] = 0; /* Avoid stack overrun */
369
370 if (CliSetSingleHotKey(szKeyName, hKey))
371 ret = TRUE;
372 }
373
375 return ret;
376}
377
379{
380 WCHAR szValueName[33], szValue[16];
381 UNICODE_STRING ustrValue;
382 DWORD dwKL, cbValue, dwType;
383 UINT iNumber;
384 HKEY hKey;
385 LONG error;
386
387 error = RegOpenKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Preload", 0, KEY_READ, &hKey);
388 if (error != ERROR_SUCCESS)
389 return;
390
391 for (iNumber = 1; iNumber < 1000; ++iNumber)
392 {
393 _ultow(iNumber, szValueName, 10);
394
395 cbValue = sizeof(szValue);
396 error = RegQueryValueExW(hKey, szValueName, NULL, &dwType, (LPBYTE)szValue, &cbValue);
397 if (error != ERROR_SUCCESS)
398 break;
399
400 if (dwType != REG_SZ)
401 continue;
402
403 szValue[_countof(szValue) - 1] = 0; /* Avoid stack overrun */
404
405 RtlInitUnicodeString(&ustrValue, szValue);
406 RtlUnicodeStringToInteger(&ustrValue, 16, &dwKL);
407
408 IntSetFeKeyboardFlags(LOWORD(dwKL), pbFlags);
409 }
410
412}
413
415{
416 UINT uVirtualKey, uModifiers;
417 HKL hKL;
418
419 while (nCount-- > 0)
420 {
421 if (!bCheck || !NtUserGetImeHotKey(pEntries->dwHotKeyId, &uModifiers, &uVirtualKey, &hKL))
422 {
424 pEntries->uModifiers,
425 pEntries->uVirtualKey,
426 pEntries->hKL,
428 }
429 ++pEntries;
430 }
431}
432
434{
435 UINT nCount;
436 LPHKL pList;
437 UINT iIndex;
439 BYTE bFlags = 0;
440 BOOL bCheck;
441
443
445
446 if (dwAction == SETIMEHOTKEY_INITIALIZE)
447 {
450
452 }
453 else
454 {
456 if (!nCount)
457 return;
458
459 pList = RtlAllocateHeap(RtlGetProcessHeap(), 0, nCount * sizeof(HKL));
460 if (!pList)
461 return;
462
464
465 for (iIndex = 0; iIndex < nCount; ++iIndex)
466 {
467 LangID = LOWORD(pList[iIndex]);
469 }
470
471 RtlFreeHeap(RtlGetProcessHeap(), 0, pList);
472 }
473
474 if (bFlags & FE_JAPANESE)
476
477 if (bFlags & FE_CHINESE_TRADITIONAL)
479
480 if (bFlags & FE_CHINESE_SIMPLIFIED)
482}
483
484/*
485 * @implemented
486 */
487BOOL
488WINAPI
490 HWND hWnd,
491 POINT pt)
492{
493 return NtUserDragDetect(hWnd, pt);
494#if 0
495 MSG msg;
496 RECT rect;
497 POINT tmp;
500
501 rect.left = pt.x - dx;
502 rect.right = pt.x + dx;
503 rect.top = pt.y - dy;
504 rect.bottom = pt.y + dy;
505
507
508 for (;;)
509 {
510 while (
513 )
514 {
515 if (msg.message == WM_LBUTTONUP)
516 {
518 return FALSE;
519 }
520 if (msg.message == WM_MOUSEMOVE)
521 {
522 tmp.x = LOWORD(msg.lParam);
523 tmp.y = HIWORD(msg.lParam);
524 if (!PtInRect(&rect, tmp))
525 {
527 return TRUE;
528 }
529 }
530 if (msg.message == WM_KEYDOWN)
531 {
532 if (msg.wParam == VK_ESCAPE)
533 {
535 return TRUE;
536 }
537 }
538 }
539 WaitMessage();
540 }
541 return 0;
542#endif
543}
544
545/*
546 * @implemented
547 */
550{
552}
553
554/*
555 * @implemented
556 */
557SHORT
558WINAPI
561{
562 if (vKey < 0 || vKey > 256)
563 return 0;
564 return (SHORT)NtUserGetAsyncKeyState((DWORD)vKey);
565}
566
567
568/*
569 * @implemented
570 */
573{
574 return NtUserxGetKeyboardLayout(idThread);
575}
576
577
578/*
579 * @implemented
580 */
583{
584 return GetOEMCP();
585}
586
587
588/*
589 * @implemented
590 */
591int WINAPI
593 LPSTR lpString,
594 int nSize)
595{
596 LPWSTR pwszBuf;
597 UINT cchBuf = 0;
598 int iRet = 0;
599 BOOL defChar = FALSE;
600
601 pwszBuf = HeapAlloc(GetProcessHeap(), 0, nSize * sizeof(WCHAR));
602 if (!pwszBuf)
603 return 0;
604
606
607 iRet = WideCharToMultiByte(CP_ACP, 0,
608 pwszBuf, cchBuf,
609 lpString, nSize, ".", &defChar); // FIXME: do we need defChar?
610 lpString[iRet] = 0;
611 HeapFree(GetProcessHeap(), 0, pwszBuf);
612
613 return iRet;
614}
615
616/*
617 * @implemented
618 */
619int WINAPI
621 LPWSTR lpString,
622 int nSize)
623{
624 return NtUserGetKeyNameText(lParam, lpString, nSize);
625}
626
627/*
628 * @implemented
629 */
630SHORT
631WINAPI
633GetKeyState(int nVirtKey)
634{
635 return (SHORT)NtUserGetKeyState((DWORD)nVirtKey);
636}
637
638/*
639 * @implemented
640 */
643{
645
647 return FALSE;
648
649 if (!WideCharToMultiByte(CP_ACP, 0, buf, -1, pwszKLID, KL_NAMELENGTH, NULL, NULL))
650 return FALSE;
651
652 return TRUE;
653}
654
655/*
656 * @implemented
657 */
660{
662
664 pwszKLID,
665 KL_NAMELENGTH * sizeof(WCHAR));
666
668}
669
670/*
671 * @implemented
672 */
673int WINAPI
674GetKeyboardType(int nTypeFlag)
675{
676 return NtUserxGetKeyboardType(nTypeFlag);
677}
678
679/*
680 * @implemented
681 */
684{
685 TRACE("%p\n", plii);
686
687 if (plii->cbSize != sizeof (*plii))
688 {
690 return FALSE;
691 }
692
693 plii->dwTime = gpsi->dwLastRITEventTickCount;
694 return TRUE;
695}
696
697/*
698 * @implemented
699 */
702 UINT Flags)
703{
704 WCHAR wszKLID[16];
705
706 if (!MultiByteToWideChar(CP_ACP, 0, pszKLID, -1,
707 wszKLID, sizeof(wszKLID)/sizeof(wszKLID[0])))
708 {
709 return FALSE;
710 }
711
712 return LoadKeyboardLayoutW(wszKLID, Flags);
713}
714
715static inline BOOL IsValidKLID(_In_ LPCWSTR pwszKLID)
716{
717 return pwszKLID && (wcsspn(pwszKLID, L"0123456789ABCDEFabcdef") == (KL_NAMELENGTH - 1));
718}
719
721{
722 if (!*pszFileName)
723 return FALSE;
724 SIZE_T cch = wcscspn(pszFileName, L"\\/:");
725 return (cch < MAX_LAYOUT_FILENAME && !pszFileName[cch]);
726}
727
729{
730 WCHAR szSysDir[MAX_PATH];
731 UINT cch = GetSystemDirectoryW(szSysDir, _countof(szSysDir));
732 if (!cch || cch >= _countof(szSysDir))
733 return FALSE;
734 return SUCCEEDED(StringCchPrintfW(pszPath, cchPath, L"%s\\%s", szSysDir, pszFileName));
735}
736
738{
741 return NULL;
742 return LoadLibraryW(szPath);
743}
744
750static VOID
753{
754 UINT iTable;
755
756 if (!pMulti)
757 return;
758
759 for (iTable = 0; iTable < pMulti->Multi.nTables && iTable < KBDTABLE_MULTI_MAX; ++iTable)
760 {
761 HANDLE hAuxFile = pMulti->AuxEntries[iTable].hFile;
762 if (hAuxFile)
763 CloseHandle(hAuxFile);
764 pMulti->AuxEntries[iTable].hFile = NULL;
765 }
766
767 pMulti->Multi.nTables = 0;
768}
769
770static HANDLE
772 _In_ PCWSTR pszLayoutFile,
773 _In_opt_ PCWSTR pszKLID,
774 _Inout_ PUINT puFlags,
775 _Out_ PULONG poffTable,
777
783static VOID
786 _Inout_ PUINT puFlags,
788{
790 UINT iTable;
791
793 if (!pfnMulti || !pfnMulti(&pMulti->Multi))
794 return;
795
796 if (pMulti->Multi.nTables > KBDTABLE_MULTI_MAX)
797 pMulti->Multi.nTables = 0;
798
799 for (iTable = 0; iTable < pMulti->Multi.nTables; iTable++)
800 {
801 PKBDTABLE_DESC pDesc = &pMulti->Multi.aKbdTables[iTable];
802 ULONG offTable = 0;
803 HANDLE hAuxFile;
804
805 /* Avoid buffer overrun */
806 pDesc->wszDllName[_countof(pDesc->wszDllName) - 1] = UNICODE_NULL;
807
809 puFlags, &offTable, NULL);
810 pMulti->AuxEntries[iTable].hFile = hAuxFile; /* NULL if failed */
811 if (hAuxFile)
812 pMulti->AuxEntries[iTable].offTable = offTable;
813 }
814}
815
821static VOID
823 _Inout_ HMODULE *phModule,
824 _Outptr_ PCWSTR *ppszFile,
826 _In_opt_ PCWSTR pszKLID)
827{
830 HMODULE hRealModule;
831 ULONG ulKLID;
832 WCHAR szReturned[MAX_PATH];
833
836 if (!pfnReal && !pfnRealNT4)
837 return;
838
839 ulKLID = pszKLID ? wcstoul(pszKLID, NULL, 16) : 0;
840 pszRealFile[0] = UNICODE_NULL;
841 szReturned[0] = UNICODE_NULL;
842
843 /* FIXME: Specify PCLIENTKEYBOARDTYPE parameter for pfnReal */
844 /* FIXME: Implement ntuser's UserInitKeyboard and use GetKeyboardType */
845 if (!(pfnReal && pfnReal(ulKLID, szReturned, NULL, NULL)) &&
846 !(pfnRealNT4 && pfnRealNT4(szReturned)))
847 {
848 return;
849 }
850 szReturned[MAX_PATH - 1] = UNICODE_NULL; /* Avoid buffer overrun */
851
852 if (!IntIsValidLayoutFileName(szReturned) ||
853 FAILED(StringCchCopyW(pszRealFile, MAX_LAYOUT_FILENAME, szReturned)))
854 {
855 WARN("Invalid real DLL name: %s\n", debugstr_w(szReturned));
856 return;
857 }
858
859 hRealModule = LoadSysLibraryW(pszRealFile);
860 if (!hRealModule)
861 {
862 WARN("LoadSysLibraryW(%s) failed\n", debugstr_w(pszRealFile));
863 return;
864 }
865
866 FreeLibrary(*phModule);
867 *phModule = hRealModule;
868 *ppszFile = pszRealFile;
869}
870
879 _Inout_ HMODULE *phModule,
880 _In_ _Outptr_ PCWSTR *ppszFile,
882 _In_opt_ PCWSTR pszKLID,
883 _Inout_ PUINT puFlags,
885{
887
889 {
890 if (_wcsicmp(*ppszFile, L"kbdus.dll") != 0) /* Not English US? */
891 {
892 if (pMulti && IntIsConsoleSession())
893 IntLoadMultiTables(*phModule, puFlags, pMulti);
894
895 IntFollowRealDll(phModule, ppszFile, pszRealFile, pszKLID);
896 }
897
898 /* Retrieve the KbdLayerDescriptor procedure */
900 }
902 {
903 ERR("Exception caught! Status: 0x%lx\n", _SEH2_GetExceptionCode());
904 }
905 _SEH2_END;
906
907 return pfnMain;
908}
909
915static BOOL
919 _Out_ PULONG poffTable)
920{
922 INT_PTR MainOffset, NlsOffset = 0;
923
925 {
926 /* Get the main table offset */
927 MainOffset = (PBYTE)pfnMain() - (PBYTE)hModule;
928 if (MainOffset <= 0 || MainOffset > MAXWORD)
929 {
930 ERR("Invalid MainOffset: %p\n", (PVOID)MainOffset);
931 _SEH2_YIELD(return FALSE);
932 }
933
934 /* Get the NLS table offset */
936 if (pfnNls)
937 {
938 NlsOffset = (PBYTE)pfnNls() - (PBYTE)hModule;
939 if (NlsOffset <= 0 || NlsOffset > MAXWORD)
940 {
941 ERR("Invalid NlsOffset: %p\n", (PVOID)NlsOffset);
942 _SEH2_YIELD(return FALSE);
943 }
944 }
945
946 *poffTable = MAKELONG(MainOffset, NlsOffset);
947 _SEH2_YIELD(return TRUE);
948 }
950 {
951 ERR("Exception caught! Status: 0x%x\n", _SEH2_GetExceptionCode());
952 }
953 _SEH2_END;
954
955 return FALSE;
956}
957
963static HANDLE
965 _In_ PCWSTR pszLayoutFile,
966 _In_opt_ PCWSTR pszKLID,
967 _Inout_ PUINT puFlags,
968 _Out_ PULONG poffTable,
970{
972 PCWSTR pszCurrentFile;
974 WCHAR szRealFile[MAX_LAYOUT_FILENAME], szFull[MAX_PATH];
975 DWORD cchFull;
977
978 TRACE("Loading layout file %s\n", debugstr_w(pszLayoutFile));
979 if (!IntIsValidLayoutFileName(pszLayoutFile))
980 {
981 ERR("Invalid layout filename: %s\n", debugstr_w(pszLayoutFile));
982 return NULL;
983 }
984
985 for (;;)
986 {
987 pszCurrentFile = pszLayoutFile;
988
989 /* Load the layout file */
990 hModule = LoadSysLibraryW(pszLayoutFile);
991 if (!hModule)
992 {
993 ERR("LoadSysLibraryW(%s) failed\n", debugstr_w(pszLayoutFile));
994 return NULL;
995 }
996
997 pfnMain = IntPrepareLayoutModule(&hModule, &pszCurrentFile, szRealFile,
998 pszKLID, puFlags, pMulti);
999 if (pfnMain)
1000 break; /* Success */
1001
1002 /* Otherwise, it's a failure. We leave this module either way (pszCurrentFile
1003 * does not point into it), so release it here; a retry loads a fresh one. */
1005 IntCloseAuxFiles(pMulti);
1006
1007 if ((*puFlags & KLF_INITTIME) && _wcsicmp(pszCurrentFile, L"kbdus.dll") != 0)
1008 {
1009 pszLayoutFile = L"kbdus.dll";
1010 continue; /* Retry with "kbdus.dll" */
1011 }
1012
1013 ERR("Invalid layout file: %s\n", debugstr_w(pszLayoutFile));
1014 return NULL; /* Failure */
1015 }
1016
1017 /* From here on, every failure goes to Failure */
1018 if (!IntGetTableOffsets(hModule, pfnMain, poffTable))
1019 goto Failure;
1020
1021 if (pMulti)
1022 StringCbCopyW(pMulti->szRealDllName, sizeof(pMulti->szRealDllName), pszCurrentFile);
1023
1024 TRACE("FileName:%s, *poffTable:0x%08X\n", debugstr_w(pszCurrentFile), *poffTable);
1025
1026 /* Get the full pathname of hModule */
1027 cchFull = GetModuleFileNameW(hModule, szFull, _countof(szFull));
1028 if (!cchFull || cchFull >= _countof(szFull))
1029 {
1030 ERR("GetModuleFileNameW failed\n");
1031 goto Failure;
1032 }
1033
1035 hModule = NULL;
1036
1039 return hFile; /* Success */
1040
1041 ERR("CreateFileW failed: %s\n", debugstr_w(szFull));
1042
1043Failure:
1044 if (hModule)
1046 IntCloseAuxFiles(pMulti);
1047 return NULL;
1048}
1049
1050static BOOL
1052 _Out_writes_z_(cchDllName) PWSTR pszDllName,
1053 _In_ SIZE_T cchDllName,
1054 _Inout_updates_z_(cchKLID) PWSTR pszKLID,
1055 _In_ SIZE_T cchKLID,
1056 _In_ LANGID wLangID,
1057 _Inout_ PUINT puFlags,
1058 _Out_ PULONG pdwKL)
1059{
1060 HKEY hKey;
1061 DWORD error, cbData, dwType, dwAttributes, dwKL;
1062 PCWSTR pszSource = NULL;
1063 WCHAR szKLID[KL_NAMELENGTH], szKeyPath[MAX_PATH], szSubstitute[KL_NAMELENGTH];
1064 WCHAR szLayoutFile[MAX_PATH], szLayoutId[16];
1065 HRESULT hr;
1066
1067 if (FAILED(StringCbCopyW(szKLID, sizeof(szKLID), pszKLID)) || !IsValidKLID(szKLID))
1068 return FALSE;
1069
1070 if (!wLangID)
1071 wLangID = (LANGID)wcstoul(pszKLID, NULL, 16);
1072
1073 /* Substitute pszKLID */
1074 if (*puFlags & KLF_SUBSTITUTE_OK)
1075 {
1076#if 1
1077 if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Substitutes", 0,
1079 {
1080 ZeroMemory(szSubstitute, sizeof(szSubstitute));
1081 cbData = sizeof(szSubstitute);
1082 error = RegQueryValueExW(hKey, pszKLID, NULL, &dwType,
1083 (PBYTE)szSubstitute, &cbData);
1085 if (error == ERROR_SUCCESS && dwType == REG_SZ)
1086 {
1087 szSubstitute[_countof(szSubstitute) - 1] = UNICODE_NULL; /* Avoid buffer overrun */
1088 if (!IsValidKLID(szSubstitute) ||
1089 FAILED(StringCchCopyW(pszKLID, cchKLID, szSubstitute)))
1090 {
1091 ERR("IsValidKLID(%s) failed\n", debugstr_w(szSubstitute));
1092 return FALSE;
1093 }
1094 }
1095 }
1096#else
1097 /* FIXME: Prepare keyboardlayout.ini and redirection */
1098 GetPrivateProfileStringW(L"Substitutes", pszKLID, pszKLID,
1099 szSubstitute, (DWORD)_countof(szSubstitute),
1100 L"keyboardlayout.ini");
1101 szSubstitute[_countof(szSubstitute) - 1] = UNICODE_NULL; /* Avoid buffer overrun */
1102 if (!IsValidKLID(szSubstitute) || FAILED(StringCchCopyW(pszKLID, cchKLID, szSubstitute)))
1103 return FALSE;
1104#endif
1105 }
1106
1107 /* Open 'Keyboard Layouts' registry key */
1108 dwKL = wcstoul(pszKLID, NULL, 16);
1109 hr = StringCbPrintfW(szKeyPath, sizeof(szKeyPath), KBDLAYOUTS_KEY L"\\%s", pszKLID);
1110 if (FAILED(hr))
1111 return FALSE;
1112
1114 if (error == ERROR_SUCCESS)
1115 {
1116 /* "Layout File" */
1117 cbData = sizeof(szLayoutFile);
1118 error = RegQueryValueExW(hKey, L"Layout File", NULL, &dwType, (PBYTE)szLayoutFile, &cbData);
1119 if (error == ERROR_SUCCESS && dwType == REG_SZ)
1120 {
1121 szLayoutFile[_countof(szLayoutFile) - 1] = UNICODE_NULL;
1122 pszSource = szLayoutFile;
1123 }
1124
1125 /* "Attributes" */
1126 cbData = sizeof(dwAttributes);
1127 error = RegQueryValueExW(hKey, L"Attributes", NULL, &dwType, (PBYTE)&dwAttributes, &cbData);
1128 if (error == ERROR_SUCCESS && dwType == REG_DWORD && cbData == sizeof(dwAttributes))
1129 *puFlags |= (dwAttributes & ATTR_MASK);
1130
1131 if (IS_IME_HKL(UlongToHandle(dwKL))) /* IME? */
1132 {
1133 dwKL = HIWORD(dwKL);
1134 }
1135 else if (HIWORD(dwKL))
1136 {
1137 /* "Layout ID" */
1138 cbData = sizeof(szLayoutId);
1139 error = RegQueryValueExW(hKey, L"Layout ID", NULL, &dwType, (PBYTE)szLayoutId, &cbData);
1140 if (error == ERROR_SUCCESS && dwType == REG_SZ)
1141 {
1142 szLayoutId[_countof(szLayoutId) - 1] = UNICODE_NULL; /* Avoid buffer overrun */
1143 dwKL = (wcstoul(szLayoutId, NULL, 16) & 0xFFF) | 0xF000;
1144 }
1145 else
1146 {
1147 dwKL = 0xFFFE; /* Invalid value */
1148 }
1149 }
1150
1152 }
1153 else
1154 {
1155 WARN("pszKLID %s not found!\n", debugstr_w(pszKLID));
1156
1157 /* Fallback to 'Keyboard Layout' */
1159 if (error == ERROR_SUCCESS)
1160 {
1161 cbData = sizeof(szLayoutFile);
1162 error = RegQueryValueExW(hKey, pszKLID, NULL, &dwType, (PBYTE)szLayoutFile, &cbData);
1163 if (error == ERROR_SUCCESS && dwType == REG_SZ)
1164 {
1165 szLayoutFile[_countof(szLayoutFile) - 1] = UNICODE_NULL; /* Avoid buffer overrun */
1166 pszSource = szLayoutFile;
1167 }
1169 }
1170 }
1171
1172 *pdwKL = MAKELONG(wLangID, (WORD)dwKL);
1173
1174 if (!pszSource) /* Layout not found in registry? */
1175 {
1176 WARN("Layout %s not found in registry\n", debugstr_w(pszKLID));
1177
1179 {
1180 pszSource = L"kbdus.dll";
1182 }
1183 else if (PRIMARYLANGID(wLangID) == LANG_JAPANESE)
1184 {
1185 pszSource = L"kbdjpn.dll";
1187 }
1188 else if (PRIMARYLANGID(wLangID) == LANG_KOREAN)
1189 {
1190 pszSource = L"kbdkor.dll";
1192 }
1193 else
1194 {
1195 pszSource = L"kbdus.dll";
1196 *pdwKL = MAKELONG(wLangID, wLangID);
1197 }
1198 }
1199
1200 return IntIsValidLayoutFileName(pszSource) &&
1201 SUCCEEDED(StringCchCopyW(pszDllName, cchDllName, pszSource));
1202}
1203
1207static HANDLE
1209 _Inout_updates_z_(cchKLID) PWSTR pszKLID,
1210 _In_ SIZE_T cchKLID,
1211 _In_ DWORD wLangID,
1212 _Inout_ PUINT pFlags,
1213 _Out_ PULONG pOffTable,
1214 _Out_ PULONG pdwNewKL,
1216{
1218
1219 if (pMulti)
1220 ZeroMemory(pMulti, sizeof(*pMulti));
1221
1223 cchKLID, wLangID, pFlags, pdwNewKL))
1224 {
1225 ERR("Failed in IntGetKeyboardDllName\n");
1226 return NULL;
1227 }
1228
1229 return IntLoadKeyboardLayoutTablesAndFile(szDllName, pszKLID, pFlags, pOffTable, pMulti);
1230}
1231
1232/*
1233 * @implemented
1234 */
1235static HKL
1237 _In_opt_ HKL hklUnload,
1238 _In_ PCWSTR pwszKLID,
1239 _In_ LANGID wLangID,
1240 _In_ UINT Flags,
1241 _In_ BOOL bForce)
1242{
1243 HANDLE hFile;
1244 WCHAR szKLID[KL_NAMELENGTH];
1245 KBDTABLE_MULTI_EX multi;
1246 DWORD offTable = 0, dwNewKL = 0, iTable;
1247 HKL hNewKL = NULL;
1248 UNICODE_STRING ustrKLID;
1249
1250 if (FAILED(StringCbCopyW(szKLID, sizeof(szKLID), pwszKLID)))
1251 return NULL;
1252
1253 /* Load keyboard layout file(s) */
1254 hFile = IntLoadKeyboardLayoutFile(szKLID, _countof(szKLID), wLangID,
1255 &Flags, &offTable, &dwNewKL, &multi);
1256 if (!hFile)
1257 {
1258 if (!bForce && !(Flags & KLF_FORCE))
1259 {
1260 ERR("Failed to IntLoadKeyboardLayoutFile\n");
1261 return NULL; /* Failure */
1262 }
1263
1264 /* Fallback to English */
1265 Flags &= ~KLF_SUBSTITUTE_OK;
1266 multi.Multi.nTables = 0;
1267 if (wcscmp(szKLID, L"00000409") != 0) /* Not English? Then retry with English */
1268 {
1269 StringCbCopyW(szKLID, sizeof(szKLID), L"00000409");
1270 hFile = IntLoadKeyboardLayoutFile(szKLID, _countof(szKLID), wLangID,
1271 &Flags, &offTable, &dwNewKL, NULL);
1272 }
1273 }
1274
1275 RtlInitUnicodeString(&ustrKLID, szKLID);
1276 hNewKL = NtUserLoadKeyboardLayoutEx(hFile, offTable, &multi, hklUnload,
1277 &ustrKLID, dwNewKL, Flags);
1278
1279 /* Close file handles, we own them: win32k duplicated them for its own purposes */
1280 if (hFile)
1282 for (iTable = 0; iTable < multi.Multi.nTables && iTable < KBDTABLE_MULTI_MAX; ++iTable)
1283 {
1284 HANDLE hAuxFile = multi.AuxEntries[iTable].hFile;
1285 if (hAuxFile)
1286 CloseHandle(hAuxFile);
1287 }
1288
1289 if (hNewKL)
1290 {
1291 /* Initialize the IME hot keys */
1293 }
1294
1295 return hNewKL;
1296}
1297
1298/*
1299 * @implemented
1300 */
1301HKL WINAPI
1303 UINT Flags)
1304{
1305 TRACE("(%s, 0x%X)\n", debugstr_w(pwszKLID), Flags);
1306 return IntLoadKeyboardLayout(NULL, pwszKLID, 0, Flags, FALSE);
1307}
1308
1309/*
1310 * @implemented
1311 */
1312HKL WINAPI
1314 _In_ HKL hklUnload,
1315 _In_ PCWSTR pwszKLID,
1316 _In_ UINT Flags)
1317{
1318 TRACE("(%p, %s, 0x%X)", hklUnload, debugstr_w(pwszKLID), Flags);
1319
1320 if (!hklUnload)
1321 {
1322 ERR("hklUnload was NULL\n");
1323 return NULL;
1324 }
1325
1326 return IntLoadKeyboardLayout(hklUnload, pwszKLID, 0, Flags, FALSE);
1327}
1328
1329/*
1330 * @implemented
1331 */
1333{
1335 return FALSE;
1336
1338 return TRUE;
1339}
1340
1341/*
1342 * @implemented
1343 */
1346 UINT uMapType)
1347{
1348 return MapVirtualKeyExA(uCode, uMapType, GetKeyboardLayout(0));
1349}
1350
1351/*
1352 * @implemented
1353 */
1356 UINT uMapType,
1357 HKL dwhkl)
1358{
1359 return MapVirtualKeyExW(uCode, uMapType, dwhkl);
1360}
1361
1362
1363/*
1364 * @implemented
1365 */
1368 UINT uMapType,
1369 HKL dwhkl)
1370{
1371 return NtUserMapVirtualKeyEx(uCode, uMapType, 0, dwhkl);
1372}
1373
1374
1375/*
1376 * @implemented
1377 */
1380 UINT uMapType)
1381{
1382 return MapVirtualKeyExW(uCode, uMapType, GetKeyboardLayout(0));
1383}
1384
1385
1386/*
1387 * @implemented
1388 */
1391{
1392 WCHAR p;
1393 SHORT Vk;
1394 UINT Scan;
1395
1396 MultiByteToWideChar(CP_OEMCP, 0, (PCSTR)&wOemChar, 1, &p, 1);
1397 Vk = VkKeyScanW(p);
1398 Scan = MapVirtualKeyW((Vk & 0x00ff), 0);
1399 if (!Scan) return -1;
1400 /*
1401 Page 450-1, MS W2k SuperBible by SAMS. Return, low word has the
1402 scan code and high word has the shift state.
1403 */
1404 return ((Vk & 0xff00) << 8) | Scan;
1405}
1406
1407
1408/*
1409 * @implemented
1410 */
1413{
1415 uInterval,
1416 NULL,
1417 0);
1418}
1419
1420
1421/*
1422 * @implemented
1423 */
1424BOOL
1425WINAPI
1427 BOOL fSwap)
1428{
1429 return NtUserxSwapMouseButton(fSwap);
1430}
1431
1432
1433/*
1434 * @implemented
1435 */
1436int WINAPI
1437ToAscii(UINT uVirtKey,
1438 UINT uScanCode,
1439 CONST BYTE *lpKeyState,
1440 LPWORD lpChar,
1441 UINT uFlags)
1442{
1443 return ToAsciiEx(uVirtKey, uScanCode, lpKeyState, lpChar, uFlags, 0);
1444}
1445
1446
1447/*
1448 * @implemented
1449 */
1450int WINAPI
1452 UINT uScanCode,
1453 CONST BYTE *lpKeyState,
1454 LPWORD lpChar,
1455 UINT uFlags,
1456 HKL dwhkl)
1457{
1458 WCHAR UniChars[2];
1459 int Ret, CharCount;
1460
1461 Ret = ToUnicodeEx(uVirtKey, uScanCode, lpKeyState, UniChars, 2, uFlags, dwhkl);
1462 CharCount = (Ret < 0 ? 1 : Ret);
1463 WideCharToMultiByte(CP_ACP, 0, UniChars, CharCount, (LPSTR)lpChar, 2, NULL, NULL);
1464
1465 return Ret;
1466}
1467
1468
1469/*
1470 * @implemented
1471 */
1472int WINAPI
1474 UINT wScanCode,
1475 CONST BYTE *lpKeyState,
1476 LPWSTR pwszBuff,
1477 int cchBuff,
1478 UINT wFlags)
1479{
1480 return ToUnicodeEx(wVirtKey, wScanCode, lpKeyState, pwszBuff, cchBuff,
1481 wFlags, 0);
1482}
1483
1484
1485/*
1486 * @implemented
1487 */
1488int WINAPI
1490 UINT wScanCode,
1491 CONST BYTE *lpKeyState,
1492 LPWSTR pwszBuff,
1493 int cchBuff,
1494 UINT wFlags,
1495 HKL dwhkl)
1496{
1497 return NtUserToUnicodeEx(wVirtKey, wScanCode, (PBYTE)lpKeyState, pwszBuff, cchBuff,
1498 wFlags, dwhkl);
1499}
1500
1501
1502
1503/*
1504 * @implemented
1505 */
1508{
1509 WCHAR wChar;
1510
1511 if (IsDBCSLeadByte(ch))
1512 return -1;
1513
1514 MultiByteToWideChar(CP_ACP, 0, &ch, 1, &wChar, 1);
1515 return VkKeyScanW(wChar);
1516}
1517
1518
1519/*
1520 * @implemented
1521 */
1524 HKL dwhkl)
1525{
1526 WCHAR wChar;
1527
1528 if (IsDBCSLeadByte(ch))
1529 return -1;
1530
1531 MultiByteToWideChar(CP_ACP, 0, &ch, 1, &wChar, 1);
1532 return VkKeyScanExW(wChar, dwhkl);
1533}
1534
1535
1536/*
1537 * @implemented
1538 */
1541 HKL dwhkl)
1542{
1543 return (SHORT)NtUserVkKeyScanEx(ch, dwhkl, TRUE);
1544}
1545
1546
1547/*
1548 * @implemented
1549 */
1552{
1553 return (SHORT)NtUserVkKeyScanEx(ch, 0, FALSE);
1554}
1555
1556
1557/*
1558 * @implemented
1559 */
1560VOID
1561WINAPI
1563 BYTE bVk,
1564 BYTE bScan,
1565 DWORD dwFlags,
1566 ULONG_PTR dwExtraInfo)
1567{
1568 INPUT Input;
1569
1570 Input.type = INPUT_KEYBOARD;
1571 Input.ki.wVk = bVk;
1572 Input.ki.wScan = bScan;
1573 Input.ki.dwFlags = dwFlags;
1574 Input.ki.time = 0;
1575 Input.ki.dwExtraInfo = dwExtraInfo;
1576
1577 NtUserSendInput(1, &Input, sizeof(INPUT));
1578}
1579
1580
1581/*
1582 * @implemented
1583 */
1584VOID
1585WINAPI
1587 DWORD dwFlags,
1588 DWORD dx,
1589 DWORD dy,
1590 DWORD dwData,
1591 ULONG_PTR dwExtraInfo)
1592{
1593 INPUT Input;
1594
1595 Input.type = INPUT_MOUSE;
1596 Input.mi.dx = dx;
1597 Input.mi.dy = dy;
1598 Input.mi.mouseData = dwData;
1599 Input.mi.dwFlags = dwFlags;
1600 Input.mi.time = 0;
1601 Input.mi.dwExtraInfo = dwExtraInfo;
1602
1603 NtUserSendInput(1, &Input, sizeof(INPUT));
1604}
1605
1606/* EOF */
#define DECLSPEC_HOTPATCH
Definition: _mingw.h:240
#define REG_SZ
Definition: layer.c:22
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define UlongToHandle(ul)
Definition: basetsd.h:91
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
#define RegCloseKey(hKey)
Definition: registry.h:49
RtlInitEmptyUnicodeString(SymbolicLinkName, NULL, 0)
#define LANGID_KOREAN
Definition: cjkcode.h:53
#define LANGID_JAPANESE
Definition: cjkcode.h:52
RECT rect
Definition: combotst.c:67
LPARAM lParam
Definition: combotst.c:139
HRESULT hr
Definition: delayimp.cpp:582
#define ERROR_SUCCESS
Definition: deptool.c:10
LPWSTR Name
Definition: desk.c:124
_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ ULONG _In_ ULONG Flags
Definition: dispmprt.h:245
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define APIENTRY
Definition: api.h:79
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 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
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
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
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
UINT uFlags
Definition: api.c:59
HMODULE hModule
Definition: animate.c:44
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define SetLastError(x)
Definition: compat.h:752
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define FreeLibrary(x)
Definition: compat.h:748
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CreateFileW
Definition: compat.h:741
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define LoadLibraryW(x)
Definition: compat.h:747
#define FILE_SHARE_READ
Definition: compat.h:136
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2331
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
Definition: profile.c:1142
BOOL WINAPI IsDBCSLeadByte(BYTE testchar)
Definition: locale.c:2126
LCID WINAPI GetUserDefaultLCID(void)
Definition: locale.c:1216
UINT WINAPI GetOEMCP(void)
Definition: locale.c:2062
unsigned char ch[4][2]
Definition: console.c:118
_ACRTIMP __msvcrt_ulong __cdecl wcstoul(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2917
_ACRTIMP wchar_t *__cdecl _ultow(__msvcrt_ulong, wchar_t *, int)
Definition: string.c:2204
_ACRTIMP size_t __cdecl wcsspn(const wchar_t *, const wchar_t *)
Definition: wcs.c:513
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:164
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
_ACRTIMP size_t __cdecl wcscspn(const wchar_t *, const wchar_t *)
Definition: wcs.c:503
static const WCHAR szDllName[]
Definition: system.c:43
#define pt(x, y)
Definition: drawing.c:79
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxChildList * pList
FxAutoRegKey hKey
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLfloat GLfloat p
Definition: glext.h:8902
unsigned int UINT
Definition: sysinfo.c:13
PSERVERINFO gpsi
Definition: imm.c:18
#define IS_IME_HKL(hKL)
Definition: imm32_undoc.h:21
HKL FAR * LPHKL
Definition: imm.h:24
#define MOD_LEFT
Definition: imm.h:188
#define IME_JHOTKEY_CLOSE_OPEN
Definition: imm.h:200
#define IME_THOTKEY_IME_NONIME_TOGGLE
Definition: imm.h:207
#define MOD_IGNORE_ALL_MODIFIER
Definition: imm.h:192
#define IME_CHOTKEY_IME_NONIME_TOGGLE
Definition: imm.h:195
#define MOD_SHIFT
Definition: imm.h:186
#define IME_KHOTKEY_SHAPE_TOGGLE
Definition: imm.h:203
#define MOD_CONTROL
Definition: imm.h:185
#define IME_HOTKEY_DSWITCH_LAST
Definition: imm.h:213
#define IME_THOTKEY_SHAPE_TOGGLE
Definition: imm.h:208
#define IME_HOTKEY_DSWITCH_FIRST
Definition: imm.h:212
#define MOD_RIGHT
Definition: imm.h:189
#define IME_CHOTKEY_SHAPE_TOGGLE
Definition: imm.h:196
SHORT NTAPI NtUserGetAsyncKeyState(INT Key)
Definition: keyboard.c:675
BOOL NTAPI NtUserUnloadKeyboardLayout(HKL hKl)
Definition: kbdlayout.c:2255
DWORD NTAPI NtUserVkKeyScanEx(WCHAR wChar, HKL KeyboardLayout, BOOL bUsehHK)
Definition: keyboard.c:2021
UINT NTAPI NtUserGetKeyboardLayoutList(ULONG nItems, HKL *pHklBuff)
Definition: kbdlayout.c:2010
BOOL NTAPI NtUserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2208
HKL NTAPI NtUserLoadKeyboardLayoutEx(_In_ HANDLE hFile, _In_ ULONG offTable, _In_opt_ PKBDTABLE_MULTI_EX pMulti, _In_opt_ HKL hOldKL, _In_ PUNICODE_STRING puszKLID, _In_ ULONG dwNewKL, _In_ UINT Flags)
Definition: kbdlayout.c:2129
DWORD NTAPI NtUserGetKeyNameText(LONG lParam, LPWSTR lpString, int nSize)
Definition: keyboard.c:1896
BOOL NTAPI NtUserSetImeHotKey(_In_ DWORD dwHotKeyId, _In_ UINT uModifiers, _In_ UINT uVirtualKey, _In_opt_ HKL hKL, _In_ DWORD dwAction)
Definition: ime.c:478
UINT NTAPI NtUserMapVirtualKeyEx(UINT keyCode, UINT transType, DWORD keyboardId, HKL dwhkl)
Definition: keyboard.c:1751
INT NTAPI NtUserToUnicodeEx(UINT wVirtKey, UINT wScanCode, PBYTE lpKeyState, LPWSTR pwszBuff, int cchBuff, UINT wFlags, HKL dwhkl)
BOOL NTAPI NtUserDragDetect(HWND hWnd, POINT pt)
Definition: message.c:2207
BOOL NTAPI NtUserGetKeyboardLayoutName(_Inout_ PUNICODE_STRING pustrName)
Definition: kbdlayout.c:2064
SHORT NTAPI NtUserGetKeyState(INT VirtKey)
Definition: msgqueue.c:2573
#define MAX_LAYOUT_FILENAME
Definition: ntuser.h:118
BOOL NTAPI NtUserGetImeHotKey(_In_ DWORD dwHotKeyId, _Out_ PUINT lpuModifiers, _Out_ PUINT lpuVirtualKey, _Out_opt_ LPHKL lphKL)
Definition: ime.c:429
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
struct tagCLIENTKEYBOARDTYPE * PCLIENTKEYBOARDTYPE
struct tagKBDTABLE_MULTI * PKBDTABLE_MULTI
#define KBDTABLE_MULTI_MAX
Definition: kbd.h:199
#define debugstr_w
Definition: kernel32.h:32
USHORT LANGID
Definition: mui.h:9
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
#define ZeroMemory
Definition: minwinbase.h:31
#define error(str)
Definition: mkdosfs.c:1605
LPCWSTR szPath
Definition: env.c:37
UINT_PTR HKL
Definition: msctf.idl:125
_In_ HANDLE hFile
Definition: mswsock.h:90
unsigned int * PUINT
Definition: ndis.h:50
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
#define _Out_writes_z_(s)
Definition: no_sal2.h:180
#define _Out_opt_
Definition: no_sal2.h:214
#define _Inout_
Definition: no_sal2.h:162
#define _Outptr_
Definition: no_sal2.h:262
#define _Null_
Definition: no_sal2.h:52
#define _Inout_updates_z_(s)
Definition: no_sal2.h:186
#define _Inout_opt_
Definition: no_sal2.h:216
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define _When_(c, a)
Definition: no_sal2.h:38
#define REG_BINARY
Definition: nt_native.h:1499
#define KEY_READ
Definition: nt_native.h:1026
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define FASTCALL
Definition: nt_native.h:50
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToInteger(PUNICODE_STRING String, ULONG Base, PULONG Value)
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
#define BOOL
Definition: nt_native.h:43
#define KEY_WRITE
Definition: nt_native.h:1034
#define UNICODE_NULL
#define MAXWORD
static HANDLE ULONG_PTR dwData
Definition: pipe.c:111
EXTINLINE BOOL NtUserxSwapMouseButton(BOOL fSwap)
Definition: ntwrapper.h:596
EXTINLINE BOOL NtUserxEnableWindow(HWND hWnd, BOOL bEnable)
Definition: ntwrapper.h:681
EXTINLINE INT NtUserxGetKeyboardType(INT nTypeFlag)
Definition: ntwrapper.h:631
EXTINLINE HKL NtUserxGetKeyboardLayout(DWORD idThread)
Definition: ntwrapper.h:626
#define LOWORD(l)
Definition: pedump.c:82
#define CONST
Definition: pedump.c:81
BYTE * PBYTE
Definition: pedump.c:66
short WCHAR
Definition: pedump.c:58
short SHORT
Definition: pedump.c:59
long LONG
Definition: pedump.c:60
char CHAR
Definition: pedump.c:57
_In_ ULONG _In_ WDFMEMORY Input
Definition: portacpi.cpp:109
static const WCHAR szName[]
Definition: powrprof.c:45
_In_opt_ LPCSTR pszSubKey
Definition: shlwapi.h:783
_In_ UINT cchBuf
Definition: shlwapi.h:378
HWND WINAPI SetCapture(_In_ HWND hWnd)
BOOL WINAPI GetKeyboardLayoutNameW(_Out_writes_(KL_NAMELENGTH) LPWSTR)
BOOL WINAPI SetDoubleClickTime(_In_ UINT)
HKL WINAPI GetKeyboardLayout(_In_ DWORD)
void WINAPI mouse_event(_In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ ULONG_PTR)
#define WM_MOUSEFIRST
Definition: winuser.h:1802
#define SM_CXDRAG
Definition: winuser.h:1039
BOOL WINAPI GetKeyboardLayoutNameA(_Out_writes_(KL_NAMELENGTH) LPSTR)
#define WM_MOUSELAST
Definition: winuser.h:1829
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
UINT WINAPI MapVirtualKeyExA(_In_ UINT, _In_ UINT, _In_opt_ HKL)
#define KL_NAMELENGTH
Definition: winuser.h:122
int WINAPI GetKeyNameTextA(_In_ LONG lParam, _Out_writes_(cchSize) LPSTR lpString, _In_ int cchSize)
#define KLF_REPLACELANG
Definition: winuser.h:115
UINT WINAPI MapVirtualKeyExW(_In_ UINT, _In_ UINT, _In_opt_ HKL)
#define VK_SPACE
Definition: winuser.h:2255
#define KLF_ACTIVATE
Definition: winuser.h:111
int WINAPI ToAscii(_In_ UINT, _In_ UINT, _In_reads_opt_(256) CONST BYTE *, _Out_ LPWORD, _In_ UINT)
#define WM_KEYFIRST
Definition: winuser.h:1742
int WINAPI ToUnicode(_In_ UINT wVirtKey, _In_ UINT wScanCode, _In_reads_bytes_opt_(256) CONST BYTE *lpKeyState, _Out_writes_(cchBuff) LPWSTR pwszBuff, _In_ int cchBuff, _In_ UINT wFlags)
#define WM_MOUSEMOVE
Definition: winuser.h:1803
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
UINT WINAPI MapVirtualKeyW(_In_ UINT, _In_ UINT)
HKL WINAPI LoadKeyboardLayoutW(_In_ LPCWSTR, _In_ UINT)
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
int WINAPI GetKeyNameTextW(_In_ LONG lParam, _Out_writes_(cchSize) LPWSTR lpString, _In_ int cchSize)
#define VK_KANJI
Definition: winuser.h:2249
#define PM_REMOVE
Definition: winuser.h:1207
BOOL WINAPI WaitMessage(void)
Definition: ntwrapper.h:350
#define SPI_SETDOUBLECLICKTIME
Definition: winuser.h:1392
HKL WINAPI LoadKeyboardLayoutA(_In_ LPCSTR, _In_ UINT)
#define KLF_SUBSTITUTE_OK
Definition: winuser.h:112
VOID WINAPI keybd_event(_In_ BYTE, _In_ BYTE, _In_ DWORD, _In_ ULONG_PTR)
#define WM_LBUTTONUP
Definition: winuser.h:1805
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define KLF_NOTELLSHELL
Definition: winuser.h:116
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)
SHORT WINAPI GetAsyncKeyState(_In_ int)
#define WM_KEYDOWN
Definition: winuser.h:1743
DWORD WINAPI OemKeyScan(_In_ WORD)
#define SM_CYDRAG
Definition: winuser.h:1040
#define WM_KEYLAST
Definition: winuser.h:1756
int WINAPI ToAsciiEx(_In_ UINT, _In_ UINT, _In_reads_opt_(256) CONST BYTE *, _Out_ LPWORD, _In_ UINT, _In_opt_ HKL)
#define VK_ESCAPE
Definition: winuser.h:2250
SHORT WINAPI VkKeyScanW(_In_ WCHAR)
int WINAPI GetSystemMetrics(_In_ int)
UINT WINAPI GetKBCodePage(void)
Definition: input.c:582
SHORT WINAPI GetKeyState(_In_ int)
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:204
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
#define _SEH2_END
Definition: pseh2_64.h:194
#define _SEH2_TRY
Definition: pseh2_64.h:93
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:207
#define REG_DWORD
Definition: sdbapi.c:615
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_CHINESE_SINGAPORE
Definition: nls.h:211
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#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 PRIMARYLANGID(l)
Definition: nls.h:16
#define LANG_KOREAN
Definition: nls.h:84
#define SUBLANG_KOREAN
Definition: nls.h:280
_In_ UINT _In_ UINT cch
Definition: shellapi.h:428
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
char * pszDllName
Definition: spec2def.c:74
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
long y
Definition: dcommon.idl:24
long x
Definition: dcommon.idl:24
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
UINT uVirtualKey
Definition: input.c:64
DWORD dwHotKeyId
Definition: input.c:63
UINT uModifiers
Definition: input.c:65
WCHAR wszDllName[32]
Definition: kbd.h:194
HANDLE hFile
Definition: ntuser.h:114
KBDTABLE_MULTI_AUX_ENTRY AuxEntries[KBDTABLE_MULTI_MAX]
Definition: ntuser.h:124
KBDTABLE_MULTI Multi
Definition: ntuser.h:122
UINT nTables
Definition: kbd.h:203
PCBYTE PBYTE SIZE_T cbData
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
uint16_t * PWSTR
Definition: typedefs.h:56
const char * LPCSTR
Definition: typedefs.h:52
int32_t INT_PTR
Definition: typedefs.h:64
uint32_t * PULONG
Definition: typedefs.h:59
const uint16_t * PCWSTR
Definition: typedefs.h:57
const uint16_t * LPCWSTR
Definition: typedefs.h:57
unsigned char * LPBYTE
Definition: typedefs.h:53
uint16_t * LPWSTR
Definition: typedefs.h:56
uint16_t * LPWORD
Definition: typedefs.h:56
void * PVOID
Definition: typedefs.h:50
ULONG_PTR SIZE_T
Definition: typedefs.h:80
char * LPSTR
Definition: typedefs.h:51
const char * PCSTR
Definition: typedefs.h:52
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define MAKELONG(a, b)
Definition: typedefs.h:249
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
@ SETIMEHOTKEY_INITIALIZE
Definition: undocuser.h:424
@ SETIMEHOTKEY_ADD
Definition: undocuser.h:423
@ SETIMEHOTKEY_DELETE
Definition: undocuser.h:422
DWORD dwAttributes
Definition: vdmdbg.h:34
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:44
_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
UINT APIENTRY NtUserSendInput(UINT nInputs, LPINPUT pInput, INT cbSize)
Definition: input.c:972
SHORT WINAPI VkKeyScanA(CHAR ch)
Definition: input.c:1507
int WINAPI GetKeyboardType(int nTypeFlag)
Definition: input.c:674
SHORT WINAPI VkKeyScanExW(WCHAR ch, HKL dwhkl)
Definition: input.c:1540
BOOL(WINAPI * PFN_KbdLayerRealDllFileNT4)(PWSTR)
Definition: input.c:52
HKL WINAPI LoadKeyboardLayoutEx(_In_ HKL hklUnload, _In_ PCWSTR pwszKLID, _In_ UINT Flags)
Definition: input.c:1313
#define ATTR_MASK
Definition: input.c:39
#define FE_KOREAN
Definition: input.c:93
static BOOL IntIsConsoleSession(void)
Definition: input.c:56
static BOOL IntGetTableOffsets(_In_ HMODULE hModule, _In_ PFN_KbdLayerDescriptor pfnMain, _Out_ PULONG poffTable)
Gets the 16-bit offsets of the tables, as NtUserLoadKeyboardLayoutEx expects them: LOWORD is the main...
Definition: input.c:916
VOID APIENTRY CliImmInitializeHotKeys(DWORD dwAction, HKL hKL)
Definition: input.c:433
BOOL WINAPI DragDetect(HWND hWnd, POINT pt)
Definition: input.c:489
UINT WINAPI MapVirtualKeyA(UINT uCode, UINT uMapType)
Definition: input.c:1345
#define FE_JAPANESE
Definition: input.c:90
#define KBDLAYOUT_KEY
Definition: input.c:38
static BOOL IntGetKeyboardDllName(_Out_writes_z_(cchDllName) PWSTR pszDllName, _In_ SIZE_T cchDllName, _Inout_updates_z_(cchKLID) PWSTR pszKLID, _In_ SIZE_T cchKLID, _In_ LANGID wLangID, _Inout_ PUINT puFlags, _Out_ PULONG pdwKL)
Definition: input.c:1051
static VOID IntCloseAuxFiles(_Inout_opt_ PKBDTABLE_MULTI_EX pMulti)
Closes the aux file handles that IntLoadKeyboardLayoutTablesAndFile stored in pMulti....
Definition: input.c:751
static BOOL IntIsValidLayoutFileName(PCWSTR pszFileName)
Definition: input.c:720
VOID APIENTRY CliGetPreloadKeyboardLayouts(PBYTE pbFlags)
Definition: input.c:378
static BOOL IsValidKLID(_In_ LPCWSTR pwszKLID)
Definition: input.c:715
#define IFN_KbdLayerDescriptor
Definition: input.c:43
IMEHOTKEYENTRY DefaultHotKeyTableT[]
Definition: input.c:76
#define IFN_KbdNlsLayerDescriptor
Definition: input.c:44
static HMODULE LoadSysLibraryW(PCWSTR pszFileName)
Definition: input.c:737
BOOL APIENTRY CliImmSetHotKeyWorker(DWORD dwHotKeyId, UINT uModifiers, UINT uVirtualKey, HKL hKL, DWORD dwAction)
Definition: input.c:137
struct tagIMEHOTKEYENTRY IMEHOTKEYENTRY
IMEHOTKEYENTRY DefaultHotKeyTableC[]
Definition: input.c:83
#define FE_CHINESE_SIMPLIFIED
Definition: input.c:92
BOOL WINAPI SwapMouseButton(BOOL fSwap)
Definition: input.c:1426
BOOL(WINAPI * PFN_KbdLayerRealDllFile)(ULONG, PWSTR, PCLIENTKEYBOARDTYPE, PVOID)
Definition: input.c:53
static PFN_KbdLayerDescriptor IntPrepareLayoutModule(_Inout_ HMODULE *phModule, _In_ _Outptr_ PCWSTR *ppszFile, _Out_writes_z_(MAX_LAYOUT_FILENAME) PWSTR pszRealFile, _In_opt_ PCWSTR pszKLID, _Inout_ PUINT puFlags, _Inout_opt_ PKBDTABLE_MULTI_EX pMulti)
Prepares a freshly loaded layout DLL: loads the multi-table, follows the "real" DLL,...
Definition: input.c:878
PVOID(WINAPI * PFN_KbdLayerDescriptor)(void)
Definition: input.c:50
BOOL WINAPI EnableWindow(HWND hWnd, BOOL bEnable)
Definition: input.c:549
#define FE_CHINESE_TRADITIONAL
Definition: input.c:91
VOID FASTCALL IntSetFeKeyboardFlags(LANGID LangID, PBYTE pbFlags)
Definition: input.c:96
#define KLF_INITTIME
Definition: input.c:34
BOOL FASTCALL CliGetImeHotKeysFromRegistry(VOID)
Definition: input.c:345
struct tagIMEHOTKEYENTRY * PIMEHOTKEYENTRY
PVOID(WINAPI * PFN_KbdNlsLayerDescriptor)(void)
Definition: input.c:51
#define MOD_ALL_MODS
static HKL IntLoadKeyboardLayout(_In_opt_ HKL hklUnload, _In_ PCWSTR pwszKLID, _In_ LANGID wLangID, _In_ UINT Flags, _In_ BOOL bForce)
Definition: input.c:1236
static VOID IntFollowRealDll(_Inout_ HMODULE *phModule, _Outptr_ PCWSTR *ppszFile, _Out_writes_z_(MAX_LAYOUT_FILENAME) PWSTR pszRealFile, _In_opt_ PCWSTR pszKLID)
If the layout DLL redirects to a "real" DLL, loads that one instead and releases the original....
Definition: input.c:822
VOID IntLoadPreloadKeyboardLayouts(VOID)
Definition: input.c:172
#define KLF_FORCE
Definition: input.c:35
IMEHOTKEYENTRY DefaultHotKeyTableJ[]
Definition: input.c:70
static HANDLE IntLoadKeyboardLayoutTablesAndFile(_In_ PCWSTR pszLayoutFile, _In_opt_ PCWSTR pszKLID, _Inout_ PUINT puFlags, _Out_ PULONG poffTable, _Out_opt_ PKBDTABLE_MULTI_EX pMulti)
Returns a handle to the layout file, or NULL on failure. On success, the handles in pMulti (if any) s...
Definition: input.c:964
DWORD FASTCALL CliReadRegistryValue(HANDLE hKey, LPCWSTR pszName)
Definition: input.c:123
SHORT WINAPI VkKeyScanExA(CHAR ch, HKL dwhkl)
Definition: input.c:1523
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)
Definition: input.c:290
static HANDLE IntLoadKeyboardLayoutFile(_Inout_updates_z_(cchKLID) PWSTR pszKLID, _In_ SIZE_T cchKLID, _In_ DWORD wLangID, _Inout_ PUINT pFlags, _Out_ PULONG pOffTable, _Out_ PULONG pdwNewKL, _Out_opt_ PKBDTABLE_MULTI_EX pMulti)
Opens and loads keyboard layout file(s).
Definition: input.c:1208
#define LANGID_ENGLISH_US
Definition: input.c:40
#define IFN_KbdLayerRealDllFile
Definition: input.c:46
#define IFN_KbdLayerRealDllFileNT4
Definition: input.c:45
VOID APIENTRY CliSetDefaultImeHotKeys(PIMEHOTKEYENTRY pEntries, UINT nCount, BOOL bCheck)
Definition: input.c:414
BOOL FASTCALL CliSetSingleHotKey(LPCWSTR pszSubKey, HANDLE hKey)
Definition: input.c:320
static VOID IntLoadMultiTables(_In_ HMODULE hModule, _Inout_ PUINT puFlags, _Inout_ PKBDTABLE_MULTI_EX pMulti)
Loads the multi-table (if any). Each aux table file is loaded by a recursive call,...
Definition: input.c:784
BOOL GetSystemLibraryPath(PWSTR pszPath, SIZE_T cchPath, PCWSTR pszFileName)
Definition: input.c:728
BOOL APIENTRY CliSaveImeHotKey(DWORD dwID, UINT uModifiers, UINT uVirtualKey, HKL hKL, BOOL bDelete)
Definition: input.c:234
BOOL(WINAPI * PFN_KbdLayerMultiDescriptor)(PKBDTABLE_MULTI)
Definition: input.c:54
#define KBDLAYOUTS_KEY
Definition: input.c:37
#define IFN_KbdLayerMultiDescriptor
Definition: input.c:47
BOOL WINAPI GetLastInputInfo(PLASTINPUTINFO plii)
Definition: input.c:683
BOOL WINAPI UnloadKeyboardLayout(HKL hKL)
Definition: input.c:1332
#define INPUT_KEYBOARD
Definition: winable.h:10
#define INPUT_MOUSE
Definition: winable.h:9
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:1809
WINBASEAPI _In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon_undoc.h:337
_In_ BOOL bEnable
Definition: winddi.h:3426
#define WINAPI
Definition: msvc.h:6
#define CP_OEMCP
Definition: winnls.h:259
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11
BOOL bScan
Definition: wlanconf.c:22
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
unsigned char BYTE
Definition: xxhash.c:193