VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/i8042prt/include/ntddkbd.h@ 16684

Last change on this file since 16684 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.3 KB
Line 
1/*++ BUILD Version: 0001 // Increment this if a change has global effects
2
3Copyright (c) Microsoft Corporation. All rights reserved.
4
5Module Name:
6
7 ntddkbd.h
8
9Abstract:
10
11 This is the include file that defines all constants and types for
12 accessing the keyboard device.
13
14Author:
15
16 Lee A. Smith (lees) 02-Aug-1991.
17
18Revision History:
19
20--*/
21
22#ifndef _NTDDKBD_
23#define _NTDDKBD_
24
25#if _MSC_VER > 1000
26#pragma once
27#endif
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33//
34// Device Name - this string is the name of the device. It is the name
35// that should be passed to NtOpenFile when accessing the device.
36//
37// Note: For devices that support multiple units, it should be suffixed
38// with the Ascii representation of the unit number.
39//
40
41#define DD_KEYBOARD_DEVICE_NAME "\\Device\\KeyboardClass"
42#define DD_KEYBOARD_DEVICE_NAME_U L"\\Device\\KeyboardClass"
43
44//
45// NtDeviceIoControlFile IoControlCode values for this device.
46//
47// Warning: Remember that the low two bits of the code specify how the
48// buffers are passed to the driver!
49//
50
51#define IOCTL_KEYBOARD_QUERY_ATTRIBUTES CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS)
52#define IOCTL_KEYBOARD_SET_TYPEMATIC CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0001, METHOD_BUFFERED, FILE_ANY_ACCESS)
53#define IOCTL_KEYBOARD_SET_INDICATORS CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0002, METHOD_BUFFERED, FILE_ANY_ACCESS)
54#define IOCTL_KEYBOARD_QUERY_TYPEMATIC CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
55#define IOCTL_KEYBOARD_QUERY_INDICATORS CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
56#define IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0020, METHOD_BUFFERED, FILE_ANY_ACCESS)
57#define IOCTL_KEYBOARD_INSERT_DATA CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0040, METHOD_BUFFERED, FILE_ANY_ACCESS)
58
59//
60// These Device IO control query/set IME status to keyboard hardware.
61//
62#define IOCTL_KEYBOARD_QUERY_IME_STATUS CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0400, METHOD_BUFFERED, FILE_ANY_ACCESS)
63#define IOCTL_KEYBOARD_SET_IME_STATUS CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0401, METHOD_BUFFERED, FILE_ANY_ACCESS)
64
65//
66// Declare the GUID that represents the device interface for keyboards.
67//
68#ifndef FAR
69#define FAR
70#endif
71
72DEFINE_GUID( GUID_DEVINTERFACE_KEYBOARD, 0x884b96c3, 0x56ef, 0x11d1, \
73 0xbc, 0x8c, 0x00, 0xa0, 0xc9, 0x14, 0x05, 0xdd);
74
75//
76// Obsolete device interface class GUID name.
77// (use of above GUID_DEVINTERFACE_* name is recommended).
78//
79
80#define GUID_CLASS_KEYBOARD GUID_DEVINTERFACE_KEYBOARD
81
82
83//
84// NtReadFile Output Buffer record structures for this device.
85//
86
87typedef struct _KEYBOARD_INPUT_DATA {
88
89 //
90 // Unit number. E.g., for \Device\KeyboardPort0 the unit is '0',
91 // for \Device\KeyboardPort1 the unit is '1', and so on.
92 //
93
94 USHORT UnitId;
95
96 //
97 // The "make" scan code (key depression).
98 //
99
100 USHORT MakeCode;
101
102 //
103 // The flags field indicates a "break" (key release) and other
104 // miscellaneous scan code information defined below.
105 //
106
107 USHORT Flags;
108
109 USHORT Reserved;
110
111 //
112 // Device-specific additional information for the event.
113 //
114
115 ULONG ExtraInformation;
116
117} KEYBOARD_INPUT_DATA, *PKEYBOARD_INPUT_DATA;
118
119//
120// Define the keyboard overrun MakeCode.
121//
122
123#define KEYBOARD_OVERRUN_MAKE_CODE 0xFF
124
125//
126// Define the keyboard input data Flags.
127//
128
129#define KEY_MAKE 0
130#define KEY_BREAK 1
131#define KEY_E0 2
132#define KEY_E1 4
133#define KEY_TERMSRV_SET_LED 8
134#define KEY_TERMSRV_SHADOW 0x10
135#define KEY_TERMSRV_VKPACKET 0x20
136
137
138//
139// NtDeviceIoControlFile Input/Output Buffer record structures for
140// IOCTL_KEYBOARD_QUERY_TYPEMATIC/IOCTL_KEYBOARD_SET_TYPEMATIC.
141//
142
143typedef struct _KEYBOARD_TYPEMATIC_PARAMETERS {
144
145 //
146 // Unit identifier. Specifies the device unit for which this
147 // request is intended.
148 //
149
150 USHORT UnitId;
151
152 //
153 // Typematic rate, in repeats per second.
154 //
155
156 USHORT Rate;
157
158 //
159 // Typematic delay, in milliseconds.
160 //
161
162 USHORT Delay;
163
164} KEYBOARD_TYPEMATIC_PARAMETERS, *PKEYBOARD_TYPEMATIC_PARAMETERS;
165
166//
167// NtDeviceIoControlFile OutputBuffer record structures for
168// IOCTL_KEYBOARD_QUERY_ATTRIBUTES.
169//
170
171typedef struct _KEYBOARD_ID {
172 UCHAR Type; // Keyboard type
173 UCHAR Subtype; // Keyboard subtype (OEM-dependent value)
174} KEYBOARD_ID, *PKEYBOARD_ID;
175
176typedef struct _KEYBOARD_ATTRIBUTES {
177
178 //
179 // Keyboard ID value. Used to distinguish between keyboard types.
180 //
181
182 KEYBOARD_ID KeyboardIdentifier;
183
184 //
185 // Scan code mode.
186 //
187
188 USHORT KeyboardMode;
189
190 //
191 // Number of function keys located on the keyboard.
192 //
193
194 USHORT NumberOfFunctionKeys;
195
196 //
197 // Number of LEDs located on the keyboard.
198 //
199
200 USHORT NumberOfIndicators;
201
202 //
203 // Total number of keys located on the keyboard.
204 //
205
206 USHORT NumberOfKeysTotal;
207
208 //
209 // Length of the typeahead buffer, in bytes.
210 //
211
212 ULONG InputDataQueueLength;
213
214 //
215 // Minimum allowable values of keyboard typematic rate and delay.
216 //
217
218 KEYBOARD_TYPEMATIC_PARAMETERS KeyRepeatMinimum;
219
220 //
221 // Maximum allowable values of keyboard typematic rate and delay.
222 //
223
224 KEYBOARD_TYPEMATIC_PARAMETERS KeyRepeatMaximum;
225
226} KEYBOARD_ATTRIBUTES, *PKEYBOARD_ATTRIBUTES;
227
228//
229// ENHANCED_KEYBOARD() is TRUE if the value for keyboard type indicates an
230// Enhanced (101- or 102-key) or compatible keyboard. The result is FALSE
231// if the keyboard is an old-style AT keyboard (83- or 84- or 86-key keyboard).
232//
233#define ENHANCED_KEYBOARD(Id) ((Id).Type == 2 || (Id).Type == 4 || FAREAST_KEYBOARD(Id))
234//
235// Japanese keyboard(7) and Korean keyboard(8) are also Enhanced (101-)
236// or compatible keyboard.
237//
238#define FAREAST_KEYBOARD(Id) ((Id).Type == 7 || (Id).Type == 8)
239
240//
241// NtDeviceIoControlFile Input/Output Buffer record structures for
242// IOCTL_KEYBOARD_QUERY_INDICATORS/IOCTL_KEYBOARD_SET_INDICATORS.
243//
244
245typedef struct _KEYBOARD_INDICATOR_PARAMETERS {
246
247 //
248 // Unit identifier. Specifies the device unit for which this
249 // request is intended.
250 //
251
252 USHORT UnitId;
253
254 //
255 // LED indicator state.
256 //
257
258 USHORT LedFlags;
259
260} KEYBOARD_INDICATOR_PARAMETERS, *PKEYBOARD_INDICATOR_PARAMETERS;
261
262//
263// NtDeviceIoControlFile Output Buffer record structures for
264// IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION.
265//
266
267typedef struct _INDICATOR_LIST {
268
269 //
270 // The "make" scan code (key depression).
271 //
272
273 USHORT MakeCode;
274
275 //
276 // The associated LED indicators.
277 //
278
279 USHORT IndicatorFlags;
280
281} INDICATOR_LIST, *PINDICATOR_LIST;
282
283typedef struct _KEYBOARD_INDICATOR_TRANSLATION {
284
285 //
286 // Number of entries in IndicatorList.
287 //
288
289 USHORT NumberOfIndicatorKeys;
290
291 //
292 // List of the scancode-to-indicator mappings.
293 //
294
295 INDICATOR_LIST IndicatorList[1];
296
297} KEYBOARD_INDICATOR_TRANSLATION, *PKEYBOARD_INDICATOR_TRANSLATION;
298
299//
300// Define the keyboard indicators.
301//
302
303#define KEYBOARD_LED_INJECTED 0x8000 //Used by Terminal Server
304#define KEYBOARD_SHADOW 0x4000 //Used by Terminal Server
305//#if defined(FE_SB) || defined(WINDOWS_FE) || defined(DBCS)
306#define KEYBOARD_KANA_LOCK_ON 8 // Japanese keyboard
307//#endif // defined(FE_SB) || defined(WINDOWS_FE) || defined(DBCS)
308#define KEYBOARD_CAPS_LOCK_ON 4
309#define KEYBOARD_NUM_LOCK_ON 2
310#define KEYBOARD_SCROLL_LOCK_ON 1
311
312//
313// Generic NtDeviceIoControlFile Input Buffer record structure for
314// various keyboard IOCTLs.
315//
316
317typedef struct _KEYBOARD_UNIT_ID_PARAMETER {
318
319 //
320 // Unit identifier. Specifies the device unit for which this
321 // request is intended.
322 //
323
324 USHORT UnitId;
325
326} KEYBOARD_UNIT_ID_PARAMETER, *PKEYBOARD_UNIT_ID_PARAMETER;
327
328//
329// Define the base values for the keyboard error log packet's
330// UniqueErrorValue field.
331//
332
333#define KEYBOARD_ERROR_VALUE_BASE 10000
334
335//
336// NtDeviceIoControlFile Input/Output Buffer record structures for
337// IOCTL_KEYBOARD_QUERY_IME_STATUS/IOCTL_KEYBOARD_SET_IME_STATUS.
338//
339
340typedef struct _KEYBOARD_IME_STATUS {
341
342 //
343 // Unit identifier. Specifies the device unit for which this
344 // request is intended.
345 //
346
347 USHORT UnitId;
348
349 //
350 // Ime open or close status.
351 //
352 ULONG ImeOpen;
353
354 //
355 // Ime conversion status.
356 //
357 ULONG ImeConvMode;
358
359} KEYBOARD_IME_STATUS, *PKEYBOARD_IME_STATUS;
360
361#ifdef __cplusplus
362}
363#endif
364
365#endif // _NTDDKBD_
366
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette