1 #pragma once 2 3 #define _HIDPI_ 4 #define _HIDPI_NO_FUNCTION_MACROS_ 5 #define NDEBUG 6 #include <ntddk.h> 7 #include <hidport.h> 8 #include <debug.h> 9 #include <hubbusif.h> 10 #include <usbbusif.h> 11 #include <usbioctl.h> 12 #include <usb.h> 13 #include <usbdlib.h> 14 15 #include <hidport.h> 16 17 typedef struct 18 { 19 // 20 // event for completion 21 // 22 KEVENT Event; 23 24 // 25 // device descriptor 26 // 27 PUSB_DEVICE_DESCRIPTOR DeviceDescriptor; 28 29 // 30 // configuration descriptor 31 // 32 PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor; 33 34 // 35 // interface information 36 // 37 PUSBD_INTERFACE_INFORMATION InterfaceInfo; 38 39 // 40 // configuration handle 41 // 42 USBD_CONFIGURATION_HANDLE ConfigurationHandle; 43 44 // 45 // hid descriptor 46 // 47 PHID_DESCRIPTOR HidDescriptor; 48 49 } HID_USB_DEVICE_EXTENSION, *PHID_USB_DEVICE_EXTENSION; 50 51 typedef struct 52 { 53 // 54 // request irp 55 // 56 PIRP Irp; 57 58 // 59 // work item 60 // 61 PIO_WORKITEM WorkItem; 62 63 // 64 // device object 65 // 66 PDEVICE_OBJECT DeviceObject; 67 68 } HID_USB_RESET_CONTEXT, *PHID_USB_RESET_CONTEXT; 69 70 71 NTSTATUS 72 Hid_GetDescriptor( 73 IN PDEVICE_OBJECT DeviceObject, 74 IN USHORT UrbFunction, 75 IN USHORT UrbLength, 76 IN OUT PVOID *UrbBuffer, 77 IN OUT PULONG UrbBufferLength, 78 IN UCHAR DescriptorType, 79 IN UCHAR Index, 80 IN USHORT LanguageIndex); 81 82 NTSTATUS 83 Hid_DispatchUrb( 84 IN PDEVICE_OBJECT DeviceObject, 85 IN PURB Urb); 86 87 #define USB_SET_IDLE_REQUEST 0xA 88 #define USB_GET_PROTOCOL_REQUEST 0x3 89 90 #define HIDUSB_TAG 'UdiH' 91 #define HIDUSB_URB_TAG 'rUiH' 92