2f06bcf6fa99095a01822a89bab9176be2d85b96
[reactos.git] / include / psdk / ntddkbd.h
1 /*
2 * ntddkbd.h
3 *
4 * Keyboard IOCTL interface
5 *
6 * This file is part of the w32api package.
7 *
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 */
22
23 #ifndef __NTDDKBD_H
24 #define __NTDDKBD_H
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 #define DD_KEYBOARD_DEVICE_NAME "\\Device\\KeyboardClass"
31 #define DD_KEYBOARD_DEVICE_NAME_U L"\\Device\\KeyboardClass"
32
33 #define IOCTL_KEYBOARD_QUERY_ATTRIBUTES \
34 CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS)
35
36 #define IOCTL_KEYBOARD_QUERY_INDICATORS \
37 CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
38
39 #define IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION \
40 CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0020, METHOD_BUFFERED, FILE_ANY_ACCESS)
41
42 #define IOCTL_KEYBOARD_QUERY_TYPEMATIC \
43 CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
44
45 #define IOCTL_KEYBOARD_SET_TYPEMATIC \
46 CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0001, METHOD_BUFFERED, FILE_ANY_ACCESS)
47
48 #define IOCTL_KEYBOARD_SET_INDICATORS \
49 CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0002, METHOD_BUFFERED, FILE_ANY_ACCESS)
50
51
52 DEFINE_GUID(GUID_DEVINTERFACE_KEYBOARD, \
53 0x884b96c3, 0x56ef, 0x11d1, 0xbc, 0x8c, 0x00, 0xa0, 0xc9, 0x14, 0x05, 0xdd);
54
55 #define KEYBOARD_ERROR_VALUE_BASE 10000
56
57 /* KEYBOARD_INPUT_DATA.MakeCode constants */
58 #define KEYBOARD_OVERRUN_MAKE_CODE 0xFF
59
60 /* KEYBOARD_INPUT_DATA.Flags constants */
61 #define KEY_MAKE 0
62 #define KEY_BREAK 1
63 #define KEY_E0 2
64 #define KEY_E1 4
65
66 #define KEYBOARD_LED_INJECTED 0x8000
67 #define KEYBOARD_SHADOW 0x4000
68 #define KEYBOARD_KANA_LOCK_ON 8
69 #define KEYBOARD_CAPS_LOCK_ON 4
70 #define KEYBOARD_NUM_LOCK_ON 2
71 #define KEYBOARD_SCROLL_LOCK_ON 1
72
73 typedef struct _KEYBOARD_INPUT_DATA {
74 USHORT UnitId;
75 USHORT MakeCode;
76 USHORT Flags;
77 USHORT Reserved;
78 ULONG ExtraInformation;
79 } KEYBOARD_INPUT_DATA, *PKEYBOARD_INPUT_DATA;
80
81
82 typedef struct _KEYBOARD_TYPEMATIC_PARAMETERS {
83 USHORT UnitId;
84 USHORT Rate;
85 USHORT Delay;
86 } KEYBOARD_TYPEMATIC_PARAMETERS, *PKEYBOARD_TYPEMATIC_PARAMETERS;
87
88 typedef struct _KEYBOARD_ID {
89 UCHAR Type;
90 UCHAR Subtype;
91 } KEYBOARD_ID, *PKEYBOARD_ID;
92
93 #define ENHANCED_KEYBOARD(Id) ((Id).Type == 2 || (Id).Type == 4 || FAREAST_KEYBOARD(Id))
94 #define FAREAST_KEYBOARD(Id) ((Id).Type == 7 || (Id).Type == 8)
95
96 typedef struct _KEYBOARD_INDICATOR_PARAMETERS {
97 USHORT UnitId;
98 USHORT LedFlags;
99 } KEYBOARD_INDICATOR_PARAMETERS, *PKEYBOARD_INDICATOR_PARAMETERS;
100
101 typedef struct _INDICATOR_LIST {
102 USHORT MakeCode;
103 USHORT IndicatorFlags;
104 } INDICATOR_LIST, *PINDICATOR_LIST;
105
106 typedef struct _KEYBOARD_INDICATOR_TRANSLATION {
107 USHORT NumberOfIndicatorKeys;
108 INDICATOR_LIST IndicatorList[1];
109 } KEYBOARD_INDICATOR_TRANSLATION, *PKEYBOARD_INDICATOR_TRANSLATION;
110
111 typedef struct _KEYBOARD_ATTRIBUTES {
112 KEYBOARD_ID KeyboardIdentifier;
113 USHORT KeyboardMode;
114 USHORT NumberOfFunctionKeys;
115 USHORT NumberOfIndicators;
116 USHORT NumberOfKeysTotal;
117 ULONG InputDataQueueLength;
118 KEYBOARD_TYPEMATIC_PARAMETERS KeyRepeatMinimum;
119 KEYBOARD_TYPEMATIC_PARAMETERS KeyRepeatMaximum;
120 } KEYBOARD_ATTRIBUTES, *PKEYBOARD_ATTRIBUTES;
121
122 typedef struct _KEYBOARD_UNIT_ID_PARAMETER {
123 USHORT UnitId;
124 } KEYBOARD_UNIT_ID_PARAMETER, *PKEYBOARD_UNIT_ID_PARAMETER;
125
126 typedef struct _KEYBOARD_IME_STATUS {
127 USHORT UnitId;
128 ULONG ImeOpen;
129 ULONG ImeConvMode;
130 } KEYBOARD_IME_STATUS, *PKEYBOARD_IME_STATUS;
131
132 #ifdef __cplusplus
133 }
134 #endif
135
136 #endif /* __NTDDKBD_H */