OSDN Git Service

Redo the filters based on assumptions discussed in mingw-dvlpr list.
[mingw/mingw-org-wsl.git] / include / ddk / ntddkbd.h
1 /**
2  * @file ntddkbd.h
3  * @copy 2012 MinGW.org project
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  * 
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  * 
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 #ifndef __NTDDKBD_H
25 #define __NTDDKBD_H
26 #pragma GCC system_header
27 #include <_mingw.h>
28
29 /*
30  * Keyboard IOCTL interface
31  */
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 #include "ntddk.h"
38
39 #define DD_KEYBOARD_DEVICE_NAME           "\\Device\\KeyboardClass"
40 #define DD_KEYBOARD_DEVICE_NAME_U         L"\\Device\\KeyboardClass"
41
42 #define IOCTL_KEYBOARD_QUERY_ATTRIBUTES \
43   CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS)
44
45 #define IOCTL_KEYBOARD_QUERY_INDICATORS \
46   CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
47
48 #define IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION \
49   CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0020, METHOD_BUFFERED, FILE_ANY_ACCESS)
50
51 #define IOCTL_KEYBOARD_QUERY_TYPEMATIC \
52   CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
53
54 #define IOCTL_KEYBOARD_SET_TYPEMATIC \
55   CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0001, METHOD_BUFFERED, FILE_ANY_ACCESS)
56
57 #define IOCTL_KEYBOARD_SET_INDICATORS \
58   CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0002, METHOD_BUFFERED, FILE_ANY_ACCESS)
59
60
61 DEFINE_GUID(GUID_DEVINTERFACE_KEYBOARD, \
62   0x884b96c3, 0x56ef, 0x11d1, 0xbc, 0x8c, 0x00, 0xa0, 0xc9, 0x14, 0x05, 0xdd);
63
64 #define KEYBOARD_ERROR_VALUE_BASE         10000
65
66 /* KEYBOARD_INPUT_DATA.MakeCode constants */
67 #define KEYBOARD_OVERRUN_MAKE_CODE        0xFF
68
69 /* KEYBOARD_INPUT_DATA.Flags constants */
70 #define KEY_MAKE                          0
71 #define KEY_BREAK                         1
72 #define KEY_E0                            2
73 #define KEY_E1                            4
74
75 typedef struct _KEYBOARD_INPUT_DATA {
76   USHORT  UnitId;
77   USHORT  MakeCode;
78   USHORT  Flags;
79   USHORT  Reserved;
80   ULONG  ExtraInformation;
81 } KEYBOARD_INPUT_DATA, *PKEYBOARD_INPUT_DATA;
82
83
84 typedef struct _KEYBOARD_TYPEMATIC_PARAMETERS {
85         USHORT  UnitId;
86         USHORT  Rate;
87         USHORT  Delay;
88 } KEYBOARD_TYPEMATIC_PARAMETERS, *PKEYBOARD_TYPEMATIC_PARAMETERS;
89
90 typedef struct _KEYBOARD_ID {
91         UCHAR  Type;
92         UCHAR  Subtype;
93 } KEYBOARD_ID, *PKEYBOARD_ID;
94
95 #define ENHANCED_KEYBOARD(Id) ((Id).Type == 2 || (Id).Type == 4 || FAREAST_KEYBOARD(Id))
96 #define FAREAST_KEYBOARD(Id)  ((Id).Type == 7 || (Id).Type == 8)
97
98 typedef struct _KEYBOARD_INDICATOR_PARAMETERS {
99   USHORT  UnitId;
100   USHORT  LedFlags;
101 } KEYBOARD_INDICATOR_PARAMETERS, *PKEYBOARD_INDICATOR_PARAMETERS;
102
103 typedef struct _INDICATOR_LIST {
104   USHORT  MakeCode;
105   USHORT  IndicatorFlags;
106 } INDICATOR_LIST, *PINDICATOR_LIST;
107
108 typedef struct _KEYBOARD_INDICATOR_TRANSLATION {
109   USHORT  NumberOfIndicatorKeys;
110   INDICATOR_LIST  IndicatorList[1];
111 } KEYBOARD_INDICATOR_TRANSLATION, *PKEYBOARD_INDICATOR_TRANSLATION;
112
113 typedef struct _KEYBOARD_ATTRIBUTES {
114         KEYBOARD_ID  KeyboardIdentifier;
115         USHORT  KeyboardMode;
116         USHORT  NumberOfFunctionKeys;
117         USHORT  NumberOfIndicators;
118         USHORT  NumberOfKeysTotal;
119         ULONG  InputDataQueueLength;
120         KEYBOARD_TYPEMATIC_PARAMETERS  KeyRepeatMinimum;
121         KEYBOARD_TYPEMATIC_PARAMETERS  KeyRepeatMaximum;
122 } KEYBOARD_ATTRIBUTES, *PKEYBOARD_ATTRIBUTES;
123
124 typedef struct _KEYBOARD_UNIT_ID_PARAMETER {
125   USHORT  UnitId;
126 } KEYBOARD_UNIT_ID_PARAMETER, *PKEYBOARD_UNIT_ID_PARAMETER;
127
128 typedef struct _KEYBOARD_IME_STATUS {
129         USHORT  UnitId;
130         ULONG  ImeOpen;
131         ULONG  ImeConvMode;
132 } KEYBOARD_IME_STATUS, *PKEYBOARD_IME_STATUS;
133
134 #ifdef __cplusplus
135 }
136 #endif
137
138 #endif /* __NTDDKBD_H */