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.

220 lines
4.9 KiB

  1. /*++
  2. Copyright (c) 1996, 1997 Microsoft Corporation
  3. Module Name:
  4. hidir.h
  5. --*/
  6. #ifndef __HIDIR_H__
  7. #define __HIDIR_H__
  8. #include <hidusage.h>
  9. //
  10. // Declarations of HID descriptor formats
  11. //
  12. #include <PSHPACK1.H>
  13. typedef UCHAR HID_REPORT_DESCRIPTOR, *PHID_REPORT_DESCRIPTOR;
  14. typedef UCHAR HID_PHYSICAL_DESCRIPTOR, *PHID_PHYSICAL_DESCRIPTOR;
  15. typedef struct _HIDIR_DESCRIPTOR
  16. {
  17. UCHAR bLength;
  18. UCHAR bDescriptorType;
  19. USHORT bcdHID;
  20. UCHAR bCountry;
  21. UCHAR bNumDescriptors;
  22. /*
  23. * This is an array of one OR MORE descriptors.
  24. */
  25. struct _HIDIR_DESCRIPTOR_DESC_LIST {
  26. UCHAR bDescriptorType;
  27. USHORT wDescriptorLength;
  28. } DescriptorList [1];
  29. } HIDIR_DESCRIPTOR, * PHIDIR_DESCRIPTOR;
  30. #include <POPPACK.H>
  31. // Pool
  32. #define HIDIR_POOL_TAG 'IdiH'
  33. #define ALLOCATEPOOL(poolType, size) ExAllocatePoolWithTag((poolType), (size), HIDIR_POOL_TAG)
  34. //
  35. // Device Extension
  36. //
  37. // This data structure is hooked onto HIDCLASS' device extension, so both drivers can
  38. // have their own private data on each device object.
  39. //
  40. #define HIDIR_REPORT_SIZE sizeof(ULONG)
  41. #define HIDIR_TABLE_ENTRY_SIZE(rl) (sizeof(ULONG) + (((rl)+0x00000003)&(~0x00000003)))
  42. typedef struct _USAGE_TABLE_ENTRY {
  43. ULONG IRString;
  44. UCHAR UsageString[1];
  45. } USAGE_TABLE_ENTRY, *PUSAGE_TABLE_ENTRY;
  46. typedef struct _HIDIR_EXTENSION
  47. {
  48. // What state has pnp got me in?
  49. ULONG DeviceState;
  50. // Ref counting
  51. LONG NumPendingRequests;
  52. KEVENT AllRequestsCompleteEvent;
  53. // My hid bth device object.
  54. PDEVICE_OBJECT DeviceObject;
  55. // Descriptors: HID, report, and physical
  56. HIDIR_DESCRIPTOR HidDescriptor;
  57. PHID_REPORT_DESCRIPTOR ReportDescriptor;
  58. ULONG ReportLength;
  59. BOOLEAN QueryRemove;
  60. // VID, PID, and version
  61. USHORT VendorID;
  62. USHORT ProductID;
  63. USHORT VersionNumber;
  64. ULONG NumUsages;
  65. PUCHAR MappingTable;
  66. USAGE_TABLE_ENTRY PreviousButton;
  67. BOOLEAN ValidUsageSentLastTime[3];
  68. BOOLEAN KeyboardReportIdValid;
  69. UCHAR KeyboardReportId;
  70. BOOLEAN StandbyReportIdValid;
  71. UCHAR StandbyReportId;
  72. DEVICE_POWER_STATE DevicePowerState;
  73. KTIMER IgnoreStandbyTimer;
  74. } HIDIR_EXTENSION, *PHIDIR_EXTENSION;
  75. #define DEVICE_STATE_NONE 0
  76. #define DEVICE_STATE_STARTING 1
  77. #define DEVICE_STATE_RUNNING 2
  78. #define DEVICE_STATE_STOPPING 3
  79. #define DEVICE_STATE_STOPPED 4
  80. #define DEVICE_STATE_REMOVING 5
  81. //
  82. // Device Extension Macros
  83. //
  84. #define GET_MINIDRIVER_HIDIR_EXTENSION(DO) ((PHIDIR_EXTENSION) (((PHID_DEVICE_EXTENSION)(DO)->DeviceExtension)->MiniDeviceExtension))
  85. #define GET_NEXT_DEVICE_OBJECT(DO) (((PHID_DEVICE_EXTENSION)(DO)->DeviceExtension)->NextDeviceObject)
  86. //
  87. // Turn on debug printing and breaking, if appropriate
  88. //
  89. #if DBG
  90. #define DBGPrint(arg) DbgPrint arg
  91. #define DBGBREAK DbgBreakPoint()
  92. #else
  93. #define DBGPrint(arg)
  94. #define DBGBREAK
  95. #endif
  96. //
  97. // Function prototypes
  98. //
  99. NTSTATUS
  100. DriverEntry(
  101. IN PDRIVER_OBJECT DriverObject,
  102. IN PUNICODE_STRING registryPath
  103. );
  104. NTSTATUS
  105. HidIrIoctl(
  106. IN PDEVICE_OBJECT DeviceObject,
  107. IN PIRP Irp
  108. );
  109. NTSTATUS
  110. HidIrPnP(
  111. IN PDEVICE_OBJECT DeviceObject,
  112. IN PIRP Irp
  113. );
  114. NTSTATUS
  115. HidIrPower(
  116. IN PDEVICE_OBJECT DeviceObject,
  117. IN PIRP Irp
  118. );
  119. NTSTATUS
  120. HidIrAddDevice(
  121. IN PDRIVER_OBJECT DriverObject,
  122. IN PDEVICE_OBJECT FunctionalDeviceObject
  123. );
  124. VOID
  125. HidIrUnload(
  126. IN PDRIVER_OBJECT DriverObject
  127. );
  128. NTSTATUS
  129. HidIrGetDeviceAttributes(
  130. IN PDEVICE_OBJECT DeviceObject,
  131. IN PIRP Irp
  132. );
  133. NTSTATUS
  134. HidIrGetHidDescriptor(
  135. IN PDEVICE_OBJECT DeviceObject,
  136. IN PIRP Irp,
  137. IN USHORT DescriptorType
  138. );
  139. NTSTATUS
  140. HidIrReadReport(
  141. IN PDEVICE_OBJECT DeviceObject,
  142. IN PIRP Irp,
  143. OUT BOOLEAN *NeedsCompletion
  144. );
  145. NTSTATUS
  146. HidIrIncrementPendingRequestCount(
  147. IN PHIDIR_EXTENSION DeviceExtension
  148. );
  149. VOID
  150. HidIrDecrementPendingRequestCount(
  151. IN PHIDIR_EXTENSION DeviceExtension
  152. );
  153. NTSTATUS
  154. HidIrSystemControl(
  155. IN PDEVICE_OBJECT DeviceObject,
  156. IN PIRP Irp
  157. );
  158. NTSTATUS
  159. HidIrSynchronousCompletion(
  160. IN PDEVICE_OBJECT DeviceObject,
  161. IN PIRP Irp,
  162. IN PVOID Context
  163. );
  164. NTSTATUS
  165. HidIrCallDriverSynchronous(
  166. PDEVICE_OBJECT DeviceObject,
  167. PIRP Irp
  168. );
  169. extern ULONG RunningMediaCenter;
  170. #endif // _HIDIR_H__