1 #define __KBD_H 2 3 #ifdef __cplusplus 4 extern "C" { 5 #endif 6 7 /* Virtual key flags */ 8 #define KBDEXT 0x100 /* Extended key code */ 9 #define KBDMULTIVK 0x200 /* Multi-key */ 10 #define KBDSPECIAL 0x400 /* Special key */ 11 #define KBDNUMPAD 0x800 /* Number-pad */ 12 13 /* Modifier bits */ 14 #define KBDSHIFT 0x001 /* Shift modifier */ 15 #define KBDCTRL 0x002 /* Ctrl modifier */ 16 #define KBDALT 0x004 /* Alt modifier */ 17 18 /* Invalid shift */ 19 #define SHFT_INVALID 0x0F 20 21 typedef struct _VK_TO_BIT { 22 BYTE Vk; 23 BYTE ModBits; 24 } VK_TO_BIT, *PVK_TO_BIT; 25 26 typedef struct _MODIFIERS { 27 PVK_TO_BIT pVkToBit; 28 WORD wMaxModBits; 29 BYTE ModNumber[]; 30 } MODIFIERS, *PMODIFIERS; 31 32 #define TYPEDEF_VK_TO_WCHARS(i) \ 33 typedef struct _VK_TO_WCHARS ## i { \ 34 BYTE VirtualKey; \ 35 BYTE Attributes; \ 36 WCHAR wch[i]; \ 37 } VK_TO_WCHARS ## i, *PVK_TO_WCHARS ## i; 38 39 TYPEDEF_VK_TO_WCHARS(1) 40 TYPEDEF_VK_TO_WCHARS(2) 41 TYPEDEF_VK_TO_WCHARS(3) 42 TYPEDEF_VK_TO_WCHARS(4) 43 TYPEDEF_VK_TO_WCHARS(5) 44 TYPEDEF_VK_TO_WCHARS(6) 45 TYPEDEF_VK_TO_WCHARS(7) 46 TYPEDEF_VK_TO_WCHARS(8) 47 TYPEDEF_VK_TO_WCHARS(9) 48 TYPEDEF_VK_TO_WCHARS(10) 49 50 typedef struct _VK_TO_WCHAR_TABLE { 51 PVK_TO_WCHARS1 pVkToWchars; 52 BYTE nModifications; 53 BYTE cbSize; 54 } VK_TO_WCHAR_TABLE, *PVK_TO_WCHAR_TABLE; 55 56 typedef struct _DEADKEY { 57 DWORD dwBoth; 58 WCHAR wchComposed; 59 USHORT uFlags; 60 } DEADKEY, *PDEADKEY; 61 62 typedef WCHAR *DEADKEY_LPWSTR; 63 64 #define DKF_DEAD 1 65 66 typedef struct _VSC_LPWSTR { 67 BYTE vsc; 68 LPWSTR pwsz; 69 } VSC_LPWSTR, *PVSC_LPWSTR; 70 71 typedef struct _VSC_VK { 72 BYTE Vsc; 73 USHORT Vk; 74 } VSC_VK, *PVSC_VK; 75 76 #define TYPEDEF_LIGATURE(i) \ 77 typedef struct _LIGATURE ## i { \ 78 BYTE VirtualKey; \ 79 WORD ModificationNumber; \ 80 WCHAR wch[i]; \ 81 } LIGATURE ## i, *PLIGATURE ## i; 82 83 TYPEDEF_LIGATURE(1) 84 TYPEDEF_LIGATURE(2) 85 TYPEDEF_LIGATURE(3) 86 TYPEDEF_LIGATURE(4) 87 TYPEDEF_LIGATURE(5) 88 89 #define KBD_VERSION 1 90 #define GET_KBD_VERSION(p) (HIWORD((p)->fLocalFlags)) 91 #define KLLF_ALTGR 0x1 92 #define KLLF_SHIFTLOCK 0x2 93 #define KLLF_LRM_RLM 0x4 94 95 typedef struct _KBDTABLES { 96 PMODIFIERS pCharModifiers; 97 PVK_TO_WCHAR_TABLE pVkToWcharTable; 98 PDEADKEY pDeadKey; 99 VSC_LPWSTR *pKeyNames; 100 VSC_LPWSTR *pKeyNamesExt; 101 LPWSTR *pKeyNamesDead; 102 USHORT *pusVSCtoVK; 103 BYTE bMaxVSCtoVK; 104 PVSC_VK pVSCtoVK_E0; 105 PVSC_VK pVSCtoVK_E1; 106 DWORD fLocaleFlags; 107 BYTE nLgMaxd; 108 BYTE cbLgEntry; 109 PLIGATURE1 pLigature; 110 } KBDTABLES, *PKBDTABLES; 111 112 /* Constants that help table decoding */ 113 #define WCH_NONE 0xf000 114 #define WCH_DEAD 0xf001 115 #define WCH_LGTR 0xf002 116 117 /* VK_TO_WCHARS attributes */ 118 #define CAPLOK 0x01 119 #define SGCAPS 0x02 120 #define CAPLOKALTGR 0x04 121 #define KANALOK 0x08 122 #define GRPSELTAP 0x80 123 124 #define VK_ABNT_C1 0xC1 125 #define VK_ABNT_C2 0xC2 126 127 /* Useful scancodes */ 128 #define SCANCODE_LSHIFT 0x2A 129 #define SCANCODE_RSHIFT 0x36 130 #define SCANCODE_CTRL 0x1D 131 #define SCANCODE_ALT 0x38 132 133 #ifdef __cplusplus 134 }; 135 #endif//__KBD_H 136