OSDN Git Service

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