File Management Reference
File Management Control Codes
The following control codes are used in file management.
Control code |
Operation |
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_FILESYSTEM_GET_STATISTICS |
Retrieves statistics from the file system. |
FSCTL_FIND_FILES_BY_SID |
Searches a directory for a file whose creator owner matches the specified SID. |
FSCTL_GET_NTFS_FILE_RECORD |
Retrieves the complete NTFS file system file record identified by the specified file identifier. |
FSCTL_RECALL_FILE |
Recalls a file from storage media managed by Remote Storage, the hierarchical storage management software. |
FSCTL_SET_ZERO_ON_DEALLOCATION |
Indicates an NTFS file system file handle should have its clusters filled with zeros when it is deallocated. |
The following control codes are used with file compression and decompression.
Control code |
Operation |
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 object identifiers.
Control code |
Operation |
FSCTL_CREATE_OR_GET_OBJECT_ID |
Creates or retrieves the object identifier for the specified file or directory. |
FSCTL_DELETE_OBJECT_ID |
Removes the object identifier from the specified file or directory. |
FSCTL_GET_OBJECT_ID |
Retrieves the object identifier for the specified file or directory. |
FSCTL_SET_OBJECT_ID |
Sets the object identifier for the specified file or directory. |
FSCTL_SET_OBJECT_ID_EXTENDED |
Modifies user data associated with the object identifier of the specified file or directory. |
The following control codes are used with opportunistic locks.
Control code |
Operation |
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 unlock 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 sparse files.
Control code |
Operation |
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 control codes are used with the NTFS self-healing mechanism.
Control code |
Operation |
FSCTL_GET_REPAIR |
Retrieves information about the NTFS file system's self-healing mechanism. |
FSCTL_INITIATE_REPAIR |
Triggers the NTFS file system to start a self-healing cycle on a single file. |
FSCTL_SET_REPAIR |
Sets the mode of an NTFS file system's self-healing capability. |
FSCTL_WAIT_FOR_REPAIR |
Returns when the specified repairs are completed. |
The following control codes are used with UDF.
Control code |
Operation |
FSCTL_MAKE_MEDIA_COMPATIBLE |
Closes an open UDF session on write-once media to make the media ROM compatible. Used in conjunction with FILE_SEQUENTIAL_WRITE_ONCE volume flag. This call must be issued on the volume handle. |
FSCTL_QUERY_ON_DISK_VOLUME_INFO |
Requests UDF-specific volume information. |
FSCTL_QUERY_SPARING_INFO |
Retrieves the defect management properties of the volume. Used for UDF file systems. |
FSCTL_SET_DEFECT_MANAGEMENT |
Sets the software defect management state for the specified file. Used for UDF file systems. |
File Management Enumerations
The following enumerations are used in file management: