Platform SDK: Hardware

Device Input and Output Control Codes

The following control codes are used with batteries.

Value Meaning
IOCTL_BATTERY_QUERY_INFORMATION Returns a variety of information for the battery
IOCTL_BATTERY_QUERY_STATUS Returns the current status for the battery.
IOCTL_BATTERY_QUERY_TAG Obtains the battery's current tag.
IOCTL_BATTERY_SET_INFORMATION Sets various battery information.

The following are defragmentation control codes.

Value Meaning
FSCTL_GET_RETRIEVAL_POINTERS Get information about a file's cluster use.
FSCTL_GET_VOLUME_BITMAP Get a bitmap of cluster allocation.
FSCTL_MOVE_FILE Move all or part of a file from one set of clusters to another within a volume.

The following control codes are used with file compression.

Value Meaning
FSCTL_GET_COMPRESSION Obtains the compression state of a file or directory
FSCTL_SET_COMPRESSION Sets the compression state of a file or directory.

The following control codes are used with NTFS change journals.

Value Meaning
FSCTL_CREATE_USN_JOURNAL Creates an NTFS change journal stream on a target volume or modifies an existing change journal stream.
FSCTL_DELETE_USN_JOURNAL Deletes the NTFS change journal on a volume or awaits notification of deletion of an NTFS change journal.
FSCTL_ENUM_USN_DATA Creates an enumeration that lists the NTFS change journal entries between two specified boundaries.
FSCTL_MARK_HANDLE Marks a specified file or directory and its NTFS change journal record with information about changes to that file or directory.
FSCTL_QUERY_USN_JOURNAL Queries for information on the current NTFS change journal, its records, and its capacity.
FSCTL_READ_USN_JOURNAL Returns to the calling process the set of NTFS change journal records between two specified USN values.
FSCTL_WRITE_USN_CLOSE_RECORD Generates a record in the change journal stream for the input file. This record will have the USN_REASON_CLOSE bit set.

The following control codes are used with opportunistic locks.

Value Meaning
FSCTL_OPBATCH_ACK_CLOSE_PENDING Notifies a server that a client application is about to close a file. An application uses this operation following notification that an opportunistic lock on the file is about to be broken.
FSCTL_OPLOCK_BREAK_ACK_NO_2 Responds to notification that an opportunistic lock on a file is about to be broken. An application uses this operation to loose all opportunistic locks on the file but keep the file open.
FSCTL_OPLOCK_BREAK_ACKNOWLEDGE Responds to notification that an exclusive opportunistic lock on a file is about to be broken. An application uses this operation to indicate that the file should receive a level 2 opportunistic lock.
FSCTL_OPLOCK_BREAK_NOTIFY Allows the calling application to wait for completion of an opportunistic lock break.
FSCTL_REQUEST_BATCH_OPLOCK Requests a batch opportunistic lock on a file.
FSCTL_REQUEST_FILTER_OPLOCK Requests a filter opportunistic lock on a file.
FSCTL_REQUEST_OPLOCK_LEVEL_1 Requests a level 1 opportunistic lock on a file.
FSCTL_REQUEST_OPLOCK_LEVEL_2 Requests a level 2 opportunistic lock on a file.

The following control codes are used with reparse points.

Value Meaning
FSCTL_DELETE_REPARSE_POINT Deletes a reparse point for a file or directory.
FSCTL_GET_REPARSE_POINT Returns reparse point data for a file or directory.
FSCTL_SET_REPARSE_POINT Sets a reparse point on a file or directory.

The following control codes are used with sparse files.

Value Meaning
FSCTL_QUERY_ALLOCATED_RANGES Scans a file for ranges of the file for which disk space is allocated.
FSCTL_SET_SPARSE Marks a file as a sparse file.
FSCTL_SET_ZERO_DATA Sets a range of a files bytes to zeroes.

The following are general device input and output control codes.

Value Meaning
FSCTL_ALLOW_EXTENDED_DASD_IO Signals the file system driver not to perform any I/O boundary checks on partition read or write calls. Instead, boundary checks are performed by the device driver.
FSCTL_CREATE_OR_GET_OBJECT_ID Creates or gets a file system object identifier for an existing, open object in a Windows 2000 NTFS file system.
FSCTL_DELETE_OBJECT_ID Removes a file system object identifier from an existing, open object in a Windows 2000 NTFS file system.
FSCTL_DISMOUNT_VOLUME Dismounts a volume.
FSCTL_GET_HFS_INFORMATION Returns Macintosh Finder information about the file associated with the input handle.
FSCTL_GET_OBJECT_ID Gets the object identifier for an existing, open object in a Windows 2000 NTFS file system.
FSCTL_LOCK_VOLUME Locks a volume.
FSCTL_READ_COMPRESSION Reserved for future use.
FSCTL_RECALL_FILE Recalls a file from storage media managed by Remote Storage, the hierarchical storage management software in Windows 2000.
FSCTL_SET_OBJECT_ID Sets a file system object identifier for an existing, open object in a Windows 2000 NTFS file system.
FSCTL_SET_OBJECT_ID_EXTENDED Modifies user data in the object identifier of an existing, open object in a Windows 2000 NTFS file system.
FSCTL_UNLOCK_VOLUME Unlocks a volume.
FSCTL_WRITE_COMPRESSION Reserved for future use.
IOCTL_DISK_FORMAT_TRACKS Formats a contiguous set of disk tracks.
IOCTL_DISK_GET_DRIVE_GEOMETRY Obtains information on the physical disk's geometry.
IOCTL_DISK_GET_DRIVE_LAYOUT Provides information about each partition on a disk.
IOCTL_DISK_GET_PARTITION_INFO Obtains disk partition information.
IOCTL_DISK_PERFORMANCE Provides disk performance information.
IOCTL_DISK_REASSIGN_BLOCKS Maps disk blocks to spare-block pool.
IOCTL_DISK_SET_DRIVE_LAYOUT Partitions a disk.
IOCTL_DISK_SET_PARTITION_INFO Sets the disk partition type.
IOCTL_DISK_VERIFY Performs logical format of a disk extent.
IOCTL_SERIAL_LSRMST_INSERT Enables or disables placement of a line and modem status data into the data stream.
IOCTL_STORAGE_CHECK_VERIFY Checks for change in a removable-media device.
IOCTL_STORAGE_EJECT_MEDIA Ejects media from a SCSI device.
IOCTL_STORAGE_GET_MEDIA_TYPES Obtains information about media support.
IOCTL_STORAGE_LOAD_MEDIA Loads media into a device.
IOCTL_STORAGE_MEDIA_REMOVAL Enables or disables the media eject mechanism.

Obsolete Control Codes

FSCTL_QUERY_FAT_BPB
IOCTL_DISK_CHECK_VERIFY
IOCTL_DISK_EJECT_MEDIA
IOCTL_DISK_GET_MEDIA_TYPES
IOCTL_DISK_LOAD_MEDIA
IOCTL_DISK_MEDIA_REMOVAL