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.

201 lines
5.0 KiB

  1. #ifndef __swvmouse_h__
  2. #define __swvmouse_h__
  3. // @doc
  4. /**********************************************************************
  5. *
  6. * @module SWVMOUSE.H |
  7. *
  8. * Declarations related to SideWinder Virtual Keyboard.
  9. *
  10. * History
  11. * ----------------------------------------------------------
  12. * Mitchell S. Dernis Original
  13. *
  14. * (c) 1986-1998 Microsoft Corporation. All right reserved.
  15. *
  16. * @topic SWVMOUSE |
  17. * The SideWinder Virtual Mouse is designed to sit atop the SideWinder
  18. * Virtual Bus. It is a HID device, and relies on the loading of a dummy
  19. * HID driver.<nl>
  20. *
  21. **********************************************************************/
  22. #include "irpqueue.h"
  23. //----------------------------------------------------------------------------------
  24. // Virtual Mouse structures
  25. //----------------------------------------------------------------------------------
  26. #define GCK_VMOU_MAX_KEYSTROKES 0x06 //HID spec. says this can be six at most.
  27. //Comments in HIDPARSE code suggest that the OS
  28. //supports up to fourteen.
  29. #define GCK_VMOU_STATE_BUFFER_SIZE 0x20 //Size of circular buffer for holding on to
  30. //key presses.
  31. //----------------------------------------------------------------------------------
  32. // Device States - an alternative to five different flags
  33. //----------------------------------------------------------------------------------
  34. #define VMOU_STATE_STARTED 0x01
  35. #define VMOU_STATE_STOPPED 0x02
  36. #define VMOU_STATE_REMOVED 0x03
  37. //
  38. // @struct GCK_VMOU_REPORT_PACKET |
  39. // The report format of the virtual keyboard. Any changes here must be
  40. // reflected in the report descriptor and vice-versa.
  41. typedef struct tagGCK_VMOU_REPORT_PACKET
  42. {
  43. UCHAR ucButtons; //@field Button Byte (3 lsb are used)
  44. UCHAR ucDeltaX; //@field Delta X
  45. UCHAR ucDeltaY; //@field Delta Y
  46. } GCK_VMOU_REPORT_PACKET, *PGCK_VMOU_REPORT_PACKET;
  47. //
  48. // @struct GCK_VMOU_EXT |
  49. //
  50. typedef struct tagGCK_VMOU_EXT
  51. {
  52. UCHAR ucDeviceState; //@field State of device(Started, Stopped, Removed)
  53. USHORT usReportBufferCount; //@field Count of packets in buffer
  54. USHORT usReportBufferPos; //@field Next Packet in buffer
  55. GCK_VMOU_REPORT_PACKET rgReportBuffer[GCK_VMOU_STATE_BUFFER_SIZE]; //@field Buffer of pendind reports
  56. CGuardedIrpQueue IrpQueue; //@field Irp queue;
  57. GCK_REMOVE_LOCK RemoveLock; //@field Custom Remove Lock
  58. } GCK_VMOU_EXT, *PGCK_VMOU_EXT;
  59. //----------------------------------------------------------------------------------
  60. // API for using the Virtual Keyboard
  61. //----------------------------------------------------------------------------------
  62. NTSTATUS
  63. GCK_VMOU_Create
  64. (
  65. OUT PDEVICE_OBJECT *ppDeviceObject
  66. );
  67. NTSTATUS
  68. GCK_VMOU_Close
  69. (
  70. IN PDEVICE_OBJECT pDeviceObject
  71. );
  72. NTSTATUS
  73. GCK_VMOU_SendReportPacket
  74. (
  75. IN PDEVICE_OBJECT pDeviceObject,
  76. IN PGCK_VMOU_REPORT_PACKET pReportPacket
  77. );
  78. //----------------------------------------------------------------------------------
  79. // Driver Initialization
  80. //----------------------------------------------------------------------------------
  81. //----------------------------------------------------------------------------------
  82. // Device Initialization
  83. //----------------------------------------------------------------------------------
  84. NTSTATUS
  85. GCK_VMOU_Init
  86. (
  87. IN PDEVICE_OBJECT pDeviceObject,
  88. IN ULONG ulInitContext
  89. );
  90. //----------------------------------------------------------------------------------
  91. // Entry points to handle IRPs from the Virtual Bus
  92. //----------------------------------------------------------------------------------
  93. NTSTATUS
  94. GCK_VMOU_CloseProc
  95. (
  96. IN PDEVICE_OBJECT pDeviceObject,
  97. PIRP pIrp
  98. );
  99. NTSTATUS
  100. GCK_VMOU_CreateProc
  101. (
  102. IN PDEVICE_OBJECT pDeviceObject,
  103. IN PIRP pIrp
  104. );
  105. NTSTATUS
  106. GCK_VMOU_IoctlProc
  107. (
  108. PDEVICE_OBJECT pDeviceObject,
  109. PIRP pIrp
  110. );
  111. NTSTATUS
  112. GCK_VMOU_ReadProc
  113. (
  114. PDEVICE_OBJECT pDeviceObject,
  115. PIRP pIrp
  116. );
  117. NTSTATUS
  118. GCK_VMOU_StartProc
  119. (
  120. PDEVICE_OBJECT pDeviceObject,
  121. PIRP pIrp
  122. );
  123. NTSTATUS
  124. GCK_VMOU_StopProc
  125. (
  126. PDEVICE_OBJECT pDeviceObject,
  127. PIRP pIrp
  128. );
  129. NTSTATUS
  130. GCK_VMOU_RemoveProc
  131. (
  132. IN PDEVICE_OBJECT pDeviceObject,
  133. IN PIRP pIrp
  134. );
  135. NTSTATUS
  136. GCK_VMOU_WriteProc
  137. (
  138. PDEVICE_OBJECT pDeviceObject,
  139. PIRP pIrp
  140. );
  141. //------------------------------------------------------------------
  142. // Ioctl sub-function handlers
  143. //------------------------------------------------------------------
  144. NTSTATUS
  145. GCK_VMOU_GetDeviceDescriptor
  146. (
  147. IN ULONG ulBufferLength,
  148. OUT PVOID pvUserBuffer,
  149. OUT PULONG pulBytesCopied
  150. );
  151. NTSTATUS
  152. GCK_VMOU_GetReportDescriptor
  153. (
  154. IN ULONG ulBufferLength,
  155. OUT PVOID pvUserBuffer,
  156. OUT PULONG pulBytesCopied
  157. );
  158. NTSTATUS
  159. GCK_VMOU_GetDeviceAttributes
  160. (
  161. IN ULONG ulBufferLength,
  162. OUT PVOID pvUserBuffer,
  163. OUT PULONG pulBytesCopied
  164. );
  165. NTSTATUS
  166. GCK_VMOU_ReadReport
  167. (
  168. PDEVICE_OBJECT pDeviceObject,
  169. PIRP pIrp
  170. );
  171. VOID
  172. GCK_VMOU_CancelReadReportIrp
  173. (
  174. IN PDEVICE_OBJECT pDeviceObject,
  175. IN PIRP pIrp
  176. );
  177. #endif //__swvmouse_h__