Naveen Neel / shedskin
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ntddkbd.h Source File

ntddkbd.h

00001 /*
00002  * ntddkbd.h
00003  *
00004  * Keyboard IOCTL interface
00005  *
00006  * This file is part of the w32api package.
00007  *
00008  * Contributors:
00009  *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
00010  *
00011  * THIS SOFTWARE IS NOT COPYRIGHTED
00012  *
00013  * This source code is offered for use in the public domain. You may
00014  * use, modify or distribute it freely.
00015  *
00016  * This code is distributed in the hope that it will be useful but
00017  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
00018  * DISCLAIMED. This includes but is not limited to warranties of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00020  *
00021  */
00022 
00023 #ifndef __NTDDKBD_H
00024 #define __NTDDKBD_H
00025 
00026 #if __GNUC__ >=3
00027 #pragma GCC system_header
00028 #endif
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00034 #include "ntddk.h"
00035 
00036 #define DD_KEYBOARD_DEVICE_NAME           "\\Device\\KeyboardClass"
00037 #define DD_KEYBOARD_DEVICE_NAME_U         L"\\Device\\KeyboardClass"
00038 
00039 #define IOCTL_KEYBOARD_QUERY_ATTRIBUTES \
00040   CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS)
00041 
00042 #define IOCTL_KEYBOARD_QUERY_INDICATORS \
00043   CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
00044 
00045 #define IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION \
00046   CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0020, METHOD_BUFFERED, FILE_ANY_ACCESS)
00047 
00048 #define IOCTL_KEYBOARD_QUERY_TYPEMATIC \
00049   CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
00050 
00051 #define IOCTL_KEYBOARD_SET_TYPEMATIC \
00052   CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0001, METHOD_BUFFERED, FILE_ANY_ACCESS)
00053 
00054 #define IOCTL_KEYBOARD_SET_INDICATORS \
00055   CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0002, METHOD_BUFFERED, FILE_ANY_ACCESS)
00056 
00057 
00058 DEFINE_GUID(GUID_DEVINTERFACE_KEYBOARD, \
00059   0x884b96c3, 0x56ef, 0x11d1, 0xbc, 0x8c, 0x00, 0xa0, 0xc9, 0x14, 0x05, 0xdd);
00060 
00061 #define KEYBOARD_ERROR_VALUE_BASE         10000
00062 
00063 /* KEYBOARD_INPUT_DATA.MakeCode constants */
00064 #define KEYBOARD_OVERRUN_MAKE_CODE        0xFF
00065 
00066 /* KEYBOARD_INPUT_DATA.Flags constants */
00067 #define KEY_MAKE                          0
00068 #define KEY_BREAK                         1
00069 #define KEY_E0                            2
00070 #define KEY_E1                            4
00071 
00072 typedef struct _KEYBOARD_INPUT_DATA {
00073   USHORT  UnitId;
00074   USHORT  MakeCode;
00075   USHORT  Flags;
00076   USHORT  Reserved;
00077   ULONG  ExtraInformation;
00078 } KEYBOARD_INPUT_DATA, *PKEYBOARD_INPUT_DATA;
00079 
00080 
00081 typedef struct _KEYBOARD_TYPEMATIC_PARAMETERS {
00082     USHORT  UnitId;
00083     USHORT  Rate;
00084     USHORT  Delay;
00085 } KEYBOARD_TYPEMATIC_PARAMETERS, *PKEYBOARD_TYPEMATIC_PARAMETERS;
00086 
00087 typedef struct _KEYBOARD_ID {
00088     UCHAR  Type;
00089     UCHAR  Subtype;
00090 } KEYBOARD_ID, *PKEYBOARD_ID;
00091 
00092 #define ENHANCED_KEYBOARD(Id) ((Id).Type == 2 || (Id).Type == 4 || FAREAST_KEYBOARD(Id))
00093 #define FAREAST_KEYBOARD(Id)  ((Id).Type == 7 || (Id).Type == 8)
00094 
00095 typedef struct _KEYBOARD_INDICATOR_PARAMETERS {
00096   USHORT  UnitId;
00097   USHORT  LedFlags;
00098 } KEYBOARD_INDICATOR_PARAMETERS, *PKEYBOARD_INDICATOR_PARAMETERS;
00099 
00100 typedef struct _INDICATOR_LIST {
00101   USHORT  MakeCode;
00102   USHORT  IndicatorFlags;
00103 } INDICATOR_LIST, *PINDICATOR_LIST;
00104 
00105 typedef struct _KEYBOARD_INDICATOR_TRANSLATION {
00106   USHORT  NumberOfIndicatorKeys;
00107   INDICATOR_LIST  IndicatorList[1];
00108 } KEYBOARD_INDICATOR_TRANSLATION, *PKEYBOARD_INDICATOR_TRANSLATION;
00109 
00110 typedef struct _KEYBOARD_ATTRIBUTES {
00111     KEYBOARD_ID  KeyboardIdentifier;
00112     USHORT  KeyboardMode;
00113     USHORT  NumberOfFunctionKeys;
00114     USHORT  NumberOfIndicators;
00115     USHORT  NumberOfKeysTotal;
00116     ULONG  InputDataQueueLength;
00117     KEYBOARD_TYPEMATIC_PARAMETERS  KeyRepeatMinimum;
00118     KEYBOARD_TYPEMATIC_PARAMETERS  KeyRepeatMaximum;
00119 } KEYBOARD_ATTRIBUTES, *PKEYBOARD_ATTRIBUTES;
00120 
00121 typedef struct _KEYBOARD_UNIT_ID_PARAMETER {
00122   USHORT  UnitId;
00123 } KEYBOARD_UNIT_ID_PARAMETER, *PKEYBOARD_UNIT_ID_PARAMETER;
00124 
00125 typedef struct _KEYBOARD_IME_STATUS {
00126     USHORT  UnitId;
00127     ULONG  ImeOpen;
00128     ULONG  ImeConvMode;
00129 } KEYBOARD_IME_STATUS, *PKEYBOARD_IME_STATUS;
00130 
00131 #ifdef __cplusplus
00132 }
00133 #endif
00134 
00135 #endif /* __NTDDKBD_H */