[BATTC]
[reactos.git] / include / ddk / 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 typedef struct _KEYBOARD_INPUT_DATA {
67 USHORT UnitId;
68 USHORT MakeCode;
69 USHORT Flags;
70 USHORT Reserved;
71 ULONG ExtraInformation;
72 } KEYBOARD_INPUT_DATA, *PKEYBOARD_INPUT_DATA;
73
74
75 typedef struct _KEYBOARD_TYPEMATIC_PARAMETERS {
76 USHORT UnitId;
77 USHORT Rate;
78 USHORT Delay;
79 } KEYBOARD_TYPEMATIC_PARAMETERS, *PKEYBOARD_TYPEMATIC_PARAMETERS;
80
81 typedef struct _KEYBOARD_ID {
82 UCHAR Type;
83 UCHAR Subtype;
84 } KEYBOARD_ID, *PKEYBOARD_ID;
85
86 #define ENHANCED_KEYBOARD(Id) ((Id).Type == 2 || (Id).Type == 4 || FAREAST_KEYBOARD(Id))
87 #define FAREAST_KEYBOARD(Id) ((Id).Type == 7 || (Id).Type == 8)
88
89 typedef struct _KEYBOARD_INDICATOR_PARAMETERS {
90 USHORT UnitId;
91 USHORT LedFlags;
92 } KEYBOARD_INDICATOR_PARAMETERS, *PKEYBOARD_INDICATOR_PARAMETERS;
93
94 typedef struct _INDICATOR_LIST {
95 USHORT MakeCode;
96 USHORT IndicatorFlags;
97 } INDICATOR_LIST, *PINDICATOR_LIST;
98
99 typedef struct _KEYBOARD_INDICATOR_TRANSLATION {
100 USHORT NumberOfIndicatorKeys;
101 INDICATOR_LIST IndicatorList[1];
102 } KEYBOARD_INDICATOR_TRANSLATION, *PKEYBOARD_INDICATOR_TRANSLATION;
103
104 typedef struct _KEYBOARD_ATTRIBUTES {
105 KEYBOARD_ID KeyboardIdentifier;
106 USHORT KeyboardMode;
107 USHORT NumberOfFunctionKeys;
108 USHORT NumberOfIndicators;
109 USHORT NumberOfKeysTotal;
110 ULONG InputDataQueueLength;
111 KEYBOARD_TYPEMATIC_PARAMETERS KeyRepeatMinimum;
112 KEYBOARD_TYPEMATIC_PARAMETERS KeyRepeatMaximum;
113 } KEYBOARD_ATTRIBUTES, *PKEYBOARD_ATTRIBUTES;
114
115 typedef struct _KEYBOARD_UNIT_ID_PARAMETER {
116 USHORT UnitId;
117 } KEYBOARD_UNIT_ID_PARAMETER, *PKEYBOARD_UNIT_ID_PARAMETER;
118
119 typedef struct _KEYBOARD_IME_STATUS {
120 USHORT UnitId;
121 ULONG ImeOpen;
122 ULONG ImeConvMode;
123 } KEYBOARD_IME_STATUS, *PKEYBOARD_IME_STATUS;
124
125 #ifdef __cplusplus
126 }
127 #endif
128
129 #endif /* __NTDDKBD_H */