home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 19.ddi / GENINC32.PAK / WINIOCTL.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  13.1 KB  |  383 lines

  1. /*++ BUILD Version: 0012    // Increment this if a change has global effects
  2.  
  3. Copyright (c) 1990-1992  Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     winioctl.h
  8.  
  9. Abstract:
  10.  
  11.     This module defines the 32-Bit Windows Device I/O control codes.
  12.  
  13. Revision History:
  14.  
  15. --*/
  16.  
  17. #ifndef __WINIOCTL_H
  18. #define __WINIOCTL_H
  19.  
  20.  
  21. #ifndef __WINBASE_H
  22. #include <winbase.h>
  23. #endif
  24.  
  25. #ifndef _DEVIOCTL_
  26. #define _DEVIOCTL_
  27.  
  28. // begin_ntddk begin_nthal
  29. //
  30. // Define the various device type values.  Note that values used by Microsoft
  31. // Corporation are in the range 0-32767, and 32768-65535 are reserved for use
  32. // by customers.
  33. //
  34.  
  35. #define DEVICE_TYPE DWORD
  36.  
  37. #define FILE_DEVICE_BEEP                0x00000001
  38. #define FILE_DEVICE_CD_ROM              0x00000002
  39. #define FILE_DEVICE_CD_ROM_FILE_SYSTEM  0x00000003
  40. #define FILE_DEVICE_CONTROLLER          0x00000004
  41. #define FILE_DEVICE_DATALINK            0x00000005
  42. #define FILE_DEVICE_DFS                 0x00000006
  43. #define FILE_DEVICE_DISK                0x00000007
  44. #define FILE_DEVICE_DISK_FILE_SYSTEM    0x00000008
  45. #define FILE_DEVICE_FILE_SYSTEM         0x00000009
  46. #define FILE_DEVICE_INPORT_PORT         0x0000000a
  47. #define FILE_DEVICE_KEYBOARD            0x0000000b
  48. #define FILE_DEVICE_MAILSLOT            0x0000000c
  49. #define FILE_DEVICE_MIDI_IN             0x0000000d
  50. #define FILE_DEVICE_MIDI_OUT            0x0000000e
  51. #define FILE_DEVICE_MOUSE               0x0000000f
  52. #define FILE_DEVICE_MULTI_UNC_PROVIDER  0x00000010
  53. #define FILE_DEVICE_NAMED_PIPE          0x00000011
  54. #define FILE_DEVICE_NETWORK             0x00000012
  55. #define FILE_DEVICE_NETWORK_BROWSER     0x00000013
  56. #define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
  57. #define FILE_DEVICE_NULL                0x00000015
  58. #define FILE_DEVICE_PARALLEL_PORT       0x00000016
  59. #define FILE_DEVICE_PHYSICAL_NETCARD    0x00000017
  60. #define FILE_DEVICE_PRINTER             0x00000018
  61. #define FILE_DEVICE_SCANNER             0x00000019
  62. #define FILE_DEVICE_SERIAL_MOUSE_PORT   0x0000001a
  63. #define FILE_DEVICE_SERIAL_PORT         0x0000001b
  64. #define FILE_DEVICE_SCREEN              0x0000001c
  65. #define FILE_DEVICE_SOUND               0x0000001d
  66. #define FILE_DEVICE_STREAMS             0x0000001e
  67. #define FILE_DEVICE_TAPE                0x0000001f
  68. #define FILE_DEVICE_TAPE_FILE_SYSTEM    0x00000020
  69. #define FILE_DEVICE_TRANSPORT           0x00000021
  70. #define FILE_DEVICE_UNKNOWN             0x00000022
  71. #define FILE_DEVICE_VIDEO               0x00000023
  72. #define FILE_DEVICE_VIRTUAL_DISK        0x00000024
  73. #define FILE_DEVICE_WAVE_IN             0x00000025
  74. #define FILE_DEVICE_WAVE_OUT            0x00000026
  75. #define FILE_DEVICE_8042_PORT           0x00000027
  76. #define FILE_DEVICE_NETWORK_REDIRECTOR  0x00000028
  77.  
  78. //
  79. // Macro definition for defining IOCTL and FSCTL function control codes.  Note
  80. // that function codes 0-2047 are reserved for Microsoft Corporation, and
  81. // 2048-4095 are reserved for customers.
  82. //
  83.  
  84. #define CTL_CODE( DeviceType, Function, Method, Access ) (                 \
  85.     ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \
  86. )
  87.  
  88. //
  89. // Define the method codes for how buffers are passed for I/O and FS controls
  90. //
  91.  
  92. #define METHOD_BUFFERED                 0
  93. #define METHOD_IN_DIRECT                1
  94. #define METHOD_OUT_DIRECT               2
  95. #define METHOD_NEITHER                  3
  96.  
  97. //
  98. // Define the access check value for any access
  99. //
  100. //
  101. // The FILE_READ_ACCESS and FILE_WRITE_ACCESS constants are also defined in
  102. // ntioapi.h as FILE_READ_DATA and FILE_WRITE_DATA. The values for these
  103. // constants *MUST* always be in sync.
  104. //
  105.  
  106.  
  107. #define FILE_ANY_ACCESS                 0
  108. #define FILE_READ_ACCESS          ( 0x0001 )    // file & pipe
  109. #define FILE_WRITE_ACCESS         ( 0x0002 )    // file & pipe
  110.  
  111. // end_ntddk end_nthal
  112.  
  113. #endif // _DEVIOCTL_
  114.  
  115.  
  116. //
  117. // IoControlCode values for disk devices.
  118. //
  119.  
  120. #define IOCTL_DISK_BASE                 FILE_DEVICE_DISK
  121. #define IOCTL_DISK_GET_DRIVE_GEOMETRY   CTL_CODE(IOCTL_DISK_BASE, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS)
  122. #define IOCTL_DISK_GET_PARTITION_INFO   CTL_CODE(IOCTL_DISK_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
  123. #define IOCTL_DISK_SET_PARTITION_INFO   CTL_CODE(IOCTL_DISK_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  124. #define IOCTL_DISK_GET_DRIVE_LAYOUT     CTL_CODE(IOCTL_DISK_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
  125. #define IOCTL_DISK_SET_DRIVE_LAYOUT     CTL_CODE(IOCTL_DISK_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  126. #define IOCTL_DISK_VERIFY               CTL_CODE(IOCTL_DISK_BASE, 0x0005, METHOD_BUFFERED, FILE_ANY_ACCESS)
  127. #define IOCTL_DISK_FORMAT_TRACKS        CTL_CODE(IOCTL_DISK_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  128. #define IOCTL_DISK_REASSIGN_BLOCKS      CTL_CODE(IOCTL_DISK_BASE, 0x0007, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  129. #define IOCTL_DISK_PERFORMANCE          CTL_CODE(IOCTL_DISK_BASE, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
  130. #define IOCTL_DISK_IS_WRITABLE          CTL_CODE(IOCTL_DISK_BASE, 0x0009, METHOD_BUFFERED, FILE_ANY_ACCESS)
  131.  
  132. //
  133. // The following device control codes are common for all class drivers.  The
  134. // functions codes defined here must match all of the other class drivers.
  135. //
  136.  
  137. #define IOCTL_DISK_CHECK_VERIFY CTL_CODE(IOCTL_DISK_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
  138. #define IOCTL_DISK_MEDIA_REMOVAL CTL_CODE(IOCTL_DISK_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
  139. #define IOCTL_DISK_EJECT_MEDIA  CTL_CODE(IOCTL_DISK_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
  140. #define IOCTL_DISK_LOAD_MEDIA   CTL_CODE(IOCTL_DISK_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
  141.  
  142.  
  143. #define IOCTL_DISK_GET_MEDIA_TYPES CTL_CODE(IOCTL_DISK_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
  144.  
  145. //
  146. // Define the partition types returnable by known disk drivers.
  147. //
  148.  
  149. #define PARTITION_ENTRY_UNUSED          0x00      // Entry unused
  150. #define PARTITION_FAT_12                0x01      // 12-bit FAT entries
  151. #define PARTITION_XENIX_1               0x02      // Xenix
  152. #define PARTITION_XENIX_2               0x03      // Xenix
  153. #define PARTITION_FAT_16                0x04      // 16-bit FAT entries
  154. #define PARTITION_EXTENDED              0x05      // Extended partition entry
  155. #define PARTITION_HUGE                  0x06      // Huge partition MS-DOS V4
  156. #define PARTITION_IFS                   0x07      // IFS Partition
  157. #define PARTITION_UNIX                  0x63      // Unix
  158.  
  159. #define VALID_NTFT                      0xC0      // NTFT uses high order bits
  160.  
  161. //
  162. // The following macro is used to determine which partitions should be
  163. // assigned drive letters.
  164. //
  165.  
  166. //++
  167. //
  168. // BOOLEAN
  169. // IsRecognizedPartition(
  170. //     IN DWORD PartitionType
  171. //     )
  172. //
  173. // Routine Description:
  174. //
  175. //     This macro is used to determine to which partitions drive letters
  176. //     should be assigned.
  177. //
  178. // Arguments:
  179. //
  180. //     PartitionType - Supplies the type of the partition being examined.
  181. //
  182. // Return Value:
  183. //
  184. //     The return value is TRUE if the partition type is recognized,
  185. //     otherwise FALSE is returned.
  186. //
  187. //--
  188.  
  189. #define IsRecognizedPartition( PartitionType ) (       \
  190.     (((PartitionType & ~0xC0) == PARTITION_FAT_12) ||  \
  191.      ((PartitionType & ~0xC0) == PARTITION_FAT_16) ||  \
  192.      ((PartitionType & ~0xC0) == PARTITION_IFS)    ||  \
  193.      ((PartitionType & ~0xC0) == PARTITION_HUGE)) )
  194.  
  195. //
  196. // The high bit of the partition type code indicates that a partition
  197. // is part of an NTFT mirror or striped array.
  198. //
  199.  
  200. #define PARTITION_NTFT                  0x80     // NTFT partition
  201.  
  202. //
  203. // Define the media types supported by the driver.
  204. //
  205.  
  206. typedef enum _MEDIA_TYPE {
  207.     Unknown,                // Format is unknown
  208.     F5_1Pt2_512,            // 5.25", 1.2MB,  512 bytes/sector
  209.     F3_1Pt44_512,           // 3.5",  1.44MB, 512 bytes/sector
  210.     F3_2Pt88_512,           // 3.5",  2.88MB, 512 bytes/sector
  211.     F3_20Pt8_512,           // 3.5",  20.8MB, 512 bytes/sector
  212.     F3_720_512,             // 3.5",  720KB,  512 bytes/sector
  213.     F5_360_512,             // 5.25", 360KB,  512 bytes/sector
  214.     F5_320_512,             // 5.25", 320KB,  512 bytes/sector
  215.     F5_320_1024,            // 5.25", 320KB,  1024 bytes/sector
  216.     F5_180_512,             // 5.25", 180KB,  512 bytes/sector
  217.     F5_160_512,             // 5.25", 160KB,  512 bytes/sector
  218.     RemovableMedia,         // Removable media other than floppy
  219.     FixedMedia              // Fixed hard disk media
  220. } MEDIA_TYPE, *PMEDIA_TYPE;
  221.  
  222. //
  223. // Define the input buffer structure for the driver, when
  224. // it is called with IOCTL_DISK_FORMAT_TRACKS.
  225. //
  226.  
  227. typedef struct _FORMAT_PARAMETERS {
  228.    MEDIA_TYPE MediaType;
  229.    DWORD StartCylinderNumber;
  230.    DWORD EndCylinderNumber;
  231.    DWORD StartHeadNumber;
  232.    DWORD EndHeadNumber;
  233. } FORMAT_PARAMETERS, *PFORMAT_PARAMETERS;
  234.  
  235. //
  236. // Define the BAD_TRACK_NUMBER type. An array of elements of this type is
  237. // returned by the driver on IOCTL_DISK_FORMAT_TRACKS requests, to indicate
  238. // what tracks were bad during formatting. The length of that array is
  239. // reported in the `Information' field of the I/O Status Block.
  240. //
  241.  
  242. typedef WORD   BAD_TRACK_NUMBER;
  243. typedef WORD   *PBAD_TRACK_NUMBER;
  244.  
  245. //
  246. // The following structure is returned on an IOCTL_DISK_GET_DRIVE_GEOMETRY
  247. // request and an array of them is returned on an IOCTL_DISK_GET_MEDIA_TYPES
  248. // request.
  249. //
  250.  
  251. typedef struct _DISK_GEOMETRY {
  252.     LARGE_INTEGER Cylinders;
  253.     MEDIA_TYPE MediaType;
  254.     DWORD TracksPerCylinder;
  255.     DWORD SectorsPerTrack;
  256.     DWORD BytesPerSector;
  257. } DISK_GEOMETRY, *PDISK_GEOMETRY;
  258.  
  259. //
  260. // The following structure is returned on an IOCTL_DISK_GET_PARTITION_INFO
  261. // and an IOCTL_DISK_GET_DRIVE_LAYOUT request.  It is also used in a request
  262. // to change the drive layout, IOCTL_DISK_SET_DRIVE_LAYOUT.
  263. //
  264.  
  265. typedef struct _PARTITION_INFORMATION {
  266.     LARGE_INTEGER StartingOffset;
  267.     LARGE_INTEGER PartitionLength;
  268.     LARGE_INTEGER HiddenSectors;
  269.     BYTE  PartitionType;
  270.     BOOLEAN BootIndicator;
  271.     BOOLEAN RecognizedPartition;
  272.     BOOLEAN RewritePartition;
  273. } PARTITION_INFORMATION, *PPARTITION_INFORMATION;
  274.  
  275. //
  276. // The following structure is used to change the partition type of a
  277. // specified disk partition using an IOCTL_DISK_SET_PARTITION_INFO
  278. // request.
  279. //
  280.  
  281. typedef struct _SET_PARTITION_INFORMATION {
  282.     BYTE  PartitionType;
  283. } SET_PARTITION_INFORMATION, *PSET_PARTITION_INFORMATION;
  284.  
  285. //
  286. // The following structures is returned on an IOCTL_DISK_GET_DRIVE_LAYOUT
  287. // request and given as input to an IOCTL_DISK_SET_DRIVE_LAYOUT request.
  288. //
  289.  
  290. typedef struct _DRIVE_LAYOUT_INFORMATION {
  291.     DWORD PartitionCount;
  292.     DWORD Signature;
  293.     PARTITION_INFORMATION PartitionEntry[1];
  294. } DRIVE_LAYOUT_INFORMATION, *PDRIVE_LAYOUT_INFORMATION;
  295.  
  296. //
  297. // The following structure is passed in on an IOCTL_DISK_VERIFY request.
  298. // The offset and length parameters are both given in bytes.
  299. //
  300.  
  301. typedef struct _VERIFY_INFORMATION {
  302.     LARGE_INTEGER StartingOffset;
  303.     DWORD Length;
  304. } VERIFY_INFORMATION, *PVERIFY_INFORMATION;
  305.  
  306. //
  307. // The following structure is passed in on an IOCTL_DISK_REASSIGN_BLOCKS
  308. // request.
  309. //
  310.  
  311. typedef struct _REASSIGN_BLOCKS {
  312.     WORD   Reserved;
  313.     WORD   Count;
  314.     DWORD BlockNumber[1];
  315. } REASSIGN_BLOCKS, *PREASSIGN_BLOCKS;
  316.  
  317. //
  318. // The following structure is exchanged on an IOCTL_DISK_GET_PERFORMANCE
  319. // request.
  320. //
  321.  
  322. typedef struct _DISK_PERFORMANCE {
  323.         LARGE_INTEGER BytesRead;
  324.         LARGE_INTEGER BytesWritten;
  325.         LARGE_INTEGER ReadTime;
  326.         LARGE_INTEGER WriteTime;
  327.         DWORD ReadCount;
  328.         DWORD WriteCount;
  329.         DWORD QueueDepth;
  330. } DISK_PERFORMANCE, *PDISK_PERFORMANCE;
  331.  
  332. //
  333. // IOCTL_DISK_MEDIA_REMOVAL disables the mechanism
  334. // on a SCSI device that ejects media. This function
  335. // may or may not be supported on SCSI devices that
  336. // support removable media.
  337. //
  338. // TRUE means prevent media from being removed.
  339. // FALSE means allow media removal.
  340. //
  341.  
  342. typedef struct _PREVENT_MEDIA_REMOVAL {
  343.     BOOLEAN PreventMediaRemoval;
  344. } PREVENT_MEDIA_REMOVAL, *PPREVENT_MEDIA_REMOVAL;
  345.  
  346.  
  347. #define IOCTL_SERIAL_LSRMST_INSERT      CTL_CODE(FILE_DEVICE_SERIAL_PORT,31,METHOD_BUFFERED,FILE_ANY_ACCESS)
  348.  
  349.  
  350. //
  351. // The following values follow the escape designator in the
  352. // data stream if the LSRMST_INSERT mode has been turned on.
  353. //
  354. #define SERIAL_LSRMST_ESCAPE     ((BYTE )0x00)
  355.  
  356. //
  357. // Following this value is the contents of the line status
  358. // register, and then the character in the RX hardware when
  359. // the line status register was encountered.
  360. //
  361. #define SERIAL_LSRMST_LSR_DATA   ((BYTE )0x01)
  362.  
  363. //
  364. // Following this value is the contents of the line status
  365. // register.  No error character follows
  366. //
  367. #define SERIAL_LSRMST_LSR_NODATA ((BYTE )0x02)
  368.  
  369. //
  370. // Following this value is the contents of the modem status
  371. // register.
  372. //
  373. #define SERIAL_LSRMST_MST        ((BYTE )0x03)
  374.  
  375.  
  376. #define FSCTL_LOCK_VOLUME               CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
  377. #define FSCTL_UNLOCK_VOLUME             CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
  378. #define FSCTL_DISMOUNT_VOLUME           CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
  379.  
  380.  
  381. #endif // _WINIOCTL_
  382.  
  383.