home *** CD-ROM | disk | FTP | other *** search
/ PC World 2000 November / PCWorld_2000-11_cd.bin / Software / Topware / devc40 / _SETUP.5 / Group3 / winioctl.h < prev    next >
C/C++ Source or Header  |  1999-11-07  |  10KB  |  256 lines

  1. #ifndef _WINIOCTL_H
  2. #define _WINIOCTL_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #define HIST_NO_OF_BUCKETS 24
  7. #define HISTOGRAM_BUCKET_SIZE sizeof(HISTOGRAM_BUCKET)
  8. #define DISK_HISTOGRAM_SIZE sizeof(DISK_HISTOGRAM)
  9. #define CTL_CODE(t,f,m,a) (((t)<<16)|((a)<<14)|((f)<<2)|(m))
  10. #define IOCTL_DISK_BASE FILE_DEVICE_DISK
  11. #define IOCTL_DISK_GET_DRIVE_GEOMETRY CTL_CODE(IOCTL_DISK_BASE,0,METHOD_BUFFERED, FILE_ANY_ACCESS)
  12. #define IOCTL_DISK_GET_PARTITION_INFO CTL_CODE(IOCTL_DISK_BASE,1,METHOD_BUFFERED,FILE_READ_ACCESS)
  13. #define IOCTL_DISK_SET_PARTITION_INFO CTL_CODE(IOCTL_DISK_BASE,2,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS)
  14. #define IOCTL_DISK_GET_DRIVE_LAYOUT    CTL_CODE(IOCTL_DISK_BASE,3,METHOD_BUFFERED,FILE_READ_ACCESS)
  15. #define IOCTL_DISK_SET_DRIVE_LAYOUT CTL_CODE(IOCTL_DISK_BASE,4,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS)
  16. #define IOCTL_DISK_VERIFY CTL_CODE(IOCTL_DISK_BASE,5,METHOD_BUFFERED,FILE_ANY_ACCESS)
  17. #define IOCTL_DISK_FORMAT_TRACKS CTL_CODE(IOCTL_DISK_BASE,6,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS)
  18. #define IOCTL_DISK_REASSIGN_BLOCKS CTL_CODE(IOCTL_DISK_BASE,7,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS)
  19. #define IOCTL_DISK_PERFORMANCE CTL_CODE(IOCTL_DISK_BASE,8,METHOD_BUFFERED,FILE_ANY_ACCESS)
  20. #define IOCTL_DISK_IS_WRITABLE CTL_CODE(IOCTL_DISK_BASE,9,METHOD_BUFFERED,FILE_ANY_ACCESS)
  21. #define IOCTL_DISK_LOGGING CTL_CODE(IOCTL_DISK_BASE,10,METHOD_BUFFERED,FILE_ANY_ACCESS)
  22. #define IOCTL_DISK_FORMAT_TRACKS_EX CTL_CODE(IOCTL_DISK_BASE,11,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS)
  23. #define IOCTL_DISK_HISTOGRAM_STRUCTURE CTL_CODE(IOCTL_DISK_BASE,12,METHOD_BUFFERED,FILE_ANY_ACCESS)
  24. #define IOCTL_DISK_HISTOGRAM_DATA CTL_CODE(IOCTL_DISK_BASE,13,METHOD_BUFFERED,FILE_ANY_ACCESS)
  25. #define IOCTL_DISK_HISTOGRAM_RESET CTL_CODE(IOCTL_DISK_BASE,14,METHOD_BUFFERED,FILE_ANY_ACCESS)
  26. #define IOCTL_DISK_REQUEST_STRUCTURE CTL_CODE(IOCTL_DISK_BASE,15,METHOD_BUFFERED,FILE_ANY_ACCESS)
  27. #define IOCTL_DISK_REQUEST_DATA CTL_CODE(IOCTL_DISK_BASE,16,METHOD_BUFFERED,FILE_ANY_ACCESS)
  28. #define IOCTL_DISK_CHECK_VERIFY CTL_CODE(IOCTL_DISK_BASE,0x200,METHOD_BUFFERED,FILE_READ_ACCESS)
  29. #define IOCTL_DISK_MEDIA_REMOVAL CTL_CODE(IOCTL_DISK_BASE,0x201,METHOD_BUFFERED,FILE_READ_ACCESS)
  30. #define IOCTL_DISK_EJECT_MEDIA CTL_CODE(IOCTL_DISK_BASE,0x202,METHOD_BUFFERED,FILE_READ_ACCESS)
  31. #define IOCTL_DISK_LOAD_MEDIA CTL_CODE(IOCTL_DISK_BASE,0x203,METHOD_BUFFERED,FILE_READ_ACCESS)
  32. #define IOCTL_DISK_RESERVE CTL_CODE(IOCTL_DISK_BASE,0x204,METHOD_BUFFERED,FILE_READ_ACCESS)
  33. #define IOCTL_DISK_RELEASE CTL_CODE(IOCTL_DISK_BASE,0x205,METHOD_BUFFERED,FILE_READ_ACCESS)
  34. #define IOCTL_DISK_FIND_NEW_DEVICES CTL_CODE(IOCTL_DISK_BASE,0x206,METHOD_BUFFERED,FILE_READ_ACCESS)
  35. #define IOCTL_DISK_REMOVE_DEVICE CTL_CODE(IOCTL_DISK_BASE,0x207,METHOD_BUFFERED,FILE_READ_ACCESS)
  36. #define IOCTL_DISK_GET_MEDIA_TYPES CTL_CODE(IOCTL_DISK_BASE,0x300,METHOD_BUFFERED,FILE_ANY_ACCESS)
  37. #define DEVICE_TYPE DWORD
  38. #define FILE_DEVICE_BEEP    1
  39. #define FILE_DEVICE_CD_ROM    2
  40. #define FILE_DEVICE_CD_ROM_FILE_SYSTEM    3
  41. #define FILE_DEVICE_CONTROLLER    4
  42. #define FILE_DEVICE_DATALINK    5
  43. #define FILE_DEVICE_DFS    6
  44. #define FILE_DEVICE_DISK    7
  45. #define FILE_DEVICE_DISK_FILE_SYSTEM    8
  46. #define FILE_DEVICE_FILE_SYSTEM    9
  47. #define FILE_DEVICE_INPORT_PORT    10
  48. #define FILE_DEVICE_KEYBOARD    11
  49. #define FILE_DEVICE_MAILSLOT    12
  50. #define FILE_DEVICE_MIDI_IN    13
  51. #define FILE_DEVICE_MIDI_OUT    14
  52. #define FILE_DEVICE_MOUSE    15
  53. #define FILE_DEVICE_MULTI_UNC_PROVIDER 16
  54. #define FILE_DEVICE_NAMED_PIPE    17
  55. #define FILE_DEVICE_NETWORK    18
  56. #define FILE_DEVICE_NETWORK_BROWSER    19
  57. #define FILE_DEVICE_NETWORK_FILE_SYSTEM    20
  58. #define FILE_DEVICE_NULL    21
  59. #define FILE_DEVICE_PARALLEL_PORT    22
  60. #define FILE_DEVICE_PHYSICAL_NETCARD    23
  61. #define FILE_DEVICE_PRINTER    24
  62. #define FILE_DEVICE_SCANNER    25
  63. #define FILE_DEVICE_SERIAL_MOUSE_PORT    26
  64. #define FILE_DEVICE_SERIAL_PORT    27
  65. #define FILE_DEVICE_SCREEN    28
  66. #define FILE_DEVICE_SOUND    29
  67. #define FILE_DEVICE_STREAMS    30
  68. #define FILE_DEVICE_TAPE    31
  69. #define FILE_DEVICE_TAPE_FILE_SYSTEM    32
  70. #define FILE_DEVICE_TRANSPORT    33
  71. #define FILE_DEVICE_UNKNOWN    34
  72. #define FILE_DEVICE_VIDEO    35
  73. #define FILE_DEVICE_VIRTUAL_DISK    36
  74. #define FILE_DEVICE_WAVE_IN    37
  75. #define FILE_DEVICE_WAVE_OUT    38
  76. #define FILE_DEVICE_8042_PORT    39
  77. #define FILE_DEVICE_NETWORK_REDIRECTOR    40
  78. #define FILE_DEVICE_BATTERY    41
  79. #define FILE_DEVICE_BUS_EXTENDER    41
  80. #define PARTITION_ENTRY_UNUSED    0
  81. #define PARTITION_FAT_12    1
  82. #define PARTITION_XENIX_1    2
  83. #define PARTITION_XENIX_2    3
  84. #define PARTITION_FAT_16    4
  85. #define PARTITION_EXTENDED    5
  86. #define PARTITION_HUGE    6
  87. #define PARTITION_IFS    7
  88. #define PARTITION_PREP    0x41
  89. #define PARTITION_UNIX    0x63
  90. #define PARTITION_NTFT    128
  91. #define VALID_NTFT    0xC0
  92. #define METHOD_BUFFERED    0
  93. #define METHOD_IN_DIRECT    1
  94. #define METHOD_OUT_DIRECT    2
  95. #define METHOD_NEITHER    3
  96. #define IOCTL_SERIAL_LSRMST_INSERT    CTL_CODE(FILE_DEVICE_SERIAL_PORT,31,METHOD_BUFFERED,FILE_ANY_ACCESS)
  97. #define SERIAL_LSRMST_ESCAPE    0
  98. #define SERIAL_LSRMST_LSR_DATA    1
  99. #define SERIAL_LSRMST_LSR_NODATA    2
  100. #define SERIAL_LSRMST_MST    3
  101. #define FILE_ANY_ACCESS    0
  102. #define FILE_READ_ACCESS    1
  103. #define FILE_WRITE_ACCESS    2
  104. #define DISK_LOGGING_START    0
  105. #define DISK_LOGGING_STOP    1
  106. #define DISK_LOGGING_DUMP    2
  107. #define DISK_BINNING    3
  108. #define FSCTL_LOCK_VOLUME    CTL_CODE(FILE_DEVICE_FILE_SYSTEM,6,METHOD_BUFFERED,FILE_ANY_ACCESS)
  109. #define FSCTL_UNLOCK_VOLUME    CTL_CODE(FILE_DEVICE_FILE_SYSTEM,7,METHOD_BUFFERED,FILE_ANY_ACCESS)
  110. #define FSCTL_DISMOUNT_VOLUME    CTL_CODE(FILE_DEVICE_FILE_SYSTEM,8,METHOD_BUFFERED,FILE_ANY_ACCESS)
  111. #define FSCTL_MOUNT_DBLS_VOLUME    CTL_CODE(FILE_DEVICE_FILE_SYSTEM,13,METHOD_BUFFERED,FILE_ANY_ACCESS)
  112. #define FSCTL_GET_COMPRESSION    CTL_CODE(FILE_DEVICE_FILE_SYSTEM,15,METHOD_BUFFERED,FILE_ANY_ACCESS)
  113. #define FSCTL_SET_COMPRESSION    CTL_CODE(FILE_DEVICE_FILE_SYSTEM,16,METHOD_BUFFERED,FILE_READ_DATA|FILE_WRITE_DATA)
  114. #define FSCTL_READ_COMPRESSION    CTL_CODE(FILE_DEVICE_FILE_SYSTEM,17,METHOD_NEITHER,FILE_READ_DATA)
  115. #define FSCTL_WRITE_COMPRESSION    CTL_CODE(FILE_DEVICE_FILE_SYSTEM,18,METHOD_NEITHER,FILE_WRITE_DATA)
  116. typedef WORD BAD_TRACK_NUMBER,*PBAD_TRACK_NUMBER;
  117. typedef enum _BIN_TYPES {RequestSize,RequestLocation} BIN_TYPES;
  118. typedef struct _BIN_RANGE {
  119.     LARGE_INTEGER StartValue;
  120.     LARGE_INTEGER Length;
  121. } BIN_RANGE,*PBIN_RANGE;
  122. typedef struct _BIN_COUNT {
  123.     BIN_RANGE BinRange;
  124.     DWORD BinCount;
  125. } BIN_COUNT,*PBIN_COUNT;
  126. typedef struct _BIN_RESULTS {
  127.     DWORD NumberOfBins;
  128.     BIN_COUNT BinCounts[1];
  129. } BIN_RESULTS,*PBIN_RESULTS;
  130. typedef enum _MEDIA_TYPE {
  131.     Unknown,
  132.     F5_1Pt2_512,
  133.     F3_1Pt44_512,
  134.     F3_2Pt88_512,
  135.     F3_20Pt8_512,
  136.     F3_720_512,
  137.     F5_360_512,
  138.     F5_320_512,
  139.     F5_320_1024,
  140.     F5_180_512,
  141.     F5_160_512,
  142.     RemovableMedia,
  143.     FixedMedia
  144. } MEDIA_TYPE;
  145. typedef struct _DISK_GEOMETRY {
  146.     LARGE_INTEGER Cylinders;
  147.     MEDIA_TYPE MediaType;
  148.     DWORD TracksPerCylinder;
  149.     DWORD SectorsPerTrack;
  150.     DWORD BytesPerSector;
  151. } DISK_GEOMETRY;
  152. typedef struct _DISK_PERFORMANCE {
  153.         LARGE_INTEGER BytesRead;
  154.         LARGE_INTEGER BytesWritten;
  155.         LARGE_INTEGER ReadTime;
  156.         LARGE_INTEGER WriteTime;
  157.         DWORD ReadCount;
  158.         DWORD WriteCount;
  159.         DWORD QueueDepth;
  160. } DISK_PERFORMANCE;
  161. typedef struct _DISK_RECORD {
  162.     LARGE_INTEGER ByteOffset;
  163.     LARGE_INTEGER StartTime;
  164.     LARGE_INTEGER EndTime;
  165.     PVOID VirtualAddress;
  166.     DWORD NumberOfBytes;
  167.     BYTE DeviceNumber;
  168.     BOOLEAN ReadRequest;
  169. } DISK_RECORD,*PDISK_RECORD;
  170. typedef struct _DISK_LOGGING {
  171.     BYTE Function;
  172.     PVOID BufferAddress;
  173.     DWORD BufferSize;
  174. } DISK_LOGGING,*PDISK_LOGGING;
  175. typedef struct _FORMAT_PARAMETERS {
  176.     MEDIA_TYPE MediaType;
  177.     DWORD StartCylinderNumber;
  178.     DWORD EndCylinderNumber;
  179.     DWORD StartHeadNumber;
  180.     DWORD EndHeadNumber;
  181. } FORMAT_PARAMETERS,*PFORMAT_PARAMETERS;
  182. typedef struct _FORMAT_EX_PARAMETERS {
  183.     MEDIA_TYPE MediaType;
  184.     DWORD StartCylinderNumber;
  185.     DWORD EndCylinderNumber;
  186.     DWORD StartHeadNumber;
  187.     DWORD EndHeadNumber;
  188.     WORD FormatGapLength;
  189.     WORD SectorsPerTrack;
  190.     WORD SectorNumber[1];
  191. } FORMAT_EX_PARAMETERS,*PFORMAT_EX_PARAMETERS;
  192. typedef struct _HISTOGRAM_BUCKET {
  193.     DWORD Reads;
  194.     DWORD Writes;
  195. } HISTOGRAM_BUCKET,*PHISTOGRAM_BUCKET;
  196. typedef struct _DISK_HISTOGRAM {
  197.     LARGE_INTEGER DiskSize;
  198.     LARGE_INTEGER Start;
  199.     LARGE_INTEGER End;
  200.     LARGE_INTEGER Average;
  201.     LARGE_INTEGER AverageRead;
  202.     LARGE_INTEGER AverageWrite;
  203.     DWORD Granularity;
  204.     DWORD Size;
  205.     DWORD ReadCount;
  206.     DWORD WriteCount;
  207.     PHISTOGRAM_BUCKET Histogram;
  208. } DISK_HISTOGRAM,*PDISK_HISTOGRAM;
  209. typedef struct _PARTITION_INFORMATION {
  210.     LARGE_INTEGER StartingOffset;
  211.     LARGE_INTEGER PartitionLength;
  212.     DWORD HiddenSectors;
  213.     DWORD PartitionNumber;
  214.     BYTE PartitionType;
  215.     BOOLEAN BootIndicator;
  216.     BOOLEAN RecognizedPartition;
  217.     BOOLEAN RewritePartition;
  218. } PARTITION_INFORMATION,*PPARTITION_INFORMATION;
  219. typedef struct _DRIVE_LAYOUT_INFORMATION {
  220.     DWORD PartitionCount;
  221.     DWORD Signature;
  222.     PARTITION_INFORMATION PartitionEntry[1];
  223. } DRIVE_LAYOUT_INFORMATION;
  224. typedef struct _PERF_BIN {
  225.     DWORD NumberOfBins;
  226.     DWORD TypeOfBin;
  227.     BIN_RANGE BinsRanges[1];
  228. } PERF_BIN,*PPERF_BIN;
  229. typedef struct _PREVENT_MEDIA_REMOVAL {
  230.     BOOLEAN PreventMediaRemoval;
  231. } PREVENT_MEDIA_REMOVAL,*PPREVENT_MEDIA_REMOVAL;
  232. typedef struct _REASSIGN_BLOCKS {
  233.     WORD Reserved;
  234.     WORD Count;
  235.     DWORD BlockNumber[1];
  236. } REASSIGN_BLOCKS,*PREASSIGN_BLOCKS;
  237. typedef struct _SET_PARTITION_INFORMATION {
  238.     BYTE PartitionType;
  239. } SET_PARTITION_INFORMATION,*PSET_PARTITION_INFORMATION;
  240. typedef struct _VERIFY_INFORMATION {
  241.     LARGE_INTEGER StartingOffset;
  242.     DWORD Length;
  243. } VERIFY_INFORMATION,*PVERIFY_INFORMATION;
  244. #define IsRecognizedPartition(t) (((t&PARTITION_NTFT)&&((t&~0xC0)==PARTITION_FAT_12))||\
  245.     ((t&PARTITION_NTFT)&&((t&~0xC0)==PARTITION_FAT_16))||\
  246.     ((t&PARTITION_NTFT)&&((t&~0xC0)==PARTITION_IFS))||\
  247.     ((t&PARTITION_NTFT)&&((t&~0xC0)==PARTITION_HUGE))||\
  248.     ((t&~PARTITION_NTFT)==PARTITION_FAT_12)||\
  249.     ((t&~PARTITION_NTFT)==PARTITION_FAT_16)||\
  250.     ((t&~PARTITION_NTFT)==PARTITION_IFS)||\
  251.     ((t&~PARTITION_NTFT)==PARTITION_HUGE))
  252. #ifdef __cplusplus
  253. }
  254. #endif
  255. #endif
  256.