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.

361 lines
15 KiB

  1. /*++
  2. Copyright (c) 1998-2000 Microsoft Corporation
  3. Module Name:
  4. ddkinc.h
  5. Abstract:
  6. This module contains DDK constants and macro. They are
  7. cut-and-pasted from various files in the DDK.
  8. Author:
  9. Madan Appiah (madana) 17-Sep-1998
  10. Revision History:
  11. --*/
  12. #ifndef __DDKINC_H__
  13. #define __DDKINC_H__
  14. ////////////////////////////////////////////////////////////
  15. //
  16. // From wdm.h
  17. //
  18. #define IRP_MJ_CREATE 0x00
  19. #define IRP_MJ_CLOSE 0x02
  20. #define IRP_MJ_READ 0x03
  21. #define IRP_MJ_WRITE 0x04
  22. #define IRP_MJ_QUERY_INFORMATION 0x05
  23. #define IRP_MJ_SET_INFORMATION 0x06
  24. #define IRP_MJ_FLUSH_BUFFERS 0x09
  25. #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0A
  26. #define IRP_MJ_SET_VOLUME_INFORMATION 0x0B
  27. #define IRP_MJ_DIRECTORY_CONTROL 0x0C
  28. #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0D
  29. #define IRP_MJ_DEVICE_CONTROL 0x0E
  30. #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0F
  31. #define IRP_MJ_SHUTDOWN 0x10
  32. #define IRP_MJ_LOCK_CONTROL 0x11
  33. #define IRP_MJ_CLEANUP 0x12
  34. #define IRP_MJ_QUERY_SECURITY 0x14
  35. #define IRP_MJ_SET_SECURITY 0x15
  36. //
  37. // Directory control minor function codes
  38. //
  39. #define IRP_MN_QUERY_DIRECTORY 0x01
  40. #define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02
  41. #undef CTL_CODE
  42. #define CTL_CODE( DeviceType, Function, Method, Access ) ( \
  43. ((ULONG)(DeviceType) << 16) | \
  44. ((ULONG)(Access) << 14) | \
  45. ((ULONG)(Function) << 2) | \
  46. (Method) \
  47. )
  48. #define FILE_DEVICE_SERIAL_PORT 0x0000001b
  49. #define FILE_DEVICE_PARALLEL_PORT 0x00000016
  50. #define METHOD_BUFFERED 0
  51. #define FILE_ANY_ACCESS 0
  52. #define IOCTL_INTERNAL_GET_PARALLEL_PORT_INFO CTL_CODE(FILE_DEVICE_PARALLEL_PORT,12,METHOD_BUFFERED,FILE_ANY_ACCESS)
  53. #define IOCTL_INTERNAL_PARALLEL_PORT_ALLOCATE CTL_CODE(FILE_DEVICE_PARALLEL_PORT,11,METHOD_BUFFERED,FILE_ANY_ACCESS)
  54. #define IOCTL_INTERNAL_PARALLEL_CONNECT_INTERRUPT CTL_CODE(FILE_DEVICE_PARALLEL_PORT,13,METHOD_BUFFERED,FILE_ANY_ACCESS)
  55. #define IOCTL_INTERNAL_PARALLEL_DISCONNECT_INTERRUPT CTL_CODE(FILE_DEVICE_PARALLEL_PORT,14,METHOD_BUFFERED,FILE_ANY_ACCESS)
  56. ////////////////////////////////////////////////////////////
  57. //
  58. // From ntddser.h
  59. //
  60. //
  61. // Serial IOCTL's.
  62. //
  63. #define IOCTL_SERIAL_SET_BAUD_RATE CTL_CODE(FILE_DEVICE_SERIAL_PORT, 1,METHOD_BUFFERED,FILE_ANY_ACCESS)
  64. #define IOCTL_SERIAL_SET_QUEUE_SIZE CTL_CODE(FILE_DEVICE_SERIAL_PORT, 2,METHOD_BUFFERED,FILE_ANY_ACCESS)
  65. #define IOCTL_SERIAL_SET_LINE_CONTROL CTL_CODE(FILE_DEVICE_SERIAL_PORT, 3,METHOD_BUFFERED,FILE_ANY_ACCESS)
  66. #define IOCTL_SERIAL_SET_BREAK_ON CTL_CODE(FILE_DEVICE_SERIAL_PORT, 4,METHOD_BUFFERED,FILE_ANY_ACCESS)
  67. #define IOCTL_SERIAL_SET_BREAK_OFF CTL_CODE(FILE_DEVICE_SERIAL_PORT, 5,METHOD_BUFFERED,FILE_ANY_ACCESS)
  68. #define IOCTL_SERIAL_IMMEDIATE_CHAR CTL_CODE(FILE_DEVICE_SERIAL_PORT, 6,METHOD_BUFFERED,FILE_ANY_ACCESS)
  69. #define IOCTL_SERIAL_SET_TIMEOUTS CTL_CODE(FILE_DEVICE_SERIAL_PORT, 7,METHOD_BUFFERED,FILE_ANY_ACCESS)
  70. #define IOCTL_SERIAL_GET_TIMEOUTS CTL_CODE(FILE_DEVICE_SERIAL_PORT, 8,METHOD_BUFFERED,FILE_ANY_ACCESS)
  71. #define IOCTL_SERIAL_SET_DTR CTL_CODE(FILE_DEVICE_SERIAL_PORT, 9,METHOD_BUFFERED,FILE_ANY_ACCESS)
  72. #define IOCTL_SERIAL_CLR_DTR CTL_CODE(FILE_DEVICE_SERIAL_PORT,10,METHOD_BUFFERED,FILE_ANY_ACCESS)
  73. #define IOCTL_SERIAL_RESET_DEVICE CTL_CODE(FILE_DEVICE_SERIAL_PORT,11,METHOD_BUFFERED,FILE_ANY_ACCESS)
  74. #define IOCTL_SERIAL_SET_RTS CTL_CODE(FILE_DEVICE_SERIAL_PORT,12,METHOD_BUFFERED,FILE_ANY_ACCESS)
  75. #define IOCTL_SERIAL_CLR_RTS CTL_CODE(FILE_DEVICE_SERIAL_PORT,13,METHOD_BUFFERED,FILE_ANY_ACCESS)
  76. #define IOCTL_SERIAL_SET_XOFF CTL_CODE(FILE_DEVICE_SERIAL_PORT,14,METHOD_BUFFERED,FILE_ANY_ACCESS)
  77. #define IOCTL_SERIAL_SET_XON CTL_CODE(FILE_DEVICE_SERIAL_PORT,15,METHOD_BUFFERED,FILE_ANY_ACCESS)
  78. #define IOCTL_SERIAL_GET_WAIT_MASK CTL_CODE(FILE_DEVICE_SERIAL_PORT,16,METHOD_BUFFERED,FILE_ANY_ACCESS)
  79. #define IOCTL_SERIAL_SET_WAIT_MASK CTL_CODE(FILE_DEVICE_SERIAL_PORT,17,METHOD_BUFFERED,FILE_ANY_ACCESS)
  80. #define IOCTL_SERIAL_WAIT_ON_MASK CTL_CODE(FILE_DEVICE_SERIAL_PORT,18,METHOD_BUFFERED,FILE_ANY_ACCESS)
  81. #define IOCTL_SERIAL_PURGE CTL_CODE(FILE_DEVICE_SERIAL_PORT,19,METHOD_BUFFERED,FILE_ANY_ACCESS)
  82. #define IOCTL_SERIAL_GET_BAUD_RATE CTL_CODE(FILE_DEVICE_SERIAL_PORT,20,METHOD_BUFFERED,FILE_ANY_ACCESS)
  83. #define IOCTL_SERIAL_GET_LINE_CONTROL CTL_CODE(FILE_DEVICE_SERIAL_PORT,21,METHOD_BUFFERED,FILE_ANY_ACCESS)
  84. #define IOCTL_SERIAL_GET_CHARS CTL_CODE(FILE_DEVICE_SERIAL_PORT,22,METHOD_BUFFERED,FILE_ANY_ACCESS)
  85. #define IOCTL_SERIAL_SET_CHARS CTL_CODE(FILE_DEVICE_SERIAL_PORT,23,METHOD_BUFFERED,FILE_ANY_ACCESS)
  86. #define IOCTL_SERIAL_GET_HANDFLOW CTL_CODE(FILE_DEVICE_SERIAL_PORT,24,METHOD_BUFFERED,FILE_ANY_ACCESS)
  87. #define IOCTL_SERIAL_SET_HANDFLOW CTL_CODE(FILE_DEVICE_SERIAL_PORT,25,METHOD_BUFFERED,FILE_ANY_ACCESS)
  88. #define IOCTL_SERIAL_GET_MODEMSTATUS CTL_CODE(FILE_DEVICE_SERIAL_PORT,26,METHOD_BUFFERED,FILE_ANY_ACCESS)
  89. #define IOCTL_SERIAL_GET_COMMSTATUS CTL_CODE(FILE_DEVICE_SERIAL_PORT,27,METHOD_BUFFERED,FILE_ANY_ACCESS)
  90. #define IOCTL_SERIAL_XOFF_COUNTER CTL_CODE(FILE_DEVICE_SERIAL_PORT,28,METHOD_BUFFERED,FILE_ANY_ACCESS)
  91. #define IOCTL_SERIAL_GET_PROPERTIES CTL_CODE(FILE_DEVICE_SERIAL_PORT,29,METHOD_BUFFERED,FILE_ANY_ACCESS)
  92. #define IOCTL_SERIAL_GET_DTRRTS CTL_CODE(FILE_DEVICE_SERIAL_PORT,30,METHOD_BUFFERED,FILE_ANY_ACCESS)
  93. #define IOCTL_SERIAL_LSRMST_INSERT CTL_CODE(FILE_DEVICE_SERIAL_PORT,31,METHOD_BUFFERED,FILE_ANY_ACCESS)
  94. #define IOCTL_SERIAL_CONFIG_SIZE CTL_CODE(FILE_DEVICE_SERIAL_PORT,32,METHOD_BUFFERED,FILE_ANY_ACCESS)
  95. #define IOCTL_SERIAL_GET_COMMCONFIG CTL_CODE(FILE_DEVICE_SERIAL_PORT,33,METHOD_BUFFERED,FILE_ANY_ACCESS)
  96. #define IOCTL_SERIAL_SET_COMMCONFIG CTL_CODE(FILE_DEVICE_SERIAL_PORT,34,METHOD_BUFFERED,FILE_ANY_ACCESS)
  97. #define IOCTL_SERIAL_GET_STATS CTL_CODE(FILE_DEVICE_SERIAL_PORT,35,METHOD_BUFFERED,FILE_ANY_ACCESS)
  98. #define IOCTL_SERIAL_CLEAR_STATS CTL_CODE(FILE_DEVICE_SERIAL_PORT,36,METHOD_BUFFERED,FILE_ANY_ACCESS)
  99. #define IOCTL_SERIAL_GET_MODEM_CONTROL CTL_CODE(FILE_DEVICE_SERIAL_PORT,37,METHOD_BUFFERED,FILE_ANY_ACCESS)
  100. #define IOCTL_SERIAL_SET_MODEM_CONTROL CTL_CODE(FILE_DEVICE_SERIAL_PORT,38,METHOD_BUFFERED,FILE_ANY_ACCESS)
  101. #define IOCTL_SERIAL_SET_FIFO_CONTROL CTL_CODE(FILE_DEVICE_SERIAL_PORT,39,METHOD_BUFFERED,FILE_ANY_ACCESS)
  102. //
  103. // These are the following reasons that the device could be holding.
  104. //
  105. #define SERIAL_TX_WAITING_FOR_CTS ((ULONG)0x00000001)
  106. #define SERIAL_TX_WAITING_FOR_DSR ((ULONG)0x00000002)
  107. #define SERIAL_TX_WAITING_FOR_DCD ((ULONG)0x00000004)
  108. #define SERIAL_TX_WAITING_FOR_XON ((ULONG)0x00000008)
  109. #define SERIAL_TX_WAITING_XOFF_SENT ((ULONG)0x00000010)
  110. #define SERIAL_TX_WAITING_ON_BREAK ((ULONG)0x00000020)
  111. #define SERIAL_RX_WAITING_FOR_DSR ((ULONG)0x00000040)
  112. //
  113. // These are the error values that can be returned by the
  114. // driver.
  115. //
  116. #define SERIAL_ERROR_BREAK ((ULONG)0x00000001)
  117. #define SERIAL_ERROR_FRAMING ((ULONG)0x00000002)
  118. #define SERIAL_ERROR_OVERRUN ((ULONG)0x00000004)
  119. #define SERIAL_ERROR_QUEUEOVERRUN ((ULONG)0x00000008)
  120. #define SERIAL_ERROR_PARITY ((ULONG)0x00000010)
  121. //
  122. // This structure used to set line parameters.
  123. //
  124. typedef struct _SERIAL_LINE_CONTROL {
  125. UCHAR StopBits;
  126. UCHAR Parity;
  127. UCHAR WordLength;
  128. } SERIAL_LINE_CONTROL,*PSERIAL_LINE_CONTROL;
  129. typedef struct _SERIAL_TIMEOUTS {
  130. ULONG ReadIntervalTimeout;
  131. ULONG ReadTotalTimeoutMultiplier;
  132. ULONG ReadTotalTimeoutConstant;
  133. ULONG WriteTotalTimeoutMultiplier;
  134. ULONG WriteTotalTimeoutConstant;
  135. } SERIAL_TIMEOUTS,*PSERIAL_TIMEOUTS;
  136. //
  137. // This structure used to resize the input/output buffers.
  138. // An error code will be returned if the size exceeds the
  139. // drivers capacity. The driver reserves the right to
  140. // allocate a larger buffer.
  141. //
  142. typedef struct _SERIAL_QUEUE_SIZE {
  143. ULONG InSize;
  144. ULONG OutSize;
  145. } SERIAL_QUEUE_SIZE,*PSERIAL_QUEUE_SIZE;
  146. //
  147. // This structure used by set baud rate
  148. //
  149. typedef struct _SERIAL_BAUD_RATE {
  150. ULONG BaudRate;
  151. } SERIAL_BAUD_RATE,*PSERIAL_BAUD_RATE;
  152. //
  153. // This structure is used to get the current error and
  154. // general status of the driver.
  155. //
  156. typedef struct _SERIAL_STATUS {
  157. ULONG Errors;
  158. ULONG HoldReasons;
  159. ULONG AmountInInQueue;
  160. ULONG AmountInOutQueue;
  161. BOOLEAN EofReceived;
  162. BOOLEAN WaitForImmediate;
  163. } SERIAL_STATUS,*PSERIAL_STATUS;
  164. //
  165. // This structure is used to set and retrieve the special characters
  166. // used by the nt serial driver.
  167. //
  168. typedef struct _SERIAL_CHARS {
  169. UCHAR EofChar;
  170. UCHAR ErrorChar;
  171. UCHAR BreakChar;
  172. UCHAR EventChar;
  173. UCHAR XonChar;
  174. UCHAR XoffChar;
  175. } SERIAL_CHARS,*PSERIAL_CHARS;
  176. //
  177. // Communication Properties
  178. //
  179. typedef struct _SERIAL_COMMPROP {
  180. USHORT PacketLength;
  181. USHORT PacketVersion;
  182. ULONG ServiceMask;
  183. ULONG Reserved1;
  184. ULONG MaxTxQueue;
  185. ULONG MaxRxQueue;
  186. ULONG MaxBaud;
  187. ULONG ProvSubType;
  188. ULONG ProvCapabilities;
  189. ULONG SettableParams;
  190. ULONG SettableBaud;
  191. USHORT SettableData;
  192. USHORT SettableStopParity;
  193. ULONG CurrentTxQueue;
  194. ULONG CurrentRxQueue;
  195. ULONG ProvSpec1;
  196. ULONG ProvSpec2;
  197. WCHAR ProvChar[1];
  198. } SERIAL_COMMPROP,*PSERIAL_COMMPROP;
  199. //
  200. // Handflow Struct and Related Defines
  201. //
  202. typedef struct _SERIAL_HANDFLOW {
  203. ULONG ControlHandShake;
  204. ULONG FlowReplace;
  205. LONG XonLimit;
  206. LONG XoffLimit;
  207. } SERIAL_HANDFLOW,*PSERIAL_HANDFLOW;
  208. #define SERIAL_DTR_MASK ((ULONG)0x03)
  209. #define SERIAL_DTR_CONTROL ((ULONG)0x01)
  210. #define SERIAL_DTR_HANDSHAKE ((ULONG)0x02)
  211. #define SERIAL_CTS_HANDSHAKE ((ULONG)0x08)
  212. #define SERIAL_DSR_HANDSHAKE ((ULONG)0x10)
  213. #define SERIAL_DCD_HANDSHAKE ((ULONG)0x20)
  214. #define SERIAL_OUT_HANDSHAKEMASK ((ULONG)0x38)
  215. #define SERIAL_DSR_SENSITIVITY ((ULONG)0x40)
  216. #define SERIAL_ERROR_ABORT ((ULONG)0x80000000)
  217. #define SERIAL_CONTROL_INVALID ((ULONG)0x7fffff84)
  218. #define SERIAL_AUTO_TRANSMIT ((ULONG)0x01)
  219. #define SERIAL_AUTO_RECEIVE ((ULONG)0x02)
  220. #define SERIAL_ERROR_CHAR ((ULONG)0x04)
  221. #define SERIAL_NULL_STRIPPING ((ULONG)0x08)
  222. #define SERIAL_BREAK_CHAR ((ULONG)0x10)
  223. #define SERIAL_RTS_MASK ((ULONG)0xc0)
  224. #define SERIAL_RTS_CONTROL ((ULONG)0x40)
  225. #define SERIAL_RTS_HANDSHAKE ((ULONG)0x80)
  226. #define SERIAL_TRANSMIT_TOGGLE ((ULONG)0xc0)
  227. #define SERIAL_XOFF_CONTINUE ((ULONG)0x80000000)
  228. #define SERIAL_FLOW_INVALID ((ULONG)0x7fffff20)
  229. //
  230. // The following structure (and defines) are passed back by
  231. // the serial driver in response to the get properties ioctl.
  232. //
  233. #define SERIAL_SP_SERIALCOMM ((ULONG)0x00000001)
  234. //
  235. // Provider subtypes
  236. //
  237. #define SERIAL_SP_UNSPECIFIED ((ULONG)0x00000000)
  238. #define SERIAL_SP_RS232 ((ULONG)0x00000001)
  239. #define SERIAL_SP_PARALLEL ((ULONG)0x00000002)
  240. #define SERIAL_SP_RS422 ((ULONG)0x00000003)
  241. #define SERIAL_SP_RS423 ((ULONG)0x00000004)
  242. #define SERIAL_SP_RS449 ((ULONG)0x00000005)
  243. #define SERIAL_SP_MODEM ((ULONG)0X00000006)
  244. #define SERIAL_SP_FAX ((ULONG)0x00000021)
  245. #define SERIAL_SP_SCANNER ((ULONG)0x00000022)
  246. #define SERIAL_SP_BRIDGE ((ULONG)0x00000100)
  247. #define SERIAL_SP_LAT ((ULONG)0x00000101)
  248. #define SERIAL_SP_TELNET ((ULONG)0x00000102)
  249. #define SERIAL_SP_X25 ((ULONG)0x00000103)
  250. //
  251. // Provider capabilities flags.
  252. //
  253. #define SERIAL_PCF_DTRDSR ((ULONG)0x0001)
  254. #define SERIAL_PCF_RTSCTS ((ULONG)0x0002)
  255. #define SERIAL_PCF_CD ((ULONG)0x0004)
  256. #define SERIAL_PCF_PARITY_CHECK ((ULONG)0x0008)
  257. #define SERIAL_PCF_XONXOFF ((ULONG)0x0010)
  258. #define SERIAL_PCF_SETXCHAR ((ULONG)0x0020)
  259. #define SERIAL_PCF_TOTALTIMEOUTS ((ULONG)0x0040)
  260. #define SERIAL_PCF_INTTIMEOUTS ((ULONG)0x0080)
  261. #define SERIAL_PCF_SPECIALCHARS ((ULONG)0x0100)
  262. #define SERIAL_PCF_16BITMODE ((ULONG)0x0200)
  263. //
  264. // Comm provider settable parameters.
  265. //
  266. #define SERIAL_SP_PARITY ((ULONG)0x0001)
  267. #define SERIAL_SP_BAUD ((ULONG)0x0002)
  268. #define SERIAL_SP_DATABITS ((ULONG)0x0004)
  269. #define SERIAL_SP_STOPBITS ((ULONG)0x0008)
  270. #define SERIAL_SP_HANDSHAKING ((ULONG)0x0010)
  271. #define SERIAL_SP_PARITY_CHECK ((ULONG)0x0020)
  272. #define SERIAL_SP_CARRIER_DETECT ((ULONG)0x0040)
  273. //
  274. // Settable baud rates in the provider.
  275. //
  276. #define SERIAL_BAUD_075 ((ULONG)0x00000001)
  277. #define SERIAL_BAUD_110 ((ULONG)0x00000002)
  278. #define SERIAL_BAUD_134_5 ((ULONG)0x00000004)
  279. #define SERIAL_BAUD_150 ((ULONG)0x00000008)
  280. #define SERIAL_BAUD_300 ((ULONG)0x00000010)
  281. #define SERIAL_BAUD_600 ((ULONG)0x00000020)
  282. #define SERIAL_BAUD_1200 ((ULONG)0x00000040)
  283. #define SERIAL_BAUD_1800 ((ULONG)0x00000080)
  284. #define SERIAL_BAUD_2400 ((ULONG)0x00000100)
  285. #define SERIAL_BAUD_4800 ((ULONG)0x00000200)
  286. #define SERIAL_BAUD_7200 ((ULONG)0x00000400)
  287. #define SERIAL_BAUD_9600 ((ULONG)0x00000800)
  288. #define SERIAL_BAUD_14400 ((ULONG)0x00001000)
  289. #define SERIAL_BAUD_19200 ((ULONG)0x00002000)
  290. #define SERIAL_BAUD_38400 ((ULONG)0x00004000)
  291. #define SERIAL_BAUD_56K ((ULONG)0x00008000)
  292. #define SERIAL_BAUD_128K ((ULONG)0x00010000)
  293. #define SERIAL_BAUD_115200 ((ULONG)0x00020000)
  294. #define SERIAL_BAUD_57600 ((ULONG)0x00040000)
  295. #define SERIAL_BAUD_USER ((ULONG)0x10000000)
  296. //
  297. // Settable Data Bits
  298. //
  299. #define SERIAL_DATABITS_5 ((USHORT)0x0001)
  300. #define SERIAL_DATABITS_6 ((USHORT)0x0002)
  301. #define SERIAL_DATABITS_7 ((USHORT)0x0004)
  302. #define SERIAL_DATABITS_8 ((USHORT)0x0008)
  303. #define SERIAL_DATABITS_16 ((USHORT)0x0010)
  304. #define SERIAL_DATABITS_16X ((USHORT)0x0020)
  305. //
  306. // Settable Stop and Parity bits.
  307. //
  308. #define SERIAL_STOPBITS_10 ((USHORT)0x0001)
  309. #define SERIAL_STOPBITS_15 ((USHORT)0x0002)
  310. #define SERIAL_STOPBITS_20 ((USHORT)0x0004)
  311. #define SERIAL_PARITY_NONE ((USHORT)0x0100)
  312. #define SERIAL_PARITY_ODD ((USHORT)0x0200)
  313. #define SERIAL_PARITY_EVEN ((USHORT)0x0400)
  314. #define SERIAL_PARITY_MARK ((USHORT)0x0800)
  315. #define SERIAL_PARITY_SPACE ((USHORT)0x1000)
  316. #endif // __DDKINC_H__