home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / geninc32.pak / WINIOCTL.H < prev    next >
C/C++ Source or Header  |  1997-07-23  |  21KB  |  577 lines

  1. /*++ BUILD Version: 0012    // Increment this if a change has global effects
  2.  
  3. Copyright (c) 1990-1995  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_
  18. #define _WINIOCTL_
  19.  
  20.  
  21. #ifndef _DEVIOCTL_
  22. #define _DEVIOCTL_
  23.  
  24. // begin_ntddk begin_nthal begin_ntifs
  25. //
  26. // Define the various device type values.  Note that values used by Microsoft
  27. // Corporation are in the range 0-32767, and 32768-65535 are reserved for use
  28. // by customers.
  29. //
  30.  
  31. #define DEVICE_TYPE DWORD
  32.  
  33. #define FILE_DEVICE_BEEP                0x00000001
  34. #define FILE_DEVICE_CD_ROM              0x00000002
  35. #define FILE_DEVICE_CD_ROM_FILE_SYSTEM  0x00000003
  36. #define FILE_DEVICE_CONTROLLER          0x00000004
  37. #define FILE_DEVICE_DATALINK            0x00000005
  38. #define FILE_DEVICE_DFS                 0x00000006
  39. #define FILE_DEVICE_DISK                0x00000007
  40. #define FILE_DEVICE_DISK_FILE_SYSTEM    0x00000008
  41. #define FILE_DEVICE_FILE_SYSTEM         0x00000009
  42. #define FILE_DEVICE_INPORT_PORT         0x0000000a
  43. #define FILE_DEVICE_KEYBOARD            0x0000000b
  44. #define FILE_DEVICE_MAILSLOT            0x0000000c
  45. #define FILE_DEVICE_MIDI_IN             0x0000000d
  46. #define FILE_DEVICE_MIDI_OUT            0x0000000e
  47. #define FILE_DEVICE_MOUSE               0x0000000f
  48. #define FILE_DEVICE_MULTI_UNC_PROVIDER  0x00000010
  49. #define FILE_DEVICE_NAMED_PIPE          0x00000011
  50. #define FILE_DEVICE_NETWORK             0x00000012
  51. #define FILE_DEVICE_NETWORK_BROWSER     0x00000013
  52. #define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
  53. #define FILE_DEVICE_NULL                0x00000015
  54. #define FILE_DEVICE_PARALLEL_PORT       0x00000016
  55. #define FILE_DEVICE_PHYSICAL_NETCARD    0x00000017
  56. #define FILE_DEVICE_PRINTER             0x00000018
  57. #define FILE_DEVICE_SCANNER             0x00000019
  58. #define FILE_DEVICE_SERIAL_MOUSE_PORT   0x0000001a
  59. #define FILE_DEVICE_SERIAL_PORT         0x0000001b
  60. #define FILE_DEVICE_SCREEN              0x0000001c
  61. #define FILE_DEVICE_SOUND               0x0000001d
  62. #define FILE_DEVICE_STREAMS             0x0000001e
  63. #define FILE_DEVICE_TAPE                0x0000001f
  64. #define FILE_DEVICE_TAPE_FILE_SYSTEM    0x00000020
  65. #define FILE_DEVICE_TRANSPORT           0x00000021
  66. #define FILE_DEVICE_UNKNOWN             0x00000022
  67. #define FILE_DEVICE_VIDEO               0x00000023
  68. #define FILE_DEVICE_VIRTUAL_DISK        0x00000024
  69. #define FILE_DEVICE_WAVE_IN             0x00000025
  70. #define FILE_DEVICE_WAVE_OUT            0x00000026
  71. #define FILE_DEVICE_8042_PORT           0x00000027
  72. #define FILE_DEVICE_NETWORK_REDIRECTOR  0x00000028
  73. #define FILE_DEVICE_BATTERY             0x00000029
  74. #define FILE_DEVICE_BUS_EXTENDER        0x0000002a
  75.  
  76. //
  77. // Macro definition for defining IOCTL and FSCTL function control codes.  Note
  78. // that function codes 0-2047 are reserved for Microsoft Corporation, and
  79. // 2048-4095 are reserved for customers.
  80. //
  81.  
  82. #define CTL_CODE( DeviceType, Function, Method, Access ) (                 \
  83.     ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \
  84. )
  85.  
  86. //
  87. // Define the method codes for how buffers are passed for I/O and FS controls
  88. //
  89.  
  90. #define METHOD_BUFFERED                 0
  91. #define METHOD_IN_DIRECT                1
  92. #define METHOD_OUT_DIRECT               2
  93. #define METHOD_NEITHER                  3
  94.  
  95. //
  96. // Define the access check value for any access
  97. //
  98. //
  99. // The FILE_READ_ACCESS and FILE_WRITE_ACCESS constants are also defined in
  100. // ntioapi.h as FILE_READ_DATA and FILE_WRITE_DATA. The values for these
  101. // constants *MUST* always be in sync.
  102. //
  103.  
  104.  
  105. #define FILE_ANY_ACCESS                 0
  106. #define FILE_READ_ACCESS          ( 0x0001 )    // file & pipe
  107. #define FILE_WRITE_ACCESS         ( 0x0002 )    // file & pipe
  108.  
  109. // end_ntddk end_nthal end_ntifs
  110.  
  111. #endif // _DEVIOCTL_
  112.  
  113.  
  114. //
  115. // IoControlCode values for disk devices.
  116. //
  117.  
  118. #define IOCTL_DISK_BASE                 FILE_DEVICE_DISK
  119. #define IOCTL_DISK_GET_DRIVE_GEOMETRY   CTL_CODE(IOCTL_DISK_BASE, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS)
  120. #define IOCTL_DISK_GET_PARTITION_INFO   CTL_CODE(IOCTL_DISK_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
  121. #define IOCTL_DISK_SET_PARTITION_INFO   CTL_CODE(IOCTL_DISK_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  122. #define IOCTL_DISK_GET_DRIVE_LAYOUT     CTL_CODE(IOCTL_DISK_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
  123. #define IOCTL_DISK_SET_DRIVE_LAYOUT     CTL_CODE(IOCTL_DISK_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  124. #define IOCTL_DISK_VERIFY               CTL_CODE(IOCTL_DISK_BASE, 0x0005, METHOD_BUFFERED, FILE_ANY_ACCESS)
  125. #define IOCTL_DISK_FORMAT_TRACKS        CTL_CODE(IOCTL_DISK_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  126. #define IOCTL_DISK_REASSIGN_BLOCKS      CTL_CODE(IOCTL_DISK_BASE, 0x0007, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  127. #define IOCTL_DISK_PERFORMANCE          CTL_CODE(IOCTL_DISK_BASE, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
  128. #define IOCTL_DISK_IS_WRITABLE          CTL_CODE(IOCTL_DISK_BASE, 0x0009, METHOD_BUFFERED, FILE_ANY_ACCESS)
  129. #define IOCTL_DISK_LOGGING              CTL_CODE(IOCTL_DISK_BASE, 0x000a, METHOD_BUFFERED, FILE_ANY_ACCESS)
  130. #define IOCTL_DISK_FORMAT_TRACKS_EX     CTL_CODE(IOCTL_DISK_BASE, 0x000b, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  131. #define IOCTL_DISK_HISTOGRAM_STRUCTURE    CTL_CODE(IOCTL_DISK_BASE, 0x000c, METHOD_BUFFERED, FILE_ANY_ACCESS)
  132. #define IOCTL_DISK_HISTOGRAM_DATA    CTL_CODE(IOCTL_DISK_BASE, 0x000d, METHOD_BUFFERED, FILE_ANY_ACCESS)
  133. #define IOCTL_DISK_HISTOGRAM_RESET    CTL_CODE(IOCTL_DISK_BASE, 0x000e, METHOD_BUFFERED, FILE_ANY_ACCESS)
  134. #define IOCTL_DISK_REQUEST_STRUCTURE    CTL_CODE(IOCTL_DISK_BASE, 0x000f, METHOD_BUFFERED, FILE_ANY_ACCESS)
  135. #define IOCTL_DISK_REQUEST_DATA        CTL_CODE(IOCTL_DISK_BASE, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
  136.  
  137. //
  138. // The following device control codes are common for all class drivers.  The
  139. // functions codes defined here must match all of the other class drivers.
  140. //
  141.  
  142. #define IOCTL_DISK_CHECK_VERIFY     CTL_CODE(IOCTL_DISK_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
  143. #define IOCTL_DISK_MEDIA_REMOVAL    CTL_CODE(IOCTL_DISK_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
  144. #define IOCTL_DISK_EJECT_MEDIA      CTL_CODE(IOCTL_DISK_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
  145. #define IOCTL_DISK_LOAD_MEDIA       CTL_CODE(IOCTL_DISK_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
  146. #define IOCTL_DISK_RESERVE          CTL_CODE(IOCTL_DISK_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
  147. #define IOCTL_DISK_RELEASE          CTL_CODE(IOCTL_DISK_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
  148. #define IOCTL_DISK_FIND_NEW_DEVICES CTL_CODE(IOCTL_DISK_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
  149. #define IOCTL_DISK_REMOVE_DEVICE    CTL_CODE(IOCTL_DISK_BASE, 0x0207, METHOD_BUFFERED, FILE_READ_ACCESS)
  150.  
  151. #define IOCTL_DISK_GET_MEDIA_TYPES CTL_CODE(IOCTL_DISK_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
  152.  
  153. //
  154. // Define the partition types returnable by known disk drivers.
  155. //
  156.  
  157. #define PARTITION_ENTRY_UNUSED          0x00      // Entry unused
  158. #define PARTITION_FAT_12                0x01      // 12-bit FAT entries
  159. #define PARTITION_XENIX_1               0x02      // Xenix
  160. #define PARTITION_XENIX_2               0x03      // Xenix
  161. #define PARTITION_FAT_16                0x04      // 16-bit FAT entries
  162. #define PARTITION_EXTENDED              0x05      // Extended partition entry
  163. #define PARTITION_HUGE                  0x06      // Huge partition MS-DOS V4
  164. #define PARTITION_IFS                   0x07      // IFS Partition
  165. #define PARTITION_PREP                  0x41      // PowerPC Reference Platform (PReP) Boot Partition
  166. #define PARTITION_UNIX                  0x63      // Unix
  167.  
  168. #define VALID_NTFT                      0xC0      // NTFT uses high order bits
  169.  
  170. //
  171. // The high bit of the partition type code indicates that a partition
  172. // is part of an NTFT mirror or striped array.
  173. //
  174.  
  175. #define PARTITION_NTFT                  0x80     // NTFT partition
  176.  
  177. //
  178. // The following macro is used to determine which partitions should be
  179. // assigned drive letters.
  180. //
  181.  
  182. //++
  183. //
  184. // BOOLEAN
  185. // IsRecognizedPartition(
  186. //     IN DWORD PartitionType
  187. //     )
  188. //
  189. // Routine Description:
  190. //
  191. //     This macro is used to determine to which partitions drive letters
  192. //     should be assigned.
  193. //
  194. // Arguments:
  195. //
  196. //     PartitionType - Supplies the type of the partition being examined.
  197. //
  198. // Return Value:
  199. //
  200. //     The return value is TRUE if the partition type is recognized,
  201. //     otherwise FALSE is returned.
  202. //
  203. //--
  204.  
  205. #define IsRecognizedPartition( PartitionType ) (       \
  206.      ((PartitionType & PARTITION_NTFT) && ((PartitionType & ~0xC0) == PARTITION_FAT_12)) ||  \
  207.      ((PartitionType & PARTITION_NTFT) && ((PartitionType & ~0xC0) == PARTITION_FAT_16)) ||  \
  208.      ((PartitionType & PARTITION_NTFT) && ((PartitionType & ~0xC0) == PARTITION_IFS)) ||  \
  209.      ((PartitionType & PARTITION_NTFT) && ((PartitionType & ~0xC0) == PARTITION_HUGE)) ||  \
  210.      ((PartitionType & ~PARTITION_NTFT) == PARTITION_FAT_12) ||  \
  211.      ((PartitionType & ~PARTITION_NTFT) == PARTITION_FAT_16) ||  \
  212.      ((PartitionType & ~PARTITION_NTFT) == PARTITION_IFS)    ||  \
  213.      ((PartitionType & ~PARTITION_NTFT) == PARTITION_HUGE) )
  214.  
  215. //
  216. // Define the media types supported by the driver.
  217. //
  218.  
  219. typedef enum _MEDIA_TYPE {
  220.     Unknown,                // Format is unknown
  221.     F5_1Pt2_512,            // 5.25", 1.2MB,  512 bytes/sector
  222.     F3_1Pt44_512,           // 3.5",  1.44MB, 512 bytes/sector
  223.     F3_2Pt88_512,           // 3.5",  2.88MB, 512 bytes/sector
  224.     F3_20Pt8_512,           // 3.5",  20.8MB, 512 bytes/sector
  225.     F3_720_512,             // 3.5",  720KB,  512 bytes/sector
  226.     F5_360_512,             // 5.25", 360KB,  512 bytes/sector
  227.     F5_320_512,             // 5.25", 320KB,  512 bytes/sector
  228.     F5_320_1024,            // 5.25", 320KB,  1024 bytes/sector
  229.     F5_180_512,             // 5.25", 180KB,  512 bytes/sector
  230.     F5_160_512,             // 5.25", 160KB,  512 bytes/sector
  231.     RemovableMedia,         // Removable media other than floppy
  232.     FixedMedia              // Fixed hard disk media
  233. } MEDIA_TYPE, *PMEDIA_TYPE;
  234.  
  235. //
  236. // Define the input buffer structure for the driver, when
  237. // it is called with IOCTL_DISK_FORMAT_TRACKS.
  238. //
  239.  
  240. typedef struct _FORMAT_PARAMETERS {
  241.    MEDIA_TYPE MediaType;
  242.    DWORD StartCylinderNumber;
  243.    DWORD EndCylinderNumber;
  244.    DWORD StartHeadNumber;
  245.    DWORD EndHeadNumber;
  246. } FORMAT_PARAMETERS, *PFORMAT_PARAMETERS;
  247.  
  248. //
  249. // Define the BAD_TRACK_NUMBER type. An array of elements of this type is
  250. // returned by the driver on IOCTL_DISK_FORMAT_TRACKS requests, to indicate
  251. // what tracks were bad during formatting. The length of that array is
  252. // reported in the `Information' field of the I/O Status Block.
  253. //
  254.  
  255. typedef WORD   BAD_TRACK_NUMBER;
  256. typedef WORD   *PBAD_TRACK_NUMBER;
  257.  
  258. //
  259. // Define the input buffer structure for the driver, when
  260. // it is called with IOCTL_DISK_FORMAT_TRACKS_EX.
  261. //
  262.  
  263. typedef struct _FORMAT_EX_PARAMETERS {
  264.    MEDIA_TYPE MediaType;
  265.    DWORD StartCylinderNumber;
  266.    DWORD EndCylinderNumber;
  267.    DWORD StartHeadNumber;
  268.    DWORD EndHeadNumber;
  269.    WORD   FormatGapLength;
  270.    WORD   SectorsPerTrack;
  271.    WORD   SectorNumber[1];
  272. } FORMAT_EX_PARAMETERS, *PFORMAT_EX_PARAMETERS;
  273.  
  274. //
  275. // The following structure is returned on an IOCTL_DISK_GET_DRIVE_GEOMETRY
  276. // request and an array of them is returned on an IOCTL_DISK_GET_MEDIA_TYPES
  277. // request.
  278. //
  279.  
  280. typedef struct _DISK_GEOMETRY {
  281.     LARGE_INTEGER Cylinders;
  282.     MEDIA_TYPE MediaType;
  283.     DWORD TracksPerCylinder;
  284.     DWORD SectorsPerTrack;
  285.     DWORD BytesPerSector;
  286. } DISK_GEOMETRY, *PDISK_GEOMETRY;
  287.  
  288. //
  289. // The following structure is returned on an IOCTL_DISK_GET_PARTITION_INFO
  290. // and an IOCTL_DISK_GET_DRIVE_LAYOUT request.  It is also used in a request
  291. // to change the drive layout, IOCTL_DISK_SET_DRIVE_LAYOUT.
  292. //
  293.  
  294. typedef struct _PARTITION_INFORMATION {
  295.     LARGE_INTEGER StartingOffset;
  296.     LARGE_INTEGER PartitionLength;
  297.     DWORD HiddenSectors;
  298.     DWORD PartitionNumber;
  299.     BYTE  PartitionType;
  300.     BOOLEAN BootIndicator;
  301.     BOOLEAN RecognizedPartition;
  302.     BOOLEAN RewritePartition;
  303. } PARTITION_INFORMATION, *PPARTITION_INFORMATION;
  304.  
  305. //
  306. // The following structure is used to change the partition type of a
  307. // specified disk partition using an IOCTL_DISK_SET_PARTITION_INFO
  308. // request.
  309. //
  310.  
  311. typedef struct _SET_PARTITION_INFORMATION {
  312.     BYTE  PartitionType;
  313. } SET_PARTITION_INFORMATION, *PSET_PARTITION_INFORMATION;
  314.  
  315. //
  316. // The following structures is returned on an IOCTL_DISK_GET_DRIVE_LAYOUT
  317. // request and given as input to an IOCTL_DISK_SET_DRIVE_LAYOUT request.
  318. //
  319.  
  320. typedef struct _DRIVE_LAYOUT_INFORMATION {
  321.     DWORD PartitionCount;
  322.     DWORD Signature;
  323.     PARTITION_INFORMATION PartitionEntry[1];
  324. } DRIVE_LAYOUT_INFORMATION, *PDRIVE_LAYOUT_INFORMATION;
  325.  
  326. //
  327. // The following structure is passed in on an IOCTL_DISK_VERIFY request.
  328. // The offset and length parameters are both given in bytes.
  329. //
  330.  
  331. typedef struct _VERIFY_INFORMATION {
  332.     LARGE_INTEGER StartingOffset;
  333.     DWORD Length;
  334. } VERIFY_INFORMATION, *PVERIFY_INFORMATION;
  335.  
  336. //
  337. // The following structure is passed in on an IOCTL_DISK_REASSIGN_BLOCKS
  338. // request.
  339. //
  340.  
  341. typedef struct _REASSIGN_BLOCKS {
  342.     WORD   Reserved;
  343.     WORD   Count;
  344.     DWORD BlockNumber[1];
  345. } REASSIGN_BLOCKS, *PREASSIGN_BLOCKS;
  346.  
  347. //
  348. // IOCTL_DISK_MEDIA_REMOVAL disables the mechanism
  349. // on a SCSI device that ejects media. This function
  350. // may or may not be supported on SCSI devices that
  351. // support removable media.
  352. //
  353. // TRUE means prevent media from being removed.
  354. // FALSE means allow media removal.
  355. //
  356.  
  357. typedef struct _PREVENT_MEDIA_REMOVAL {
  358.     BOOLEAN PreventMediaRemoval;
  359. } PREVENT_MEDIA_REMOVAL, *PPREVENT_MEDIA_REMOVAL;
  360.  
  361. ///////////////////////////////////////////////////////
  362. //                                                   //
  363. // The following structures define disk performance  //
  364. // statistics: specifically the locations of all the //
  365. // reads and writes which have occured on the disk.  //
  366. //                                                   //
  367. // To use these structures, you must issue an IOCTL_ //
  368. // DISK_HIST_STRUCTURE (with a DISK_HISTOGRAM) to    //
  369. // obtain the basic histogram information. The       //
  370. // number of buckets which must allocated is part of //
  371. // this structure. Allocate the required number of   //
  372. // buckets and call an IOCTL_DISK_HIST_DATA to fill  //
  373. // in the data                                       //
  374. //                                                   //
  375. ///////////////////////////////////////////////////////
  376.  
  377. #define HIST_NO_OF_BUCKETS    24
  378.  
  379. typedef struct _HISTOGRAM_BUCKET {
  380.     DWORD         Reads;
  381.     DWORD        Writes;
  382. } HISTOGRAM_BUCKET, *PHISTOGRAM_BUCKET;
  383.  
  384. #define HISTOGRAM_BUCKET_SIZE    sizeof(HISTOGRAM_BUCKET)
  385.  
  386. typedef struct _DISK_HISTOGRAM {
  387.     LARGE_INTEGER    DiskSize;
  388.     LARGE_INTEGER    Start;
  389.     LARGE_INTEGER    End;
  390.     LARGE_INTEGER    Average;
  391.     LARGE_INTEGER    AverageRead;
  392.     LARGE_INTEGER    AverageWrite;
  393.     DWORD        Granularity;
  394.     DWORD        Size;
  395.     DWORD        ReadCount;
  396.     DWORD        WriteCount;
  397.     PHISTOGRAM_BUCKET    Histogram;
  398. } DISK_HISTOGRAM, *PDISK_HISTOGRAM;
  399.  
  400. #define DISK_HISTOGRAM_SIZE    sizeof(DISK_HISTOGRAM)
  401.  
  402. ///////////////////////////////////////////////////////
  403. //                                                   //
  404. // The following structures define disk debugging    //
  405. // capabilities. The IOCTLs are directed to one of   //
  406. // the two disk filter drivers.                      //
  407. //                                                   //
  408. // DISKPERF is a utilty for collecting disk request  //
  409. // statistics.                                       //
  410. //                                                   //
  411. // SIMBAD is a utility for injecting faults in       //
  412. // IO requests to disks.                             //
  413. //                                                   //
  414. ///////////////////////////////////////////////////////
  415.  
  416. //
  417. // The following structure is exchanged on an IOCTL_DISK_GET_PERFORMANCE
  418. // request. This ioctl collects summary disk request statistics used
  419. // in measuring performance.
  420. //
  421.  
  422. typedef struct _DISK_PERFORMANCE {
  423.         LARGE_INTEGER BytesRead;
  424.         LARGE_INTEGER BytesWritten;
  425.         LARGE_INTEGER ReadTime;
  426.         LARGE_INTEGER WriteTime;
  427.         DWORD ReadCount;
  428.         DWORD WriteCount;
  429.         DWORD QueueDepth;
  430. } DISK_PERFORMANCE, *PDISK_PERFORMANCE;
  431.  
  432. //
  433. // This structure defines the disk logging record. When disk logging
  434. // is enabled, one of these is written to an internal buffer for each
  435. // disk request.
  436. //
  437.  
  438. typedef struct _DISK_RECORD {
  439.    LARGE_INTEGER ByteOffset;
  440.    LARGE_INTEGER StartTime;
  441.    LARGE_INTEGER EndTime;
  442.    PVOID VirtualAddress;
  443.    DWORD NumberOfBytes;
  444.    BYTE  DeviceNumber;
  445.    BOOLEAN ReadRequest;
  446. } DISK_RECORD, *PDISK_RECORD;
  447.  
  448. //
  449. // The following structure is exchanged on an IOCTL_DISK_LOG request.
  450. // Not all fields are valid with each function type.
  451. //
  452.  
  453. typedef struct _DISK_LOGGING {
  454.     BYTE  Function;
  455.     PVOID BufferAddress;
  456.     DWORD BufferSize;
  457. } DISK_LOGGING, *PDISK_LOGGING;
  458.  
  459. //
  460. // Disk logging functions
  461. //
  462. // Start disk logging. Only the Function and BufferSize fields are valid.
  463. //
  464.  
  465. #define DISK_LOGGING_START    0
  466.  
  467. //
  468. // Stop disk logging. Only the Function field is valid.
  469. //
  470.  
  471. #define DISK_LOGGING_STOP     1
  472.  
  473. //
  474. // Return disk log. All fields are valid. Data will be copied from internal
  475. // buffer to buffer specified for the number of bytes requested.
  476. //
  477.  
  478. #define DISK_LOGGING_DUMP     2
  479.  
  480. //
  481. // DISK BINNING
  482. //
  483. // DISKPERF will keep counters for IO that falls in each of these ranges.
  484. // The application determines the number and size of the ranges.
  485. // Joe Lin wanted me to keep it flexible as possible, for instance, IO
  486. // sizes are interesting in ranges like 0-4096, 4097-16384, 16385-65536, 65537+.
  487. //
  488.  
  489. #define DISK_BINNING          3
  490.  
  491. //
  492. // Bin types
  493. //
  494.  
  495. typedef enum _BIN_TYPES {
  496.     RequestSize,
  497.     RequestLocation
  498. } BIN_TYPES;
  499.  
  500. //
  501. // Bin ranges
  502. //
  503.  
  504. typedef struct _BIN_RANGE {
  505.     LARGE_INTEGER StartValue;
  506.     LARGE_INTEGER Length;
  507. } BIN_RANGE, *PBIN_RANGE;
  508.  
  509. //
  510. // Bin definition
  511. //
  512.  
  513. typedef struct _PERF_BIN {
  514.     DWORD NumberOfBins;
  515.     DWORD TypeOfBin;
  516.     BIN_RANGE BinsRanges[1];
  517. } PERF_BIN, *PPERF_BIN ;
  518.  
  519. //
  520. // Bin count
  521. //
  522.  
  523. typedef struct _BIN_COUNT {
  524.     BIN_RANGE BinRange;
  525.     DWORD BinCount;
  526. } BIN_COUNT, *PBIN_COUNT;
  527.  
  528. //
  529. // Bin results
  530. //
  531.  
  532. typedef struct _BIN_RESULTS {
  533.     DWORD NumberOfBins;
  534.     BIN_COUNT BinCounts[1];
  535. } BIN_RESULTS, *PBIN_RESULTS;
  536.  
  537.  
  538. #define IOCTL_SERIAL_LSRMST_INSERT      CTL_CODE(FILE_DEVICE_SERIAL_PORT,31,METHOD_BUFFERED,FILE_ANY_ACCESS)
  539.  
  540.  
  541. //
  542. // The following values follow the escape designator in the
  543. // data stream if the LSRMST_INSERT mode has been turned on.
  544. //
  545. #define SERIAL_LSRMST_ESCAPE     ((BYTE )0x00)
  546.  
  547. //
  548. // Following this value is the contents of the line status
  549. // register, and then the character in the RX hardware when
  550. // the line status register was encountered.
  551. //
  552. #define SERIAL_LSRMST_LSR_DATA   ((BYTE )0x01)
  553.  
  554. //
  555. // Following this value is the contents of the line status
  556. // register.  No error character follows
  557. //
  558. #define SERIAL_LSRMST_LSR_NODATA ((BYTE )0x02)
  559.  
  560. //
  561. // Following this value is the contents of the modem status
  562. // register.
  563. //
  564. #define SERIAL_LSRMST_MST        ((BYTE )0x03)
  565.  
  566. #define FSCTL_LOCK_VOLUME               CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
  567. #define FSCTL_UNLOCK_VOLUME             CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
  568. #define FSCTL_DISMOUNT_VOLUME           CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
  569. #define FSCTL_MOUNT_DBLS_VOLUME         CTL_CODE(FILE_DEVICE_FILE_SYSTEM,13, METHOD_BUFFERED, FILE_ANY_ACCESS)
  570. #define FSCTL_GET_COMPRESSION           CTL_CODE(FILE_DEVICE_FILE_SYSTEM,15, METHOD_BUFFERED, FILE_ANY_ACCESS)
  571. #define FSCTL_SET_COMPRESSION           CTL_CODE(FILE_DEVICE_FILE_SYSTEM,16, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
  572. #define FSCTL_READ_COMPRESSION          CTL_CODE(FILE_DEVICE_FILE_SYSTEM,17, METHOD_NEITHER,  FILE_READ_DATA)
  573. #define FSCTL_WRITE_COMPRESSION         CTL_CODE(FILE_DEVICE_FILE_SYSTEM,18, METHOD_NEITHER,  FILE_WRITE_DATA)
  574.  
  575. #endif // _WINIOCTL_
  576.  
  577.