Annotation of mstools/h/winioctl.h, revision 1.1.1.1

1.1       root        1: /*++ BUILD Version: 0011    // 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_
                     18: #define _WINIOCTL_
                     19: 
                     20: 
                     21: #ifndef _DEVIOCTL_
                     22: #define _DEVIOCTL_
                     23: 
                     24: //
                     25: // Define the various device type values.  Note that values used by Microsoft
                     26: // Corporation are in the range 0-32767, and 32768-65535 are reserved for use
                     27: // by customers.
                     28: //
                     29: 
                     30: #define DEVICE_TYPE DWORD
                     31: 
                     32: #define FILE_DEVICE_BEEP                0x00000001
                     33: #define FILE_DEVICE_CD_ROM              0x00000002
                     34: #define FILE_DEVICE_CD_ROM_FILE_SYSTEM  0x00000003
                     35: #define FILE_DEVICE_CONTROLLER          0x00000004
                     36: #define FILE_DEVICE_DATALINK            0x00000005
                     37: #define FILE_DEVICE_DFS                 0x00000006
                     38: #define FILE_DEVICE_DISK                0x00000007
                     39: #define FILE_DEVICE_DISK_FILE_SYSTEM    0x00000008
                     40: #define FILE_DEVICE_FILE_SYSTEM         0x00000009
                     41: #define FILE_DEVICE_INPORT_PORT         0x0000000a
                     42: #define FILE_DEVICE_KEYBOARD            0x0000000b
                     43: #define FILE_DEVICE_MAILSLOT            0x0000000c
                     44: #define FILE_DEVICE_MIDI_IN             0x0000000d
                     45: #define FILE_DEVICE_MIDI_OUT            0x0000000e
                     46: #define FILE_DEVICE_MOUSE               0x0000000f
                     47: #define FILE_DEVICE_MULTI_UNC_PROVIDER  0x00000010
                     48: #define FILE_DEVICE_NAMED_PIPE          0x00000011
                     49: #define FILE_DEVICE_NETWORK             0x00000012
                     50: #define FILE_DEVICE_NETWORK_BROWSER     0x00000013
                     51: #define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
                     52: #define FILE_DEVICE_NULL                0x00000015
                     53: #define FILE_DEVICE_PARALLEL_PORT       0x00000016
                     54: #define FILE_DEVICE_PHYSICAL_NETCARD    0x00000017
                     55: #define FILE_DEVICE_PRINTER             0x00000018
                     56: #define FILE_DEVICE_SCANNER             0x00000019
                     57: #define FILE_DEVICE_SERIAL_MOUSE_PORT   0x0000001a
                     58: #define FILE_DEVICE_SERIAL_PORT         0x0000001b
                     59: #define FILE_DEVICE_SCREEN              0x0000001c
                     60: #define FILE_DEVICE_SOUND               0x0000001d
                     61: #define FILE_DEVICE_STREAMS             0x0000001e
                     62: #define FILE_DEVICE_TAPE                0x0000001f
                     63: #define FILE_DEVICE_TAPE_FILE_SYSTEM    0x00000020
                     64: #define FILE_DEVICE_TRANSPORT           0x00000021
                     65: #define FILE_DEVICE_UNKNOWN             0x00000022
                     66: #define FILE_DEVICE_VIDEO               0x00000023
                     67: #define FILE_DEVICE_VIRTUAL_DISK        0x00000024
                     68: #define FILE_DEVICE_WAVE_IN             0x00000025
                     69: #define FILE_DEVICE_WAVE_OUT            0x00000026
                     70: #define FILE_DEVICE_8042_PORT           0x00000027
                     71: 
                     72: //
                     73: // Macro definition for defining IOCTL and FSCTL function control codes.  Note
                     74: // that function codes 0-2047 are reserved for Microsoft Corporation, and
                     75: // 2048-4095 are reserved for customers.
                     76: //
                     77: 
                     78: #define CTL_CODE( DeviceType, Function, Method, Access ) (                 \
                     79:     ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \
                     80: )
                     81: 
                     82: //
                     83: // Define the method codes for how buffers are passed for I/O and FS controls
                     84: //
                     85: 
                     86: #define METHOD_BUFFERED                 0
                     87: #define METHOD_IN_DIRECT                1
                     88: #define METHOD_OUT_DIRECT               2
                     89: #define METHOD_NEITHER                  3
                     90: 
                     91: //
                     92: // Define the access check value for any access
                     93: //
                     94: //
                     95: // The FILE_READ_ACCESS and FILE_WRITE_ACCESS constants are also defined in
                     96: // ntioapi.h as FILE_READ_DATA and FILE_WRITE_DATA. The values for these
                     97: // constants *MUST* always be in sync.
                     98: //
                     99: 
                    100: 
                    101: #define FILE_ANY_ACCESS                 0
                    102: #define FILE_READ_ACCESS          ( 0x0001 )    // file & pipe
                    103: #define FILE_WRITE_ACCESS         ( 0x0002 )    // file & pipe
                    104: 
                    105: #endif // _DEVIOCTL_
                    106: 
                    107: 
                    108: //
                    109: // IoControlCode values for this device.
                    110: //
                    111: // Warning:  Remember that the low two bits of the code specify how the
                    112: //           buffers are passed to the driver!
                    113: //
                    114: 
                    115: #define IOCTL_DISK_BASE                 FILE_DEVICE_DISK
                    116: #define IOCTL_DISK_GET_DRIVE_GEOMETRY   CTL_CODE(IOCTL_DISK_BASE, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    117: #define IOCTL_DISK_GET_PARTITION_INFO   CTL_CODE(IOCTL_DISK_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
                    118: #define IOCTL_DISK_SET_PARTITION_INFO   CTL_CODE(IOCTL_DISK_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
                    119: #define IOCTL_DISK_GET_DRIVE_LAYOUT     CTL_CODE(IOCTL_DISK_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
                    120: #define IOCTL_DISK_SET_DRIVE_LAYOUT     CTL_CODE(IOCTL_DISK_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
                    121: #define IOCTL_DISK_VERIFY               CTL_CODE(IOCTL_DISK_BASE, 0x0005, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    122: #define IOCTL_DISK_FORMAT_TRACKS        CTL_CODE(IOCTL_DISK_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
                    123: #define IOCTL_DISK_REASSIGN_BLOCKS      CTL_CODE(IOCTL_DISK_BASE, 0x0007, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
                    124: #define IOCTL_DISK_PERFORMANCE          CTL_CODE(IOCTL_DISK_BASE, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    125: #define IOCTL_DISK_GET_DRIVE_LETTERS    CTL_CODE(IOCTL_DISK_BASE, 0x0009, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    126: 
                    127: //
                    128: // The following device control codes are common for all class drivers.  The
                    129: // functions codes defined here must match all of the other class drivers.
                    130: //
                    131: 
                    132: #define IOCTL_DISK_CHECK_VERIFY CTL_CODE(IOCTL_DISK_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
                    133: #define IOCTL_DISK_RESERVE      CTL_CODE(IOCTL_DISK_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
                    134: #define IOCTL_DISK_RELEASE      CTL_CODE(IOCTL_DISK_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
                    135: #define IOCTL_DISK_MEDIA_REMOVAL CTL_CODE(IOCTL_DISK_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
                    136: #define IOCTL_DISK_EJECT_MEDIA  CTL_CODE(IOCTL_DISK_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
                    137: #define IOCTL_DISK_LOAD_MEDIA   CTL_CODE(IOCTL_DISK_BASE, 0x0207, METHOD_BUFFERED, FILE_READ_ACCESS)
                    138: 
                    139: #define IOCTL_DISK_GET_MEDIA_TYPES      CTL_CODE(IOCTL_DISK_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
                    140: #define IOCTL_DISK_UNLOAD_DRIVER        CTL_CODE(IOCTL_DISK_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
                    141: 
                    142: #define IOCTL_DISK_DBG_GET_STATISTICS   CTL_CODE(IOCTL_DISK_BASE, 0x1000, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    143: #define IOCTL_DISK_DBG_FIFO_TUNING      CTL_CODE(IOCTL_DISK_BASE, 0x1001, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    144: #define IOCTL_DISK_DBG_POWER_RECOVERY   CTL_CODE(IOCTL_DISK_BASE, 0x1002, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
                    145: 
                    146: //
                    147: // The following device control code is for the SIMBAD simulated bad
                    148: // sector facility. See SIMBAD.H in this directory for related structures.
                    149: //
                    150: 
                    151: #define IOCTL_DISK_SIMBAD               CTL_CODE(IOCTL_DISK_BASE, 0x1003, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_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_UNIX                  0x63      // Unix
                    166: 
                    167: #define VALID_NTFT                      0xC0      // NTFT uses high order bits
                    168: 
                    169: //
                    170: // The following macro is used to determine which partitions should be
                    171: // assigned drive letters.
                    172: //
                    173: 
                    174: //++
                    175: //
                    176: // BOOLEAN
                    177: // IsRecognizedPartition(
                    178: //     IN DWORD PartitionType
                    179: //     )
                    180: //
                    181: // Routine Description:
                    182: //
                    183: //     This macro is used to determine to which partitions drive letters
                    184: //     should be assigned.
                    185: //
                    186: // Arguments:
                    187: //
                    188: //     PartitionType - Supplies the type of the partition being examined.
                    189: //
                    190: // Return Value:
                    191: //
                    192: //     The return value is TRUE if the partition type is recognized,
                    193: //     otherwise FALSE is returned.
                    194: //
                    195: //--
                    196: 
                    197: #define IsRecognizedPartition( PartitionType ) (       \
                    198:     (((PartitionType & ~0xC0) == PARTITION_FAT_12) ||  \
                    199:      ((PartitionType & ~0xC0) == PARTITION_FAT_16) ||  \
                    200:      ((PartitionType & ~0xC0) == PARTITION_IFS)    ||  \
                    201:      ((PartitionType & ~0xC0) == PARTITION_HUGE)) )
                    202: 
                    203: //
                    204: // The high bit of the partition type code indicates that a partition
                    205: // is part of an NTFT mirror or striped array.
                    206: //
                    207: 
                    208: #define PARTITION_NTFT                  0x80     // NTFT partition
                    209: 
                    210: //
                    211: // Define the media types supported by the driver.
                    212: //
                    213: 
                    214: typedef enum _MEDIA_TYPE {
                    215:     Unknown,                // Format is unknown
                    216:     F5_1Pt2_512,            // 5.25", 1.2MB,  512 bytes/sector
                    217:     F3_1Pt44_512,           // 3.5",  1.44MB, 512 bytes/sector
                    218:     F3_2Pt88_512,           // 3.5",  2.88MB, 512 bytes/sector
                    219:     F3_20Pt8_512,           // 3.5",  20.8MB, 512 bytes/sector
                    220:     F3_720_512,             // 3.5",  720KB,  512 bytes/sector
                    221:     F5_360_512,             // 5.25", 360KB,  512 bytes/sector
                    222:     F5_320_512,             // 5.25", 320KB,  512 bytes/sector
                    223:     F5_320_1024,            // 5.25", 320KB,  1024 bytes/sector
                    224:     F5_180_512,             // 5.25", 180KB,  512 bytes/sector
                    225:     F5_160_512,             // 5.25", 160KB,  512 bytes/sector
                    226:     RemovableMedia,         // Removable media other than floppy
                    227:     FixedMedia              // Fixed hard disk media
                    228: } MEDIA_TYPE, *PMEDIA_TYPE;
                    229: 
                    230: //
                    231: // Define the input buffer structure for the driver, when
                    232: // it is called with IOCTL_DISK_FORMAT_TRACKS.
                    233: //
                    234: 
                    235: typedef struct _FORMAT_PARAMETERS {
                    236:    MEDIA_TYPE MediaType;
                    237:    DWORD StartCylinderNumber;
                    238:    DWORD EndCylinderNumber;
                    239:    DWORD StartHeadNumber;
                    240:    DWORD EndHeadNumber;
                    241: } FORMAT_PARAMETERS, *PFORMAT_PARAMETERS;
                    242: 
                    243: //
                    244: // Define the BAD_TRACK_NUMBER type. An array of elements of this type is
                    245: // returned by the driver on IOCTL_DISK_FORMAT_TRACKS requests, to indicate
                    246: // what tracks were bad during formatting. The length of that array is
                    247: // reported in the `Information' field of the I/O Status Block.
                    248: //
                    249: 
                    250: typedef WORD   BAD_TRACK_NUMBER;
                    251: typedef WORD   *PBAD_TRACK_NUMBER;
                    252: 
                    253: //
                    254: // The following structure is returned on an IOCTL_DISK_GET_DRIVE_GEOMETRY
                    255: // request and an array of them is returned on an IOCTL_DISK_GET_MEDIA_TYPES
                    256: // request.
                    257: //
                    258: 
                    259: typedef struct _DISK_GEOMETRY {
                    260:     MEDIA_TYPE MediaType;
                    261:     LARGE_INTEGER Cylinders;
                    262:     DWORD TracksPerCylinder;
                    263:     DWORD SectorsPerTrack;
                    264:     DWORD BytesPerSector;
                    265: } DISK_GEOMETRY, *PDISK_GEOMETRY;
                    266: 
                    267: //
                    268: // The following structure is returned on an IOCTL_DISK_GET_PARTITION_INFO
                    269: // and an IOCTL_DISK_GET_DRIVE_LAYOUT request.  It is also used in a request
                    270: // to change the drive layout, IOCTL_DISK_SET_DRIVE_LAYOUT.
                    271: //
                    272: 
                    273: typedef struct _PARTITION_INFORMATION {
                    274:     BYTE  PartitionType;
                    275:     BOOLEAN BootIndicator;
                    276:     BOOLEAN RecognizedPartition;
                    277:     BOOLEAN RewritePartition;
                    278:     LARGE_INTEGER StartingOffset;
                    279:     LARGE_INTEGER PartitionLength;
                    280:     LARGE_INTEGER HiddenSectors;
                    281: } PARTITION_INFORMATION, *PPARTITION_INFORMATION;
                    282: 
                    283: //
                    284: // The following structure is used to change the partition type of a
                    285: // specified disk partition using an IOCTL_DISK_SET_PARTITION_INFO
                    286: // request.
                    287: //
                    288: 
                    289: typedef struct _SET_PARTITION_INFORMATION {
                    290:     BYTE  PartitionType;
                    291: } SET_PARTITION_INFORMATION, *PSET_PARTITION_INFORMATION;
                    292: 
                    293: //
                    294: // The following structures is returned on an IOCTL_DISK_GET_DRIVE_LAYOUT
                    295: // request and given as input to an IOCTL_DISK_SET_DRIVE_LAYOUT request.
                    296: //
                    297: 
                    298: typedef struct _DRIVE_LAYOUT_INFORMATION {
                    299:     DWORD PartitionCount;
                    300:     DWORD Signature;
                    301:     PARTITION_INFORMATION PartitionEntry[1];
                    302: } DRIVE_LAYOUT_INFORMATION, *PDRIVE_LAYOUT_INFORMATION;
                    303: 
                    304: //
                    305: // The following structure is passed in on an IOCTL_DISK_VERIFY request.
                    306: // The offset and length parameters are both given in bytes.
                    307: //
                    308: 
                    309: typedef struct _VERIFY_INFORMATION {
                    310:     LARGE_INTEGER StartingOffset;
                    311:     DWORD Length;
                    312: } VERIFY_INFORMATION, *PVERIFY_INFORMATION;
                    313: 
                    314: //
                    315: // The following structure is passed in on an IOCTL_DISK_REASSIGN_BLOCKS
                    316: // request.
                    317: //
                    318: 
                    319: typedef struct _REASSIGN_BLOCKS {
                    320:     WORD   Reserved;
                    321:     WORD   Count;
                    322:     DWORD BlockNumber[1];
                    323: } REASSIGN_BLOCKS, *PREASSIGN_BLOCKS;
                    324: 
                    325: //
                    326: // The following structure is exchanged on an IOCTL_DISK_GET_PERFORMANCE
                    327: // request.
                    328: //
                    329: 
                    330: typedef struct _DISK_PERFORMANCE {
                    331:         LARGE_INTEGER BytesRead;
                    332:         LARGE_INTEGER BytesWritten;
                    333:         LARGE_INTEGER ReadTime;
                    334:         LARGE_INTEGER WriteTime;
                    335:         DWORD ReadCount;
                    336:         DWORD WriteCount;
                    337:         DWORD QueueDepth;
                    338: } DISK_PERFORMANCE, *PDISK_PERFORMANCE;
                    339: 
                    340: 
                    341: #define FSCTL_LOCK_VOLUME               CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    342: #define FSCTL_UNLOCK_VOLUME             CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    343: #define FSCTL_DISMOUNT_VOLUME           CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    344: 
                    345: 
                    346: #endif // _WINIOCTL_
                    347: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.