34#define KLF_INITTIME 0x80000000
35#define KLF_FORCE 0x200
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)
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)
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)
125 DWORD dwValue, cbValue;
128 cbValue =
sizeof(dwValue);
159#define MOD_ALL_MODS (MOD_ALT | MOD_CONTROL | MOD_SHIFT | MOD_WIN)
175 DWORD cbValue, dwType;
182 L"Keyboard Layout\\Preload",
188 for (nNumber = 1; nNumber <= 1000; ++nNumber)
190 _ultow(nNumber, szNumber, 10);
192 cbValue =
sizeof(szValue);
242 L"Control Panel\\Input Method\\Hot Keys\\%08lX", dwID);
253 bRevertOnFailure =
TRUE;
257 (
LPBYTE)&uVirtualKey,
sizeof(uVirtualKey));
262 (
LPBYTE)&uModifiers,
sizeof(uModifiers));
267 (
LPBYTE)&hKL,
sizeof(hKL));
272 bRevertOnFailure =
FALSE;
279 if (bRevertOnFailure)
300 if (uVirtualKey == 0)
324 DWORD dwHotKeyId = 0;
325 UINT uModifiers = 0, uVirtualKey = 0;
350 DWORD dwIndex, cchKeyName;
354 L"Control Panel\\Input Method\\Hot Keys",
361 for (dwIndex = 0; dwIndex < 1000; ++dwIndex)
368 szKeyName[
_countof(szKeyName) - 1] = 0;
380 WCHAR szValueName[33], szValue[16];
382 DWORD dwKL, cbValue, dwType;
391 for (iNumber = 1; iNumber < 1000; ++iNumber)
393 _ultow(iNumber, szValueName, 10);
395 cbValue =
sizeof(szValue);
416 UINT uVirtualKey, uModifiers;
465 for (iIndex = 0; iIndex < nCount; ++iIndex)
562 if (vKey < 0 || vKey > 256)
609 lpString,
nSize,
".", &defChar);
707 wszKLID,
sizeof(wszKLID)/
sizeof(wszKLID[0])))
759 for (iTable = 0; iTable < pMulti->Multi.nTables && iTable <
KBDTABLE_MULTI_MAX; ++iTable)
761 HANDLE hAuxFile = pMulti->AuxEntries[iTable].hFile;
764 pMulti->AuxEntries[iTable].hFile =
NULL;
767 pMulti->Multi.nTables = 0;
793 if (!pfnMulti || !pfnMulti(&pMulti->Multi))
797 pMulti->Multi.nTables = 0;
799 for (iTable = 0; iTable < pMulti->Multi.nTables; iTable++)
809 puFlags, &offTable,
NULL);
810 pMulti->AuxEntries[iTable].hFile = hAuxFile;
812 pMulti->AuxEntries[iTable].offTable = offTable;
836 if (!pfnReal && !pfnRealNT4)
845 if (!(pfnReal && pfnReal(ulKLID, szReturned,
NULL,
NULL)) &&
846 !(pfnRealNT4 && pfnRealNT4(szReturned)))
867 *phModule = hRealModule;
868 *ppszFile = pszRealFile;
890 if (
_wcsicmp(*ppszFile,
L"kbdus.dll") != 0)
922 INT_PTR MainOffset, NlsOffset = 0;
928 if (MainOffset <= 0 || MainOffset >
MAXWORD)
930 ERR(
"Invalid MainOffset: %p\n", (
PVOID)MainOffset);
939 if (NlsOffset <= 0 || NlsOffset >
MAXWORD)
941 ERR(
"Invalid NlsOffset: %p\n", (
PVOID)NlsOffset);
946 *poffTable =
MAKELONG(MainOffset, NlsOffset);
981 ERR(
"Invalid layout filename: %s\n",
debugstr_w(pszLayoutFile));
987 pszCurrentFile = pszLayoutFile;
993 ERR(
"LoadSysLibraryW(%s) failed\n",
debugstr_w(pszLayoutFile));
998 pszKLID, puFlags, pMulti);
1009 pszLayoutFile =
L"kbdus.dll";
1013 ERR(
"Invalid layout file: %s\n",
debugstr_w(pszLayoutFile));
1022 StringCbCopyW(pMulti->szRealDllName,
sizeof(pMulti->szRealDllName), pszCurrentFile);
1024 TRACE(
"FileName:%s, *poffTable:0x%08X\n",
debugstr_w(pszCurrentFile), *poffTable);
1028 if (!cchFull || cchFull >=
_countof(szFull))
1030 ERR(
"GetModuleFileNameW failed\n");
1080 ZeroMemory(szSubstitute,
sizeof(szSubstitute));
1081 cbData =
sizeof(szSubstitute);
1100 L"keyboardlayout.ini");
1117 cbData =
sizeof(szLayoutFile);
1122 pszSource = szLayoutFile;
1138 cbData =
sizeof(szLayoutId);
1143 dwKL = (
wcstoul(szLayoutId,
NULL, 16) & 0xFFF) | 0xF000;
1161 cbData =
sizeof(szLayoutFile);
1166 pszSource = szLayoutFile;
1180 pszSource =
L"kbdus.dll";
1185 pszSource =
L"kbdjpn.dll";
1190 pszSource =
L"kbdkor.dll";
1195 pszSource =
L"kbdus.dll";
1196 *pdwKL =
MAKELONG(wLangID, wLangID);
1223 cchKLID, wLangID, pFlags, pdwNewKL))
1225 ERR(
"Failed in IntGetKeyboardDllName\n");
1246 DWORD offTable = 0, dwNewKL = 0, iTable;
1255 &
Flags, &offTable, &dwNewKL, &multi);
1260 ERR(
"Failed to IntLoadKeyboardLayoutFile\n");
1265 Flags &= ~KLF_SUBSTITUTE_OK;
1267 if (
wcscmp(szKLID,
L"00000409") != 0)
1277 &ustrKLID, dwNewKL,
Flags);
1322 ERR(
"hklUnload was NULL\n");
1399 if (!Scan)
return -1;
1404 return ((Vk & 0xff00) << 8) | Scan;
1462 CharCount = (Ret < 0 ? 1 : Ret);
1480 return ToUnicodeEx(wVirtKey, wScanCode, lpKeyState, pwszBuff, cchBuff,
1575 Input.ki.dwExtraInfo = dwExtraInfo;
1601 Input.mi.dwExtraInfo = dwExtraInfo;
#define DECLSPEC_HOTPATCH
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
#define UlongToHandle(ul)
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
#define RegCloseKey(hKey)
RtlInitEmptyUnicodeString(SymbolicLinkName, NULL, 0)
_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ ULONG _In_ ULONG Flags
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)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
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)
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
#define ERROR_INVALID_PARAMETER
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define HeapFree(x, y, z)
#define WideCharToMultiByte
#define MultiByteToWideChar
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
BOOL WINAPI IsDBCSLeadByte(BYTE testchar)
LCID WINAPI GetUserDefaultLCID(void)
UINT WINAPI GetOEMCP(void)
_ACRTIMP __msvcrt_ulong __cdecl wcstoul(const wchar_t *, wchar_t **, int)
_ACRTIMP wchar_t *__cdecl _ultow(__msvcrt_ulong, wchar_t *, int)
_ACRTIMP size_t __cdecl wcsspn(const wchar_t *, const wchar_t *)
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
_ACRTIMP size_t __cdecl wcscspn(const wchar_t *, const wchar_t *)
static const WCHAR szDllName[]
GLenum GLuint GLenum GLsizei const GLchar * buf
#define IME_JHOTKEY_CLOSE_OPEN
#define IME_THOTKEY_IME_NONIME_TOGGLE
#define MOD_IGNORE_ALL_MODIFIER
#define IME_CHOTKEY_IME_NONIME_TOGGLE
#define IME_KHOTKEY_SHAPE_TOGGLE
#define IME_HOTKEY_DSWITCH_LAST
#define IME_THOTKEY_SHAPE_TOGGLE
#define IME_HOTKEY_DSWITCH_FIRST
#define IME_CHOTKEY_SHAPE_TOGGLE
SHORT NTAPI NtUserGetAsyncKeyState(INT Key)
BOOL NTAPI NtUserUnloadKeyboardLayout(HKL hKl)
DWORD NTAPI NtUserVkKeyScanEx(WCHAR wChar, HKL KeyboardLayout, BOOL bUsehHK)
UINT NTAPI NtUserGetKeyboardLayoutList(ULONG nItems, HKL *pHklBuff)
BOOL NTAPI NtUserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
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)
DWORD NTAPI NtUserGetKeyNameText(LONG lParam, LPWSTR lpString, int nSize)
BOOL NTAPI NtUserSetImeHotKey(_In_ DWORD dwHotKeyId, _In_ UINT uModifiers, _In_ UINT uVirtualKey, _In_opt_ HKL hKL, _In_ DWORD dwAction)
UINT NTAPI NtUserMapVirtualKeyEx(UINT keyCode, UINT transType, DWORD keyboardId, HKL dwhkl)
INT NTAPI NtUserToUnicodeEx(UINT wVirtKey, UINT wScanCode, PBYTE lpKeyState, LPWSTR pwszBuff, int cchBuff, UINT wFlags, HKL dwhkl)
BOOL NTAPI NtUserDragDetect(HWND hWnd, POINT pt)
BOOL NTAPI NtUserGetKeyboardLayoutName(_Inout_ PUNICODE_STRING pustrName)
SHORT NTAPI NtUserGetKeyState(INT VirtKey)
#define MAX_LAYOUT_FILENAME
BOOL NTAPI NtUserGetImeHotKey(_In_ DWORD dwHotKeyId, _Out_ PUINT lpuModifiers, _Out_ PUINT lpuVirtualKey, _Out_opt_ LPHKL lphKL)
#define EXCEPTION_EXECUTE_HANDLER
struct tagCLIENTKEYBOARDTYPE * PCLIENTKEYBOARDTYPE
struct tagKBDTABLE_MULTI * PKBDTABLE_MULTI
#define KBDTABLE_MULTI_MAX
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
#define _Out_writes_z_(s)
#define _Inout_updates_z_(s)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToInteger(PUNICODE_STRING String, ULONG Base, PULONG Value)
static HANDLE ULONG_PTR dwData
EXTINLINE BOOL NtUserxSwapMouseButton(BOOL fSwap)
EXTINLINE BOOL NtUserxEnableWindow(HWND hWnd, BOOL bEnable)
EXTINLINE INT NtUserxGetKeyboardType(INT nTypeFlag)
EXTINLINE HKL NtUserxGetKeyboardLayout(DWORD idThread)
_In_ ULONG _In_ WDFMEMORY Input
static const WCHAR szName[]
_In_opt_ LPCSTR pszSubKey
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)
BOOL WINAPI GetKeyboardLayoutNameA(_Out_writes_(KL_NAMELENGTH) LPSTR)
BOOL WINAPI ReleaseCapture(void)
UINT WINAPI MapVirtualKeyExA(_In_ UINT, _In_ UINT, _In_opt_ HKL)
int WINAPI GetKeyNameTextA(_In_ LONG lParam, _Out_writes_(cchSize) LPSTR lpString, _In_ int cchSize)
UINT WINAPI MapVirtualKeyExW(_In_ UINT, _In_ UINT, _In_opt_ HKL)
int WINAPI ToAscii(_In_ UINT, _In_ UINT, _In_reads_opt_(256) CONST BYTE *, _Out_ LPWORD, _In_ UINT)
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)
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)
BOOL WINAPI WaitMessage(void)
#define SPI_SETDOUBLECLICKTIME
HKL WINAPI LoadKeyboardLayoutA(_In_ LPCSTR, _In_ UINT)
#define KLF_SUBSTITUTE_OK
VOID WINAPI keybd_event(_In_ BYTE, _In_ BYTE, _In_ DWORD, _In_ ULONG_PTR)
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
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)
DWORD WINAPI OemKeyScan(_In_ WORD)
int WINAPI ToAsciiEx(_In_ UINT, _In_ UINT, _In_reads_opt_(256) CONST BYTE *, _Out_ LPWORD, _In_ UINT, _In_opt_ HKL)
SHORT WINAPI VkKeyScanW(_In_ WCHAR)
int WINAPI GetSystemMetrics(_In_ int)
UINT WINAPI GetKBCodePage(void)
SHORT WINAPI GetKeyState(_In_ int)
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
#define _SEH2_YIELD(__stmt)
#define SUBLANG_CHINESE_SINGAPORE
#define LANGIDFROMLCID(l)
#define SUBLANG_CHINESE_TRADITIONAL
#define SUBLANG_CHINESE_SIMPLIFIED
#define SUBLANG_CHINESE_HONGKONG
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
KBDTABLE_MULTI_AUX_ENTRY AuxEntries[KBDTABLE_MULTI_MAX]
PCBYTE PBYTE SIZE_T cbData
TW_UINT32 TW_UINT16 TW_UINT16 MSG
@ SETIMEHOTKEY_INITIALIZE
WORD WORD PSZ PSZ pszFileName
_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
*nSize LPSTR _Inout_ LPDWORD nSize
WINBASEAPI _In_ DWORD _Out_ _In_ WORD wFlags
#define HKEY_LOCAL_MACHINE
#define HKEY_CURRENT_USER
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList