2010-02-26 11:43:19 +00:00
|
|
|
#pragma once
|
2002-01-14 01:11:58 +00:00
|
|
|
|
2011-10-10 16:11:49 +00:00
|
|
|
#include <ndk/kbd.h>
|
2011-10-19 20:03:50 +00:00
|
|
|
|
|
|
|
typedef struct tagKBDNLSLAYER
|
|
|
|
{
|
|
|
|
USHORT OEMIdentifier;
|
|
|
|
USHORT LayoutInformation;
|
|
|
|
UINT NumOfVkToF;
|
|
|
|
struct _VK_TO_FUNCTION_TABLE *pVkToF;
|
|
|
|
INT NumOfMouseVKey;
|
|
|
|
PUSHORT pusMouseVKey;
|
|
|
|
} KBDNLSLAYER, *PKBDNLSLAYER;
|
|
|
|
|
|
|
|
typedef struct tagKBDFILE
|
|
|
|
{
|
|
|
|
HEAD head;
|
|
|
|
struct tagKBDFILE *pkfNext;
|
|
|
|
WCHAR awchKF[20];
|
|
|
|
HANDLE hBase;
|
|
|
|
struct _KBDTABLES *pKbdTbl;
|
|
|
|
ULONG Size;
|
|
|
|
PKBDNLSLAYER pKbdNlsTbl;
|
|
|
|
} KBDFILE, *PKBDFILE;
|
2011-10-10 16:11:49 +00:00
|
|
|
|
2011-10-19 20:03:50 +00:00
|
|
|
typedef struct tagKL
|
2007-02-10 14:52:46 +00:00
|
|
|
{
|
2011-10-19 20:03:50 +00:00
|
|
|
HEAD head;
|
|
|
|
struct tagKL *pklNext;
|
|
|
|
struct tagKL *pklPrev;
|
|
|
|
DWORD dwKL_Flags;
|
|
|
|
HKL hkl;
|
|
|
|
PKBDFILE spkf;
|
|
|
|
DWORD dwFontSigs;
|
|
|
|
UINT iBaseCharset;
|
|
|
|
USHORT CodePage;
|
|
|
|
WCHAR wchDiacritic;
|
2014-12-27 06:59:29 +00:00
|
|
|
PIMEINFOEX piiex;
|
2011-10-16 15:39:07 +00:00
|
|
|
} KL, *PKL;
|
2007-01-09 22:55:40 +00:00
|
|
|
|
2009-10-10 04:40:36 +00:00
|
|
|
typedef struct _ATTACHINFO
|
|
|
|
{
|
2011-10-19 20:03:50 +00:00
|
|
|
struct _ATTACHINFO *paiNext;
|
2009-10-10 04:40:36 +00:00
|
|
|
PTHREADINFO pti1;
|
|
|
|
PTHREADINFO pti2;
|
|
|
|
} ATTACHINFO, *PATTACHINFO;
|
|
|
|
|
|
|
|
extern PATTACHINFO gpai;
|
|
|
|
|
2011-04-09 12:44:45 +00:00
|
|
|
/* Key States */
|
|
|
|
#define KS_DOWN_BIT 0x80
|
|
|
|
#define KS_LOCK_BIT 0x01
|
|
|
|
/* Scan Codes */
|
|
|
|
#define SC_KEY_UP 0x8000
|
|
|
|
/* lParam bits */
|
2011-12-14 04:07:06 +00:00
|
|
|
#define LP_DO_NOT_CARE_BIT (1<<25) // For GetKeyNameText
|
2011-10-05 14:09:51 +00:00
|
|
|
|
2011-10-21 21:23:51 +00:00
|
|
|
/* General */
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT") NTSTATUS NTAPI InitInputImpl(VOID);
|
2018-12-16 11:16:29 +00:00
|
|
|
VOID NTAPI RawInputThreadMain(VOID);
|
2011-10-21 21:23:51 +00:00
|
|
|
BOOL FASTCALL IntBlockInput(PTHREADINFO W32Thread, BOOL BlockIt);
|
2012-08-18 22:13:38 +00:00
|
|
|
NTSTATUS FASTCALL UserAttachThreadInput(PTHREADINFO,PTHREADINFO,BOOL);
|
2013-10-20 05:16:52 +00:00
|
|
|
BOOL FASTCALL IsRemoveAttachThread(PTHREADINFO);
|
2011-10-21 21:23:51 +00:00
|
|
|
VOID FASTCALL DoTheScreenSaver(VOID);
|
|
|
|
#define ThreadHasInputAccess(W32Thread) (TRUE)
|
|
|
|
|
|
|
|
/* Keyboard */
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT") NTSTATUS NTAPI InitKeyboardImpl(VOID);
|
2011-10-13 13:23:57 +00:00
|
|
|
VOID NTAPI UserInitKeyboard(HANDLE hKeyboardDevice);
|
2011-10-16 15:39:07 +00:00
|
|
|
PKL W32kGetDefaultKeyLayout(VOID);
|
2011-10-05 14:09:51 +00:00
|
|
|
VOID NTAPI UserProcessKeyboardInput(PKEYBOARD_INPUT_DATA pKeyInput);
|
|
|
|
BOOL NTAPI UserSendKeyboardInput(KEYBDINPUT *pKbdInput, BOOL bInjected);
|
2011-10-21 14:54:22 +00:00
|
|
|
PKL NTAPI UserHklToKbl(HKL hKl);
|
|
|
|
BOOL NTAPI UserSetDefaultInputLang(HKL hKl);
|
2023-10-31 13:37:49 +00:00
|
|
|
extern INT gLanguageToggleKeyState;
|
2016-08-11 15:53:05 +00:00
|
|
|
extern DWORD gdwLanguageToggleKey;
|
2023-10-31 13:37:49 +00:00
|
|
|
extern INT gLayoutToggleKeyState;
|
|
|
|
extern DWORD gdwLayoutToggleKey;
|
2011-10-21 21:23:51 +00:00
|
|
|
|
|
|
|
/* Mouse */
|
|
|
|
WORD FASTCALL UserGetMouseButtonsState(VOID);
|
|
|
|
VOID NTAPI UserProcessMouseInput(PMOUSE_INPUT_DATA pMouseInputData);
|
|
|
|
BOOL NTAPI UserSendMouseInput(MOUSEINPUT *pMouseInput, BOOL bInjected);
|
2002-01-14 01:11:58 +00:00
|
|
|
|
2014-12-27 06:59:29 +00:00
|
|
|
/* IMM */
|
|
|
|
UINT FASTCALL IntImmProcessKey(PUSER_MESSAGE_QUEUE, PWND, UINT, WPARAM, LPARAM);
|
2022-02-09 02:27:44 +00:00
|
|
|
VOID FASTCALL IntFreeImeHotKeys(VOID);
|
2014-12-27 06:59:29 +00:00
|
|
|
|
|
|
|
extern DWORD gSystemFS;
|
|
|
|
extern UINT gSystemCPCharSet;
|
2011-10-05 14:09:51 +00:00
|
|
|
extern HANDLE ghKeyboardDevice;
|
2009-01-15 23:15:31 +00:00
|
|
|
extern PTHREADINFO ptiRawInput;
|
2011-10-09 20:12:12 +00:00
|
|
|
extern BYTE gafAsyncKeyState[256 * 2 / 8]; // 2 bits per key
|
|
|
|
|
|
|
|
#define GET_KS_BYTE(vk) ((vk) * 2 / 8)
|
|
|
|
#define GET_KS_DOWN_BIT(vk) (1 << (((vk) % 4)*2))
|
|
|
|
#define GET_KS_LOCK_BIT(vk) (1 << (((vk) % 4)*2 + 1))
|
|
|
|
#define IS_KEY_DOWN(ks, vk) (((ks)[GET_KS_BYTE(vk)] & GET_KS_DOWN_BIT(vk)) ? TRUE : FALSE)
|
|
|
|
#define IS_KEY_LOCKED(ks, vk) (((ks)[GET_KS_BYTE(vk)] & GET_KS_LOCK_BIT(vk)) ? TRUE : FALSE)
|
|
|
|
#define SET_KEY_DOWN(ks, vk, down) (ks)[GET_KS_BYTE(vk)] = ((down) ? \
|
|
|
|
((ks)[GET_KS_BYTE(vk)] | GET_KS_DOWN_BIT(vk)) : \
|
|
|
|
((ks)[GET_KS_BYTE(vk)] & ~GET_KS_DOWN_BIT(vk)))
|
|
|
|
#define SET_KEY_LOCKED(ks, vk, down) (ks)[GET_KS_BYTE(vk)] = ((down) ? \
|
|
|
|
((ks)[GET_KS_BYTE(vk)] | GET_KS_LOCK_BIT(vk)) : \
|
|
|
|
((ks)[GET_KS_BYTE(vk)] & ~GET_KS_LOCK_BIT(vk)))
|
|
|
|
|
2011-10-21 15:18:04 +00:00
|
|
|
extern PKL gspklBaseLayout;
|
2013-10-14 06:19:48 +00:00
|
|
|
extern KEYBOARD_ATTRIBUTES gKeyboardInfo;
|