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.

253 lines
7.7 KiB

  1. /*++
  2. Copyright(c) 2000-2001 Microsoft Corporation
  3. Module Name:
  4. sacioctl.h
  5. Abstract:
  6. This module contains the public header information for communicating to and from
  7. the SAC via IOCTLs.
  8. Author:
  9. Sean Selitrennikoff (v-seans) Oct, 2000
  10. Brian Guarraci (briangu), 2001
  11. Revision History:
  12. --*/
  13. #ifndef _SACIOCTL_
  14. #define _SACIOCTL_
  15. //
  16. // This enables the ability to register a lock event
  17. // which when fired indicates that the channel should lock itself.
  18. //
  19. #define ENABLE_CHANNEL_LOCKING 1
  20. //
  21. // This is the maxium length a channel name may be, not including the NULL terminator
  22. //
  23. #define SAC_MAX_CHANNEL_NAME_LENGTH 64
  24. #define SAC_MAX_CHANNEL_NAME_SIZE ((SAC_MAX_CHANNEL_NAME_LENGTH+1)*sizeof(WCHAR))
  25. #define SAC_MAX_CHANNEL_DESCRIPTION_LENGTH 256
  26. #define SAC_MAX_CHANNEL_DESCRIPTION_SIZE ((SAC_MAX_CHANNEL_DESCRIPTION_LENGTH+1)*sizeof(WCHAR))
  27. //
  28. // IOCTL defs
  29. //
  30. #define IOCTL_SAC_OPEN_CHANNEL CTL_CODE(FILE_DEVICE_UNKNOWN, 0x1, METHOD_BUFFERED, FILE_WRITE_DATA)
  31. #define IOCTL_SAC_CLOSE_CHANNEL CTL_CODE(FILE_DEVICE_UNKNOWN, 0x2, METHOD_BUFFERED, FILE_WRITE_DATA)
  32. #define IOCTL_SAC_WRITE_CHANNEL CTL_CODE(FILE_DEVICE_UNKNOWN, 0x3, METHOD_BUFFERED, FILE_WRITE_DATA)
  33. #define IOCTL_SAC_READ_CHANNEL CTL_CODE(FILE_DEVICE_UNKNOWN, 0x4, METHOD_BUFFERED, FILE_READ_DATA)
  34. #define IOCTL_SAC_POLL_CHANNEL CTL_CODE(FILE_DEVICE_UNKNOWN, 0x5, METHOD_BUFFERED, FILE_READ_DATA)
  35. #define IOCTL_SAC_REGISTER_CMD_EVENT CTL_CODE(FILE_DEVICE_UNKNOWN, 0x6, METHOD_BUFFERED, FILE_WRITE_DATA)
  36. #define IOCTL_SAC_UNREGISTER_CMD_EVENT CTL_CODE(FILE_DEVICE_UNKNOWN, 0x7, METHOD_BUFFERED, FILE_WRITE_DATA)
  37. #if 0
  38. #define IOCTL_SAC_GET_CHANNEL_ATTRIBUTE CTL_CODE(FILE_DEVICE_UNKNOWN, 0x8, METHOD_BUFFERED, FILE_READ_DATA)
  39. #define IOCTL_SAC_SET_CHANNEL_ATTRIBUTE CTL_CODE(FILE_DEVICE_UNKNOWN, 0x9, METHOD_BUFFERED, FILE_WRITE_DATA)
  40. #endif
  41. //
  42. // Structure to be use to refer to a channel when
  43. // using the IOCTL interface.
  44. //
  45. typedef struct _SAC_CHANNEL_HANDLE {
  46. GUID ChannelHandle;
  47. HANDLE DriverHandle;
  48. } SAC_CHANNEL_HANDLE, *PSAC_CHANNEL_HANDLE;
  49. //
  50. // Define the channel types that can be created
  51. //
  52. typedef enum _SAC_CHANNEL_TYPE {
  53. ChannelTypeVTUTF8,
  54. ChannelTypeRaw,
  55. ChannelTypeCmd
  56. } SAC_CHANNEL_TYPE, *PSAC_CHANNEL_TYPE;
  57. //
  58. // IOCTL_SAC_OPEN_CHANNEL.
  59. //
  60. // Flags
  61. typedef ULONG SAC_CHANNEL_FLAG;
  62. typedef PULONG PSAC_CHANNEL_FLAG;
  63. #define SAC_CHANNEL_FLAG_PRESERVE 0x01
  64. #define SAC_CHANNEL_FLAG_CLOSE_EVENT 0x02
  65. #define SAC_CHANNEL_FLAG_HAS_NEW_DATA_EVENT 0x04
  66. #define SAC_CHANNEL_FLAG_LOCK_EVENT 0x08
  67. #define SAC_CHANNEL_FLAG_REDRAW_EVENT 0x10
  68. #define SAC_CHANNEL_FLAG_APPLICATION_TYPE 0x20
  69. //
  70. // Structure used by to describe
  71. // the attributes of the channel wanting to be created
  72. //
  73. typedef struct _SAC_CHANNEL_OPEN_ATTRIBUTES {
  74. SAC_CHANNEL_TYPE Type;
  75. WCHAR Name[SAC_MAX_CHANNEL_NAME_LENGTH+1];
  76. WCHAR Description[SAC_MAX_CHANNEL_DESCRIPTION_LENGTH+1];
  77. SAC_CHANNEL_FLAG Flags;
  78. HANDLE CloseEvent; OPTIONAL
  79. HANDLE HasNewDataEvent; OPTIONAL
  80. HANDLE LockEvent; OPTIONAL
  81. HANDLE RedrawEvent; OPTIONAL
  82. GUID ApplicationType; OPTIONAL
  83. } SAC_CHANNEL_OPEN_ATTRIBUTES, *PSAC_CHANNEL_OPEN_ATTRIBUTES;
  84. typedef struct _SAC_CMD_OPEN_CHANNEL {
  85. SAC_CHANNEL_OPEN_ATTRIBUTES Attributes;
  86. } SAC_CMD_OPEN_CHANNEL, *PSAC_CMD_OPEN_CHANNEL;
  87. //
  88. // This is the response struct for an IOCTL_SAC_OPEN_CHANNEL.
  89. //
  90. typedef struct _SAC_RSP_OPEN_CHANNEL {
  91. SAC_CHANNEL_HANDLE Handle;
  92. } SAC_RSP_OPEN_CHANNEL, *PSAC_RSP_OPEN_CHANNEL;
  93. //
  94. // IOCTL_SAC_CLOSE_CHANNEL.
  95. // Handle is value returned by IOCTL_SAC_OPEN_CHANNEL.
  96. //
  97. typedef struct _SAC_CMD_CLOSE_CHANNEL {
  98. SAC_CHANNEL_HANDLE Handle;
  99. } SAC_CMD_CLOSE_CHANNEL, *PSAC_CMD_CLOSE_CHANNEL;
  100. //
  101. // IOCTL_SAC_WRITE_CHANNEL.
  102. // Handle is value returned by IOCTL_SAC_OPEN_CHANNEL.
  103. //
  104. typedef struct _SAC_CMD_WRITE_CHANNEL {
  105. SAC_CHANNEL_HANDLE Handle;
  106. ULONG Size; // The # of bytes in String to process
  107. UCHAR Buffer[1]; // byte buffer
  108. } SAC_CMD_WRITE_CHANNEL, *PSAC_CMD_WRITE_CHANNEL;
  109. //
  110. // IOCTL_SAC_READ_CHANNEL.
  111. // Handle is value returned by IOCTL_SAC_OPEN_CHANNEL.
  112. //
  113. typedef struct _SAC_CMD_READ_CHANNEL {
  114. SAC_CHANNEL_HANDLE Handle;
  115. } SAC_CMD_READ_CHANNEL, *PSAC_CMD_READ_CHANNEL;
  116. //
  117. // Response structure fore the IOCTL_SAC_READ_CHANNEL
  118. //
  119. // Note: BufferSize is returned as the response size
  120. // in the IOCTL call.
  121. //
  122. typedef struct _SAC_RSP_READ_CHANNEL {
  123. UCHAR Buffer[1]; // A NULL terminated string.
  124. } SAC_RSP_READ_CHANNEL, *PSAC_RSP_READ_CHANNEL;
  125. //
  126. // This is the struct for an IOCTL_SAC_POLL_CHANNEL.
  127. // Handle is value returned by IOCTL_SAC_OPEN_CHANNEL.
  128. //
  129. typedef struct _SAC_CMD_POLL_CHANNEL {
  130. SAC_CHANNEL_HANDLE Handle;
  131. } SAC_CMD_POLL_CHANNEL, *PSAC_CMD_POLL_CHANNEL;
  132. //
  133. // Reponse structure for IOCTL_SAC_POLL_CHANNEL
  134. //
  135. typedef struct _SAC_RSP_POLL_CHANNEL {
  136. BOOLEAN InputWaiting;
  137. } SAC_RSP_POLL_CHANNEL, *PSAC_RSP_POLL_CHANNEL;
  138. //
  139. // Define the attributes applications may modify
  140. //
  141. typedef enum _SAC_CHANNEL_ATTRIBUTE {
  142. ChannelAttributeStatus,
  143. ChannelAttributeType,
  144. ChannelAttributeName,
  145. ChannelAttributeDescription,
  146. ChannelAttributeApplicationType,
  147. ChannelAttributeFlags
  148. } SAC_CHANNEL_ATTRIBUTE, *PSAC_CHANNEL_ATTRIBUTE;
  149. //
  150. // Define the possible channel states
  151. //
  152. typedef enum _SAC_CHANNEL_STATUS {
  153. ChannelStatusInactive = 0,
  154. ChannelStatusActive
  155. } SAC_CHANNEL_STATUS, *PSAC_CHANNEL_STATUS;
  156. #if 0
  157. //
  158. // Command structure for getting a channel attribute
  159. //
  160. typedef struct _SAC_CMD_GET_CHANNEL_ATTRIBUTE {
  161. SAC_CHANNEL_HANDLE Handle;
  162. SAC_CHANNEL_ATTRIBUTE Attribute;
  163. } SAC_CMD_GET_CHANNEL_ATTRIBUTE, *PSAC_CMD_GET_CHANNEL_ATTRIBUTE;
  164. //
  165. // Response structure for getting a channel attribute
  166. //
  167. typedef struct _SAC_RSP_GET_CHANNEL_ATTRIBUTE {
  168. union {
  169. SAC_CHANNEL_STATUS ChannelStatus;
  170. SAC_CHANNEL_TYPE ChannelType;
  171. WCHAR ChannelName[SAC_MAX_CHANNEL_NAME_LENGTH+1];
  172. WCHAR ChannelDescription[SAC_MAX_CHANNEL_DESCRIPTION_LENGTH+1];
  173. GUID ChannelApplicationType;
  174. SAC_CHANNEL_FLAG ChannelFlags;
  175. };
  176. } SAC_RSP_GET_CHANNEL_ATTRIBUTE, *PSAC_RSP_GET_CHANNEL_ATTRIBUTE;
  177. //
  178. // Command structure for setting a channel attribute
  179. //
  180. typedef struct _SAC_CMD_SET_CHANNEL_ATTRIBUTE {
  181. SAC_CHANNEL_HANDLE Handle;
  182. SAC_CHANNEL_ATTRIBUTE Attribute;
  183. union {
  184. WCHAR ChannelName[SAC_MAX_CHANNEL_NAME_LENGTH+1];
  185. WCHAR ChannelDescription[SAC_MAX_CHANNEL_DESCRIPTION_LENGTH+1];
  186. GUID ChannelApplicationType;
  187. SAC_CHANNEL_FLAG ChannelFlags;
  188. };
  189. } SAC_CMD_SET_CHANNEL_ATTRIBUTE, *PSAC_CMD_SET_CHANNEL_ATTRIBUTE;
  190. #endif
  191. //
  192. // IOCTL_SAC_REGISTER_CMD_EVENT
  193. //
  194. // Command structure for setting the command console event info
  195. //
  196. typedef struct _SAC_CMD_REGISTER_CMD_EVENT {
  197. //
  198. // Handles of events used for communication between
  199. // device driver and the user-mode app.
  200. //
  201. HANDLE RequestSacCmdEvent;
  202. //
  203. // Handles of the events indicating the result
  204. // of the command console launch
  205. //
  206. HANDLE RequestSacCmdSuccessEvent;
  207. HANDLE RequestSacCmdFailureEvent;
  208. } SAC_CMD_SETUP_CMD_EVENT, *PSAC_CMD_SETUP_CMD_EVENT;
  209. #endif // _SACIOCTL_