1 #pragma once 2 3 #define _HIDPI_NO_FUNCTION_MACROS_ 4 #include <ntddk.h> 5 #include <hidclass.h> 6 #include <hidpddi.h> 7 #include <hidpi.h> 8 #define NDEBUG 9 #include <debug.h> 10 #include <kbdmou.h> 11 //#include <kbd.h> 12 #include <ntddkbd.h> 13 #include <debug.h> 14 15 16 typedef struct 17 { 18 // 19 // lower device object 20 // 21 PDEVICE_OBJECT NextDeviceObject; 22 23 // 24 // irp which is used for reading input reports 25 // 26 PIRP Irp; 27 28 // 29 // event 30 // 31 KEVENT ReadCompletionEvent; 32 33 // 34 // device object for class callback 35 // 36 PDEVICE_OBJECT ClassDeviceObject; 37 38 // 39 // class callback 40 // 41 PVOID ClassService; 42 43 // 44 // buffer for the four usage lists below 45 // 46 PVOID UsageListBuffer; 47 48 // 49 // usage list length 50 // 51 USHORT UsageListLength; 52 53 // 54 // current usage list length 55 // 56 PUSAGE_AND_PAGE CurrentUsageList; 57 58 // 59 // previous usage list 60 // 61 PUSAGE_AND_PAGE PreviousUsageList; 62 63 // 64 // removed usage item list 65 // 66 PUSAGE_AND_PAGE BreakUsageList; 67 68 // 69 // new item usage list 70 // 71 PUSAGE_AND_PAGE MakeUsageList; 72 73 // 74 // preparsed data 75 // 76 PHIDP_PREPARSED_DATA PreparsedData; 77 78 // 79 // mdl for reading input report 80 // 81 PMDL ReportMDL; 82 83 // 84 // input report buffer 85 // 86 PCHAR Report; 87 88 // 89 // input report length 90 // 91 ULONG ReportLength; 92 93 // 94 // file object the device is reading reports from 95 // 96 PFILE_OBJECT FileObject; 97 98 // 99 // report read is active 100 // 101 UCHAR ReadReportActive; 102 103 // 104 // stop reading flag 105 // 106 UCHAR StopReadReport; 107 108 // 109 // keyboard attributes 110 // 111 KEYBOARD_ATTRIBUTES Attributes; 112 113 // 114 // keyboard modifier state 115 // 116 HIDP_KEYBOARD_MODIFIER_STATE ModifierState; 117 118 // 119 // keyboard indicator state 120 // 121 KEYBOARD_INDICATOR_PARAMETERS KeyboardIndicator; 122 123 // 124 // keyboard type matic 125 // 126 KEYBOARD_TYPEMATIC_PARAMETERS KeyboardTypematic; 127 128 } KBDHID_DEVICE_EXTENSION, *PKBDHID_DEVICE_EXTENSION; 129 130 /* defaults from kbfiltr.h */ 131 #define KEYBOARD_TYPEMATIC_RATE_MINIMUM 2 132 #define KEYBOARD_TYPEMATIC_RATE_MAXIMUM 30 133 #define KEYBOARD_TYPEMATIC_RATE_DEFAULT 30 134 #define KEYBOARD_TYPEMATIC_DELAY_MINIMUM 250 135 #define KEYBOARD_TYPEMATIC_DELAY_MAXIMUM 1000 136 #define KEYBOARD_TYPEMATIC_DELAY_DEFAULT 250 137 138 /* FIXME: write kbd.h */ 139 #define MICROSOFT_KBD_FUNC 12 140 #define KEYBOARD_TYPE_UNKNOWN (0x51) 141 #define MICROSOFT_KBD_101_TYPE 0 142 143 144 NTSTATUS 145 KbdHid_InitiateRead( 146 IN PKBDHID_DEVICE_EXTENSION DeviceExtension); 147 148 #define KBDHID_TAG 'diHK' 149