大网数据广告活动
磁盘与文件系统

File Management Control Codes

· 52CE 我爱测

Control codes used in file management.

The following control codes are used in file management.

In this section

Control Code Description
FSCTL_ALLOW_EXTENDED_DASD_IO Signals the file system driver not to perform any I/O boundary checks on partition read or write calls.
FSCTL_CREATE_OR_GET_OBJECT_ID Retrieves the object identifier for the specified file or directory. If no object identifier exists, using FSCTL_CREATE_OR_GET_OBJECT_ID creates one.
FSCTL_CSV_CONTROL Retrieves the results of a CSV control operation.
FSCTL_DELETE_OBJECT_ID Removes the object identifier from a specified file or directory.
FSCTL_DUPLICATE_EXTENTS_TO_FILE Instructs the file system to copy a range of file bytes on behalf of an application.
FSCTL_FILE_LEVEL_TRIM Indicates to the storage system which ranges in the file are not needed to be stored.
FSCTL_FILESYSTEM_GET_STATISTICS Retrieves the information from various file system performance counters.
FSCTL_FILESYSTEM_GET_STATISTICS_EX Retrieves the information from various file system performance counters. Support for this control code started with Windows 10.
FSCTL_FIND_FILES_BY_SID Searches a directory for a file whose creator owner matches the specified SID.
FSCTL_GET_COMPRESSION Retrieves the current compression state of a file or directory on a volume whose file system supports per-stream compression.
FSCTL_GET_NTFS_FILE_RECORD Retrieves the first file record that is in use and is of a lesser than or equal ordinal value to the requested file reference number.
FSCTL_GET_OBJECT_ID Retrieves the object identifier for the specified file or directory.
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_MAKE_MEDIA_COMPATIBLE Closes an open UDF session on write-once media to make the media ROM compatible.
FSCTL_OPBATCH_ACK_CLOSE_PENDING Notifies a server that a client application is ready to close a file.
FSCTL_OPLOCK_BREAK_ACK_NO_2 Responds to notification that an opportunistic lock on a file is about to be broken. Use 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. Use this operation to indicate that the file should receive a level 2 opportunistic lock.
FSCTL_OPLOCK_BREAK_NOTIFY Enables the calling application to wait for completion of an opportunistic lock break.
FSCTL_QUERY_ALLOCATED_RANGES Scans a file or alternate stream looking for ranges that may contain nonzero data.
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_RECALL_FILE Recalls a file from storage media that Remote Storage manages, which is the hierarchical storage management software.
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 Requests an opportunistic lock (oplock) on a file and acknowledges that an oplock break has occurred.
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.
FSCTL_SET_COMPRESSION Sets the compression state of a file or directory on a volume whose file system supports per-file and per-directory compression.
FSCTL_SET_DEFECT_MANAGEMENT Sets the software defect management state for the specified file. Used for UDF file systems.
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 for the specified file or directory.
FSCTL_SET_REPAIR Sets the mode of an NTFS file system's self-healing capability.
FSCTL_SET_SPARSE Marks the indicated file as sparse or not sparse. In a sparse file, large ranges of zeros may not require disk allocation.
FSCTL_SET_ZERO_DATA Fills a specified range of a file with zeros (0).
FSCTL_SET_ZERO_ON_DEALLOCATION Indicates an NTFS file system file handle should have its clusters filled with zeros when it is deallocated.
FSCTL_WAIT_FOR_REPAIR Returns when the specified repairs are completed.

The following control codes are used with file compression and decompression.

FSCTL_GET_COMPRESSION
FSCTL_SET_COMPRESSION

The following control codes are used with object identifiers.

FSCTL_CREATE_OR_GET_OBJECT_ID
FSCTL_DELETE_OBJECT_ID
FSCTL_GET_OBJECT_ID
FSCTL_SET_OBJECT_ID
FSCTL_SET_OBJECT_ID_EXTENDED

The following control codes are used with opportunistic locks.

FSCTL_OPBATCH_ACK_CLOSE_PENDING
FSCTL_OPLOCK_BREAK_ACK_NO_2
FSCTL_OPLOCK_BREAK_ACKNOWLEDGE
FSCTL_OPLOCK_BREAK_NOTIFY
FSCTL_REQUEST_BATCH_OPLOCK
FSCTL_REQUEST_FILTER_OPLOCK
FSCTL_REQUEST_OPLOCK
FSCTL_REQUEST_OPLOCK_LEVEL_1
FSCTL_REQUEST_OPLOCK_LEVEL_2

The following control codes are used with sparse files.

FSCTL_QUERY_ALLOCATED_RANGES
FSCTL_SET_SPARSE
FSCTL_SET_ZERO_DATA

The following control codes are used with the NTFS self-healing mechanism.

FSCTL_GET_REPAIR
FSCTL_INITIATE_REPAIR
FSCTL_SET_REPAIR
FSCTL_WAIT_FOR_REPAIR

The following control codes are used with UDF.

FSCTL_MAKE_MEDIA_COMPATIBLE
FSCTL_QUERY_ON_DISK_VOLUME_INFO
FSCTL_QUERY_SPARING_INFO
FSCTL_SET_DEFECT_MANAGEMENT

Related topics

Directory Management Control Codes

Volume Management Control Codes

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。