Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

217 lines
5.4 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. hidmini.h
  5. Abstract
  6. Definitions that are common to all HID minidrivers.
  7. Authors:
  8. Forrest Foltz
  9. Ervin Peretz
  10. Environment:
  11. Kernel mode only
  12. Revision History:
  13. --*/
  14. #ifndef __HIDPORT_H__
  15. #define __HIDPORT_H__
  16. #include <hidclass.h>
  17. //
  18. // HID_MINIDRIVER_REGISTRATION is a packet of information describing the
  19. // HID minidriver to the class driver. It must be filled in by the minidriver
  20. // and passed to the class driver via HidRegisterMinidriver() from the
  21. // minidriver's DriverEntry() routine.
  22. //
  23. typedef struct _HID_MINIDRIVER_REGISTRATION {
  24. //
  25. // Revision must be set to HID_REVISION by the minidriver
  26. //
  27. ULONG Revision;
  28. //
  29. // DriverObject is a pointer to the minidriver's DriverObject that it
  30. // received as a DriverEntry() parameter.
  31. //
  32. PDRIVER_OBJECT DriverObject;
  33. //
  34. // RegistryPath is a pointer to the minidriver's RegistryPath that it
  35. // received as a DriverEntry() parameter.
  36. //
  37. PUNICODE_STRING RegistryPath;
  38. //
  39. // DeviceExtensionSize is the size of the minidriver's per-device
  40. // extension.
  41. //
  42. ULONG DeviceExtensionSize;
  43. //
  44. // Either all or none of the devices driven by a given minidriver are polled.
  45. //
  46. BOOLEAN DevicesArePolled;
  47. UCHAR Reserved[3];
  48. } HID_MINIDRIVER_REGISTRATION, *PHID_MINIDRIVER_REGISTRATION;
  49. //
  50. // HID_DEVICE_EXTENSION is the public part of the device extension of a HID
  51. // functional device object.
  52. //
  53. typedef struct _HID_DEVICE_EXTENSION {
  54. //
  55. // PhysicalDeviceObject... normally IRPs are not passed to this.
  56. //
  57. PDEVICE_OBJECT PhysicalDeviceObject;
  58. //
  59. // NextDeviceObject... IRPs are sent here by the minidriver. Note that
  60. // NextDeviceObject and PhysicalDeviceObject are the same unless someone
  61. // has inserted a 'filter' device object, in which case they are not the
  62. // same. Sending IRPs to NextDeviceObject will hit the filter device
  63. // objects on the way down.
  64. //
  65. PDEVICE_OBJECT NextDeviceObject;
  66. //
  67. // MiniDeviceExtension is the per-device extension area for use by
  68. // the minidriver. It's size is determined by the DeviceExtensionSize
  69. // parameter passed in to HidAddDevice().
  70. //
  71. // So, given a Functional Device Object, a mininidriver finds this
  72. // structure by:
  73. //
  74. // HidDeviceExtension = (PHID_DEVICE_EXTENSION)(Fdo->DeviceExtension);
  75. //
  76. // And of course it's per-device extension is found by:
  77. //
  78. // MiniDeviceExtension = HidDeviceExtension->MiniDeviceExtension;
  79. //
  80. PVOID MiniDeviceExtension;
  81. } HID_DEVICE_EXTENSION, *PHID_DEVICE_EXTENSION;
  82. typedef struct _HID_DEVICE_ATTRIBUTES {
  83. ULONG Size;
  84. //
  85. // sizeof (struct _HID_DEVICE_ATTRIBUTES)
  86. //
  87. //
  88. // Vendor ids of this hid device
  89. //
  90. USHORT VendorID;
  91. USHORT ProductID;
  92. USHORT VersionNumber;
  93. USHORT Reserved[11];
  94. } HID_DEVICE_ATTRIBUTES, * PHID_DEVICE_ATTRIBUTES;
  95. #include <pshpack1.h>
  96. typedef struct _HID_DESCRIPTOR
  97. {
  98. UCHAR bLength;
  99. UCHAR bDescriptorType;
  100. USHORT bcdHID;
  101. UCHAR bCountry;
  102. UCHAR bNumDescriptors;
  103. /*
  104. * This is an array of one OR MORE descriptors.
  105. */
  106. struct _HID_DESCRIPTOR_DESC_LIST {
  107. UCHAR bReportType;
  108. USHORT wReportLength;
  109. } DescriptorList [1];
  110. } HID_DESCRIPTOR, * PHID_DESCRIPTOR;
  111. #include <poppack.h>
  112. typedef
  113. VOID
  114. (*HID_SEND_IDLE_CALLBACK)(
  115. PVOID Context
  116. );
  117. typedef struct _HID_SUBMIT_IDLE_NOTIFICATION_CALLBACK_INFO {
  118. HID_SEND_IDLE_CALLBACK IdleCallback;
  119. PVOID IdleContext;
  120. } HID_SUBMIT_IDLE_NOTIFICATION_CALLBACK_INFO, *PHID_SUBMIT_IDLE_NOTIFICATION_CALLBACK_INFO;
  121. //
  122. // Function prototypes for the HID services exported by the hid class driver
  123. // follow.
  124. //
  125. NTSTATUS
  126. HidRegisterMinidriver(
  127. IN PHID_MINIDRIVER_REGISTRATION MinidriverRegistration
  128. );
  129. NTSTATUS
  130. HidNotifyPresence(
  131. IN PDEVICE_OBJECT DeviceObject,
  132. IN BOOLEAN IsPresent
  133. );
  134. //
  135. // Internal IOCTLs for the class/mini driver interface.
  136. //
  137. #define IOCTL_HID_GET_DEVICE_DESCRIPTOR HID_CTL_CODE(0)
  138. #define IOCTL_HID_GET_REPORT_DESCRIPTOR HID_CTL_CODE(1)
  139. #define IOCTL_HID_READ_REPORT HID_CTL_CODE(2)
  140. #define IOCTL_HID_WRITE_REPORT HID_CTL_CODE(3)
  141. #define IOCTL_HID_GET_STRING HID_CTL_CODE(4)
  142. #define IOCTL_HID_ACTIVATE_DEVICE HID_CTL_CODE(7)
  143. #define IOCTL_HID_DEACTIVATE_DEVICE HID_CTL_CODE(8)
  144. #define IOCTL_HID_GET_DEVICE_ATTRIBUTES HID_CTL_CODE(9)
  145. #define IOCTL_HID_SEND_IDLE_NOTIFICATION_REQUEST HID_CTL_CODE(10)
  146. /*
  147. * Codes for HID-specific descriptor types, from HID USB spec.
  148. */
  149. #define HID_HID_DESCRIPTOR_TYPE 0x21
  150. #define HID_REPORT_DESCRIPTOR_TYPE 0x22
  151. #define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23 // for body part associations
  152. /*
  153. * These are string IDs for use with IOCTL_HID_GET_STRING
  154. * They match the string field offsets in Chapter 9 of the USB Spec.
  155. */
  156. #define HID_STRING_ID_IMANUFACTURER 14
  157. #define HID_STRING_ID_IPRODUCT 15
  158. #define HID_STRING_ID_ISERIALNUMBER 16
  159. #endif // __HIDPORT_H__