|
|
1.1 root 1: /*++ BUILD Version: 0001 // Increment this if a change has global effects
2:
3: Copyright (c) 1990-1993 Microsoft Corporation
4:
5: Module Name:
6:
7: ntddkbd.h
8:
9: Abstract:
10:
11: This is the include file that defines all constants and types for
12: accessing the keyboard device.
13:
14: Author:
15:
16: Lee A. Smith (lees) 02-Aug-1991.
17:
18: Revision History:
19:
20: --*/
21:
22: #ifndef _NTDDKBD_
23: #define _NTDDKBD_
24:
25: //
26: // Device Name - this string is the name of the device. It is the name
27: // that should be passed to NtOpenFile when accessing the device.
28: //
29: // Note: For devices that support multiple units, it should be suffixed
30: // with the Ascii representation of the unit number.
31: //
32:
33: #define DD_KEYBOARD_DEVICE_NAME "\\Device\\KeyboardClass"
34: #define DD_KEYBOARD_DEVICE_NAME_U L"\\Device\\KeyboardClass"
35:
36: //
37: // NtDeviceIoControlFile IoControlCode values for this device.
38: //
39: // Warning: Remember that the low two bits of the code specify how the
40: // buffers are passed to the driver!
41: //
42:
43: #define IOCTL_KEYBOARD_QUERY_ATTRIBUTES CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS)
44: #define IOCTL_KEYBOARD_SET_TYPEMATIC CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0001, METHOD_BUFFERED, FILE_ANY_ACCESS)
45: #define IOCTL_KEYBOARD_SET_INDICATORS CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0002, METHOD_BUFFERED, FILE_ANY_ACCESS)
46: #define IOCTL_KEYBOARD_QUERY_TYPEMATIC CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
47: #define IOCTL_KEYBOARD_QUERY_INDICATORS CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
48: #define IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0020, METHOD_BUFFERED, FILE_ANY_ACCESS)
49: #define IOCTL_KEYBOARD_INSERT_DATA CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0040, METHOD_BUFFERED, FILE_ANY_ACCESS)
50:
51: //
52: // NtReadFile Output Buffer record structures for this device.
53: //
54:
55: typedef struct _KEYBOARD_INPUT_DATA {
56:
57: //
58: // Unit number. E.g., for \Device\KeyboardPort0 the unit is '0',
59: // for \Device\KeyboardPort1 the unit is '1', and so on.
60: //
61:
62: USHORT UnitId;
63:
64: //
65: // The "make" scan code (key depression).
66: //
67:
68: USHORT MakeCode;
69:
70: //
71: // The flags field indicates a "break" (key release) and other
72: // miscellaneous scan code information defined below.
73: //
74:
75: USHORT Flags;
76:
77: USHORT Reserved;
78:
79: //
80: // Device-specific additional information for the event.
81: //
82:
83: ULONG ExtraInformation;
84:
85: } KEYBOARD_INPUT_DATA, *PKEYBOARD_INPUT_DATA;
86:
87: //
88: // Define the keyboard overrun MakeCode.
89: //
90:
91: #define KEYBOARD_OVERRUN_MAKE_CODE 0xFF
92:
93: //
94: // Define the keyboard input data Flags.
95: //
96:
97: #define KEY_MAKE 0
98: #define KEY_BREAK 1
99: #define KEY_E0 2
100: #define KEY_E1 4
101:
102: //
103: // NtDeviceIoControlFile Input/Output Buffer record structures for
104: // IOCTL_KEYBOARD_QUERY_TYPEMATIC/IOCTL_KEYBOARD_SET_TYPEMATIC.
105: //
106:
107: typedef struct _KEYBOARD_TYPEMATIC_PARAMETERS {
108:
109: //
110: // Unit identifier. Specifies the device unit for which this
111: // request is intended.
112: //
113:
114: USHORT UnitId;
115:
116: //
117: // Typematic rate, in repeats per second.
118: //
119:
120: USHORT Rate;
121:
122: //
123: // Typematic delay, in milliseconds.
124: //
125:
126: USHORT Delay;
127:
128: } KEYBOARD_TYPEMATIC_PARAMETERS, *PKEYBOARD_TYPEMATIC_PARAMETERS;
129:
130: //
131: // NtDeviceIoControlFile OutputBuffer record structures for
132: // IOCTL_KEYBOARD_QUERY_ATTRIBUTES.
133: //
134:
135: typedef struct _KEYBOARD_ID {
136: UCHAR Type; // Keyboard type
137: UCHAR Subtype; // Keyboard subtype (OEM-dependent value)
138: } KEYBOARD_ID, *PKEYBOARD_ID;
139:
140: typedef struct _KEYBOARD_ATTRIBUTES {
141:
142: //
143: // Keyboard ID value. Used to distinguish between keyboard types.
144: //
145:
146: KEYBOARD_ID KeyboardIdentifier;
147:
148: //
149: // Scan code mode.
150: //
151:
152: USHORT KeyboardMode;
153:
154: //
155: // Number of function keys located on the keyboard.
156: //
157:
158: USHORT NumberOfFunctionKeys;
159:
160: //
161: // Number of LEDs located on the keyboard.
162: //
163:
164: USHORT NumberOfIndicators;
165:
166: //
167: // Total number of keys located on the keyboard.
168: //
169:
170: USHORT NumberOfKeysTotal;
171:
172: //
173: // Length of the typeahead buffer, in bytes.
174: //
175:
176: ULONG InputDataQueueLength;
177:
178: //
179: // Minimum allowable values of keyboard typematic rate and delay.
180: //
181:
182: KEYBOARD_TYPEMATIC_PARAMETERS KeyRepeatMinimum;
183:
184: //
185: // Maximum allowable values of keyboard typematic rate and delay.
186: //
187:
188: KEYBOARD_TYPEMATIC_PARAMETERS KeyRepeatMaximum;
189:
190: } KEYBOARD_ATTRIBUTES, *PKEYBOARD_ATTRIBUTES;
191:
192: //
193: // ENHANCED_KEYBOARD() is TRUE if the value for keyboard type indicates an
194: // Enhanced (101- or 102-key) or compatible keyboard. The result is FALSE
195: // if the keyboard is an old-style AT keyboard (83- or 84- or 86-key keyboard).
196: //
197:
198: #define ENHANCED_KEYBOARD(Id) ((Id).Type == 2 || (Id).Type == 4)
199:
200: //
201: // NtDeviceIoControlFile Input/Output Buffer record structures for
202: // IOCTL_KEYBOARD_QUERY_INDICATORS/IOCTL_KEYBOARD_SET_INDICATORS.
203: //
204:
205: typedef struct _KEYBOARD_INDICATOR_PARAMETERS {
206:
207: //
208: // Unit identifier. Specifies the device unit for which this
209: // request is intended.
210: //
211:
212: USHORT UnitId;
213:
214: //
215: // LED indicator state.
216: //
217:
218: USHORT LedFlags;
219:
220: } KEYBOARD_INDICATOR_PARAMETERS, *PKEYBOARD_INDICATOR_PARAMETERS;
221:
222: //
223: // NtDeviceIoControlFile Output Buffer record structures for
224: // IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION.
225: //
226:
227: typedef struct _INDICATOR_LIST {
228:
229: //
230: // The "make" scan code (key depression).
231: //
232:
233: USHORT MakeCode;
234:
235: //
236: // The associated LED indicators.
237: //
238:
239: USHORT IndicatorFlags;
240:
241: } INDICATOR_LIST, *PINDICATOR_LIST;
242:
243: typedef struct _KEYBOARD_INDICATOR_TRANSLATION {
244:
245: //
246: // Number of entries in IndicatorList.
247: //
248:
249: USHORT NumberOfIndicatorKeys;
250:
251: //
252: // List of the scancode-to-indicator mappings.
253: //
254:
255: INDICATOR_LIST IndicatorList[1];
256:
257: } KEYBOARD_INDICATOR_TRANSLATION, *PKEYBOARD_INDICATOR_TRANSLATION;
258:
259: //
260: // Define the keyboard indicators.
261: //
262:
263: #define KEYBOARD_CAPS_LOCK_ON 4
264: #define KEYBOARD_NUM_LOCK_ON 2
265: #define KEYBOARD_SCROLL_LOCK_ON 1
266:
267: //
268: // Generic NtDeviceIoControlFile Input Buffer record structure for
269: // various keyboard IOCTLs.
270: //
271:
272: typedef struct _KEYBOARD_UNIT_ID_PARAMETER {
273:
274: //
275: // Unit identifier. Specifies the device unit for which this
276: // request is intended.
277: //
278:
279: USHORT UnitId;
280:
281: } KEYBOARD_UNIT_ID_PARAMETER, *PKEYBOARD_UNIT_ID_PARAMETER;
282:
283: //
284: // Define the base values for the keyboard error log packet's
285: // UniqueErrorValue field.
286: //
287:
288: #define KEYBOARD_ERROR_VALUE_BASE 10000
289:
290: #endif // _NTDDKBD_
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.