Source code of Windows XP (NT5)
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.

219 lines
7.4 KiB

  1. ;/*
  2. ;***************************************************************************;
  3. ;* Microsoft MS-DOS CDROM Extensions *;
  4. ;* Copyright (C) Microsoft Corporation, 1992 - 1999*;
  5. ;***************************************************************************;
  6. ;* :ts=4 ; tab-size=4 *;
  7. ;**
  8. ;* DEVSYM.H
  9. ;*
  10. ;* DESCRIPTION:
  11. ;*
  12. ;* HISTORY:
  13. ;*
  14. ;**
  15. ;------------------------------ INCLUDES -----------------------------------;
  16. include redir\devsym.inc
  17. ;---------------------------------------------------------------------------;
  18. SYSDEV2 STRUC
  19. SDEVREC DB size SYSDEV dup (?)
  20. SDEVRSVD DW ?
  21. SDEVLET DB ?
  22. SDEVUNITS DB ?
  23. SYSDEV2 ENDS
  24. DEVRDL = 128 ; Read long
  25. DEVRDLNB = 129 ; Read long non blocking
  26. DEVRDLPRE = 130 ; Read long prefetch
  27. DEVSEEK = 131 ; Seek long
  28. DEVPLAY = 132 ; Device Play
  29. DEVSTOP = 133 ; Stop device play
  30. DEVWRTL = 134 ; Write long
  31. DEVWRTLNB = 135 ; Write long nonblocking
  32. DEVWRTLV = 136 ; Write long verify
  33. ;*/
  34. /* Device table and SRH definition */
  35. /* The device table list has the form: */
  36. typedef struct SYSDEV {
  37. struct SYSDEV far *sdevnext; /* Pointer to next dev header */
  38. unsigned short sdevatt; /* Attributes of the device */
  39. void (*sdevstrat)(); /* Strategy entry point */
  40. void (*sdevint)(); /* Interrupt entry point */
  41. unsigned char sdevname[8]; /* Name of device (only first byte used for block) */
  42. unsigned short sdevrsvd; /* Reserved word */
  43. unsigned char sdevlet; /* Drive letter of first unit */
  44. unsigned char sdevunits; /* Number of units handled */
  45. } SYSDEV;
  46. /*
  47. ** Attribute bit masks
  48. **
  49. ** Character devices:
  50. **
  51. ** Bit 15 -> must be 1
  52. ** 14 -> 1 if the device understands IOCTL control strings
  53. ** 13 -> 1 if the device supports output-until-busy
  54. ** 12 -> unused
  55. ** 11 -> 1 if the device understands Open/Close
  56. ** 10 -> must be 0
  57. ** 9 -> must be 0
  58. ** 8 -> unused
  59. ** 7 -> unused
  60. ** 6 -> unused
  61. ** 5 -> unused
  62. ** 4 -> 1 if device is recipient of INT 29h
  63. ** 3 -> 1 if device is clock device
  64. ** 2 -> 1 if device is null device
  65. ** 1 -> 1 if device is console output
  66. ** 0 -> 1 if device is console input
  67. **
  68. ** Block devices:
  69. **
  70. ** Bit 15 -> must be 0
  71. ** 14 -> 1 if the device understands IOCTL control strings
  72. ** 13 -> 1 if the device determines media by examining the FAT ID byte.
  73. ** This requires the first sector of the fat to *always* reside in
  74. ** the same place.
  75. ** 12 -> unused
  76. ** 11 -> 1 if the device understands Open/Close/removable media
  77. ** 10 -> must be 0
  78. ** 9 -> must be 0
  79. ** 8 -> unused
  80. ** 7 -> unused
  81. ** 6 -> if device has support for GetMap/SetMap of Logical Drives.
  82. ** if the device understands Generic IOCTL function calls.
  83. ** 5 -> unused
  84. ** 4 -> unused
  85. ** 3 -> unused
  86. ** 2 -> unused
  87. ** 1 -> unused
  88. ** 0 -> unused
  89. */
  90. #define DevTyp 0x8000 /* Bit 15 - 1 if Char, 0 if block */
  91. #define CharDev 0x8000
  92. #define DevIOCtl 0x4000 /* Bit 14 - CONTROL mode bit */
  93. #define ISFATBYDEV 0x2000 /* Bit 13 - Device uses FAT ID bytes, */
  94. /* comp media. */
  95. #define OutTilBusy 0x2000 /* Output until busy is enabled */
  96. #define ISNET 0x1000 /* Bit 12 - 1 if a NET device, 0 if */
  97. /* not. Currently block only. */
  98. #define DEVOPCL 0x0800 /* Bit 11 - 1 if this device has */
  99. /* OPEN,CLOSE and REMOVABLE MEDIA */
  100. /* entry points, 0 if not */
  101. #define EXTENTBIT 0x0400 /* Bit 10 - Currently 0 on all devs */
  102. /* This bit is reserved for future use */
  103. /* to extend the device header beyond */
  104. /* its current form. */
  105. /* NOTE Bit 9 is currently used on IBM systems to indicate "drive is shared".
  106. ** See IOCTL function 9. THIS USE IS NOT DOCUMENTED, it is used by some
  107. ** of the utilities which are supposed to FAIL on shared drives on server
  108. ** machines (FORMAT,CHKDSK,RECOVER,..).
  109. */
  110. #define DEV320 0x0040 /* Bit 6 - For block devices, this */
  111. /* device supports Set/Get Map of */
  112. /* logical drives, and supports */
  113. /* Generic IOCTL calls. */
  114. /* For character devices, this */
  115. /* device supports Generic IOCTL. */
  116. /* This is a DOS 3.2 device driver. */
  117. #define ISSPEC 0x0010 /* Bit 4 - This device is special */
  118. #define ISCLOCK 0x0008 /* Bit 3 - This device is the clock device. */
  119. #define ISNULL 0x0004 /* Bit 2 - This device is the null device. */
  120. #define ISCOUT 0x0002 /* Bit 1 - This device is the console output. */
  121. #define ISCIN 0x0001 /* Bit 0 - This device is the console input. */
  122. /* Static Request Header */
  123. typedef struct SRHEAD {
  124. unsigned char REQLEN; /* Length in bytes of request block */
  125. unsigned char REQUNIT; /* Device unit number */
  126. unsigned char REQFUNC; /* Type of request */
  127. unsigned short REQSTAT; /* Status Word */
  128. unsigned char REQQLNK[8]; /* Reserved for queue links */
  129. } SRHEAD;
  130. /* Status word masks */
  131. #define STERR 0x8000 /* Bit 15 - Error */
  132. #define STBUI 0x0200 /* Bit 9 - Busy */
  133. #define STDON 0x0100 /* Bit 8 - Done */
  134. #define STECODE 0x00FF /* Error code */
  135. /* Function codes */
  136. #define DEVINIT 0 /* Initialization */
  137. #define DINITHL 26 /* Size of init header */
  138. #define DEVMDCH 1 /* Media check */
  139. #define DMEDHL 15 /* Size of media check header */
  140. #define DEVBPB 2 /* Get BPB */
  141. #define DEVRDIOCTL 3 /* IOCTL read */
  142. #define DBPBHL 22 /* Size of Get BPB header */
  143. #define DEVRD 4 /* Read */
  144. #define DRDWRHL 22 /* Size of RD/WR header */
  145. #define DEVRDND 5 /* Non destructive read no wait (char devs) */
  146. #define DRDNDHL 14 /* Size of non destructive read header */
  147. #define DEVIST 6 /* Input status */
  148. #define DSTATHL 13 /* Size of status header */
  149. #define DEVIFL 7 /* Input flush */
  150. #define DFLSHL 15 /* Size of flush header */
  151. #define DEVWRT 8 /* Write */
  152. #define DEVWRTV 9 /* Write with verify */
  153. #define DEVOST 10 /* Output status */
  154. #define DEVOFL 11 /* Output flush */
  155. #define DEVWRIOCTL 12 /* IOCTL write */
  156. #define DEVOPN 13 /* Device open */
  157. #define DEVCLS 14 /* Device close */
  158. #define DOPCLHL 13 /* Size of OPEN/CLOSE header */
  159. #define DEVRMD 15 /* Removable media */
  160. #define REMHL 13 /* Size of Removable media header */
  161. #define GENIOCTL 19
  162. /* The next three are used in DOS 4.0
  163. ** 20
  164. ** 21
  165. ** 22
  166. */
  167. #define DEVGETOWN 23 /* Get Device Owner */
  168. #define DEVSETOWN 24 /* Set Device Owner */
  169. #define OWNHL 13 /* Size of Device Owner header */
  170. #define DevOUT 16 /* output until busy. */
  171. #define DevOutL DevWrt /* length of output until busy */
  172. #define DEVRDL 128 /* Read long */
  173. #define DEVRDLNB 129 /* Read long non blocking */
  174. #define DEVRDLPRE 130 /* Read long prefetch */
  175. #define DEVSEEK 131 /* Seek long */
  176. #define DEVPLAY 132 /* Device Play */
  177. #define DEVSTOP 133 /* Stop device play */
  178. #define DEVWRTL 134 /* Write long */
  179. #define DEVWRTLNB 135 /* Write long nonblocking */
  180. #define DEVWRTLV 136 /* Write long verify */
  181. /* Generic IOCTL Request structure
  182. ** See the DOS 4.0 Device Driver Spec for Further elaboration.
  183. */
  184. typedef struct IOCTL_Req {
  185. struct SRHEAD ReqHdr;
  186. /* Generic IOCTL addition. */
  187. unsigned char MajorFunction; /* Function Code */
  188. unsigned char MinorFunction; /* Function Category */
  189. unsigned short Reg_SI;
  190. unsigned short Reg_DI;
  191. unsigned char far *GenericIOCTL_Packet; /* Pointer to Data Buffer */
  192. } IOCTL_Req;
  193. /* Definitions for IOCTL_Req.MinorFunction */
  194. #define GEN_IOCTL_WRT_TRK 0x40
  195. #define GEN_IOCTL_RD_TRK 0x60
  196. #define GEN_IOCTL_FN_TST 0x20 /* Used to diff. bet reads and wrts */
  197. \