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