- Fix KiDispatchException to unmask KI_EXCEPTION_INTERNAL when setting the exception...
[reactos.git] / reactos / 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 #if __GNUC__ >=3
27 #pragma GCC system_header
28 #endif
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 #define DD_KEYBOARD_DEVICE_NAME "\\Device\\KeyboardClass"
35 #define DD_KEYBOARD_DEVICE_NAME_U L"\\Device\\KeyboardClass"
36
37 #define IOCTL_KEYBOARD_QUERY_ATTRIBUTES \
38 CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS)
39
40 #define IOCTL_KEYBOARD_QUERY_INDICATORS \
41 CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
42
43 #define IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION \
44 CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0020, METHOD_BUFFERED, FILE_ANY_ACCESS)
45
46 #define IOCTL_KEYBOARD_QUERY_TYPEMATIC \
47 CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
48
49 #define IOCTL_KEYBOARD_SET_TYPEMATIC \
50 CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0001, METHOD_BUFFERED, FILE_ANY_ACCESS)
51
52 #define IOCTL_KEYBOARD_SET_INDICATORS \
53 CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0002, METHOD_BUFFERED, FILE_ANY_ACCESS)
54
55
56 DEFINE_GUID(GUID_DEVINTERFACE_KEYBOARD, \
57 0x884b96c3, 0x56ef, 0x11d1, 0xbc, 0x8c, 0x00, 0xa0, 0xc9, 0x14, 0x05, 0xdd);
58
59 #define KEYBOARD_ERROR_VALUE_BASE 10000
60
61 /* KEYBOARD_INPUT_DATA.MakeCode constants */
62 #define KEYBOARD_OVERRUN_MAKE_CODE 0xFF
63
64 /* KEYBOARD_INPUT_DATA.Flags constants */
65 #define KEY_MAKE 0
66 #define KEY_BREAK 1
67 #define KEY_E0 2
68 #define KEY_E1 4
69
70 typedef struct _KEYBOARD_INPUT_DATA {
71 USHORT UnitId;
72 USHORT MakeCode;
73 USHORT Flags;
74 USHORT Reserved;
75 ULONG ExtraInformation;
76 } KEYBOARD_INPUT_DATA, *PKEYBOARD_INPUT_DATA;
77
78
79 typedef struct _KEYBOARD_TYPEMATIC_PARAMETERS {
80 USHORT UnitId;
81 USHORT Rate;
82 USHORT Delay;
83 } KEYBOARD_TYPEMATIC_PARAMETERS, *PKEYBOARD_TYPEMATIC_PARAMETERS;
84
85 typedef struct _KEYBOARD_ID {
86 UCHAR Type;
87 UCHAR Subtype;
88 } KEYBOARD_ID, *PKEYBOARD_ID;
89
90 #define ENHANCED_KEYBOARD(Id) ((Id).Type == 2 || (Id).Type == 4 || FAREAST_KEYBOARD(Id))
91 #define FAREAST_KEYBOARD(Id) ((Id).Type == 7 || (Id).Type == 8)
92
93 typedef struct _KEYBOARD_INDICATOR_PARAMETERS {
94 USHORT UnitId;
95 USHORT LedFlags;
96 } KEYBOARD_INDICATOR_PARAMETERS, *PKEYBOARD_INDICATOR_PARAMETERS;
97
98 typedef struct _INDICATOR_LIST {
99 USHORT MakeCode;
100 USHORT IndicatorFlags;
101 } INDICATOR_LIST, *PINDICATOR_LIST;
102
103 typedef struct _KEYBOARD_INDICATOR_TRANSLATION {
104 USHORT NumberOfIndicatorKeys;
105 INDICATOR_LIST IndicatorList[1];
106 } KEYBOARD_INDICATOR_TRANSLATION, *PKEYBOARD_INDICATOR_TRANSLATION;
107
108 typedef struct _KEYBOARD_ATTRIBUTES {
109 KEYBOARD_ID KeyboardIdentifier;
110 USHORT KeyboardMode;
111 USHORT NumberOfFunctionKeys;
112 USHORT NumberOfIndicators;
113 USHORT NumberOfKeysTotal;
114 ULONG InputDataQueueLength;
115 KEYBOARD_TYPEMATIC_PARAMETERS KeyRepeatMinimum;
116 KEYBOARD_TYPEMATIC_PARAMETERS KeyRepeatMaximum;
117 } KEYBOARD_ATTRIBUTES, *PKEYBOARD_ATTRIBUTES;
118
119 typedef struct _KEYBOARD_UNIT_ID_PARAMETER {
120 USHORT UnitId;
121 } KEYBOARD_UNIT_ID_PARAMETER, *PKEYBOARD_UNIT_ID_PARAMETER;
122
123 typedef struct _KEYBOARD_IME_STATUS {
124 USHORT UnitId;
125 ULONG ImeOpen;
126 ULONG ImeConvMode;
127 } KEYBOARD_IME_STATUS, *PKEYBOARD_IME_STATUS;
128
129 #ifdef __cplusplus
130 }
131 #endif
132
133 #endif /* __NTDDKBD_H */