天天看點

檔案存儲:File Systems 檔案系統About File SystemsUsing File System FeaturesFile System Reference

  • Applications rely on file systems to store and retrieve information on mass storage devices. File systems provide the underlying support that applications need to create and access files and directories on the individual volumes associated with the devices.
  • Each file system consists of one or more drivers and supporting dynamic-link libraries that define the data formats and features of the file system. These determine the conventions used for file names, the level of security and recoverability available, and the general performance of input and output (I/O) operations.

About File Systems

Using File System Features

File System Reference

  • The following functions, interfaces, and structures are used with file systems:檔案系統使用以下函數、接口和結構

File System Functions

  • The following functions are used with file systems.以下函數用于檔案系統

CreateHardLink

  • Establishes an NTFS hard link between an existing file and a new file. 在現有檔案和新檔案之間建立NTFS硬連結。

GetCompressedFileSize

  • Retrieves the actual number of bytes of disk storage used to store a specified file.檢索用于存儲指定檔案的磁盤存儲的實際位元組數。

GetDiskFreeSpace

  • Retrieves information about the specified disk, including the amount of free space on the disk. 檢索有關指定磁盤的資訊,包括磁盤上的可用空間量。

GetDiskFreeSpaceEx

  • Retrieves information about the specified disk, including the amount of free space on the disk.檢索有關指定磁盤的資訊,包括磁盤上的可用空間量

GetFileSize

  • Retrieves the size of a specified file. 檢索指定檔案的大小。

GetFileSizeEx

  • Retrieves the size of a specified file. 檢索指定檔案的大小。

GetLogicalDrives

  • Returns a bitmask representing the currently available disk drives. 傳回表示目前可用磁盤驅動器的位掩碼

GetLogicalDriveStrings

  • Fills a buffer with strings that specify valid drives in the system. 用指定系統中有效驅動器的字元串填充緩沖區。

GetVolumeInformation

  • Retrieves information about a file system and volume. 檢索有關檔案系統和卷的資訊

SetVolumeLabel

  • Sets the label of a file system volume. 設定檔案系統卷的标簽
  • The following functions are used with the encrypted file system.以下函數用于加密的檔案系統

AddUsersToEncryptedFile

  • Adds user keys to a specified encrypted file. 将使用者密鑰添加到指定的加密檔案

DecryptFile

  • Decrypts an encrypted file or directory. 解密加密的檔案或目錄。

DuplicateEncryptionInfoFile

  • Copies the EFS metadata from one file or directory to another. 将EFS中繼資料從一個檔案或目錄複制到另一個檔案或目錄。

EncryptFile

  • Encrypts a file or directory. 加密檔案或目錄。

EncryptionDisable

  • Disables or enables encryption of the indicated directory and the files in it. 禁用或啟用指定目錄及其檔案的加密

FileEncryptionStatus

  • Retrieves the encryption status of the specified file.檢索指定檔案的加密狀态。

FreeEncryptionCertificateHashList

  • Frees a certificate hash list.

    釋放證書哈希清單。

QueryRecoveryAgentsOnEncryptedFile

  • Retrieves a list of recovery agents for the specified file. 檢索指定檔案的修復代理人清單。

QueryUsersOnEncryptedFile

  • Retrieves a list of users for the specified file.檢索指定檔案的使用者清單

RemoveUsersFromEncryptedFile

  • Removes specified certificate hashes from a specified file. 從指定檔案中移除指定的證書散列

SetUserFileEncryptionKey

  • Sets the user’s current key to the specified certificate. 将使用者的目前密鑰設定為指定的證書
  • The following functions are used with volume mount points.以下函數用于卷挂載點。

DeleteVolumeMountPoint

  • Unmounts the volume from the specified volume mount point. 從指定的卷挂載點解除安裝卷

FindFirstVolume

  • Returns the name of a volume on a computer.傳回計算機上卷的名稱

FindFirstVolumeMountPoint

  • Returns the name of a volume mount point on the specified volume. 傳回指定卷上的卷挂載點的名稱。

FindNextVolume

  • Continues a volume search started by a call to FindFirstVolume. 繼續通過調用FindFirstVolume啟動的卷搜尋。

FindNextVolumeMountPoint

  • Continues a volume mount point search started by a call to FindFirstVolumeMountPoint. 繼續通過調用FindFirstVolumeMountPoint啟動的卷挂載點搜尋。

FindVolumeClose

  • Closes the specified volume search handle. 關閉指定的卷搜尋句柄。

FindVolumeMountPointClose

  • Closes the specified mount-point search handle. 關閉指定的挂載點搜尋句柄。

GetVolumeNameForVolumeMountPoint

  • Takes a volume mount point or root directory and returns the corresponding unique volume name.擷取卷挂載點或根目錄,并傳回相應的惟一卷名。

GetVolumePathName

  • Retrieves the volume mount point at which the specified path is mounted. 檢索挂載指定路徑的卷挂載點

GetVolumePathNamesForVolumeName

  • Retrieves a list of path names for the specified volume name. 檢索指定卷名稱的路徑名稱清單。

SetVolumeMountPoint

  • Mounts the specified volume at the specified volume mount point.在指定的卷裝入點裝入指定的卷。

File System Control Codes:

  • The following control codes are used with change journals.變更日志使用以下控制代碼,參考:File Storage–》Change Journals

FSCTL_CREATE_USN_JOURNAL

  • Creates a change journal stream on a target volume or modifies an existing change journal stream. 在目标卷上建立更改日志流或修改現有更改日志流。

FSCTL_DELETE_USN_JOURNAL

  • Deletes a change journal on a volume or awaits notification of deletion of a change journal.删除卷上的更改日志或等待删除更改日志的通知。

FSCTL_ENUM_USN_DATA

  • Creates an enumeration that lists the change journal entries between two specified boundaries. 建立一個枚舉,該枚舉列出兩個指定邊界之間的更改日志項

FSCTL_MARK_HANDLE

  • Marks a specified file or directory and its change journal record with information about changes to that file or directory. 将指定的檔案或目錄及其更改日志記錄标記為有關該檔案或目錄更改的資訊。

FSCTL_QUERY_USN_JOURNAL

  • Queries for information on the current change journal, its records, and its capacity. 查詢關于目前變更日志、其記錄和容量的資訊。

FSCTL_READ_USN_JOURNAL

  • Returns to the calling process the set of change journal records between two specified USN values. 傳回調用程序兩個指定USN值之間的更改日志記錄集

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 flag.在變更日志流中為輸入檔案生成一條記錄。該記錄将具有USN_REASON_CLOSE标志。
  • The following are defragmentation control codes.以下是碎片整理控制代碼

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. 以下控制代碼用于檔案壓縮

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 files.以下控制代碼用于檔案

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. 訓示檔案系統驅動程式不要對分區的讀或寫調用執行任何I/O邊界檢查。相反,邊界檢查由裝置驅動程式執行。

FSCTL_RECALL_FILE

  • Recalls a file from storage media managed by Remote Storage, the hierarchical storage management software. 從由分層存儲管理軟體遠端存儲管理的存儲媒體中檢索檔案。
  • The following control codes are used with object identifiers.下面的控制代碼用于對象辨別符

FSCTL_CREATE_OR_GET_OBJECT_ID

  • Creates or retrieves a file system object identifier for an existing, open object. 為已存在的打開對象建立或檢索檔案系統對象辨別符。

FSCTL_DELETE_OBJECT_ID

  • Removes a file system object identifier from an existing, open object. 從現有的打開對象中移除檔案系統對象辨別符

FSCTL_GET_OBJECT_ID

  • Retrieves the object identifier for an existing, open object. 檢索現有打開對象的對象辨別符。

FSCTL_SET_OBJECT_ID

  • Sets a file system object identifier for an existing, open object. 為已存在的打開對象設定檔案系統對象辨別符。

FSCTL_SET_OBJECT_ID_EXTENDED

  • Modifies user data in the object identifier of an existing, open object. 修改現有打開對象的對象辨別符中的使用者資料。
  • The following control codes are used with opportunistic locks.下面的控制代碼用于機會鎖。

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. 下面的控制代碼用于重新解析點

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.下面的控制代碼用于稀疏檔案

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 volumes.

FSCTL_DISMOUNT_VOLUME

  • Dismounts a volume. 下一個卷。

FSCTL_LOCK_VOLUME

  • Locks a volume. 鎖一個卷。

FSCTL_READ_FROM_PLEX

  • Reads from the specified plex. 從指定的叢中讀取。

FSCTL_UNLOCK_VOLUME

  • Unlocks a volume. 解鎖一個卷。

Obsolete Control Codes:過時的控制代碼 FSCTL_QUERY_FAT_BPB

File System Interfaces:以下接口用于檔案系統

IDiskQuotaControl

IDiskQuotaEvents

IDiskQuotaUser

IDiskQuotaUserBatch

IEnumDiskQuotaUsers

File System Structures:以下結構用于檔案系統

CREATE_USN_JOURNAL_DATA

DELETE_USN_JOURNAL_DATA

DISKQUOTA_USER_INFORMATION

EFS_CERTIFICATE_BLOB

EFS_HASH_BLOB

ENCRYPTION_CERTIFICATE

ENCRYPTION_CERTIFICATE_HASH

ENCRYPTION_CERTIFICATE_HASH_LIST

ENCRYPTION_CERTIFICATE_LIST

FILE_ALLOCATED_RANGE_BUFFER

FILE_OBJECTID_BUFFER

FILE_ZERO_DATA_INFORMATION

FSCTL_QUERY_FAT_BPB_BUFFER

MARK_HANDLE_INFO

MFT_ENUM_DATA

MOVE_FILE_DATA

PLEX_READ_DATA_REQUEST

READ_USN_JOURNAL_DATA

REPARSE_GUID_DATA_BUFFER

RETRIEVAL_POINTERS_BUFFER

STARTING_LCN_INPUT_BUFFER

STARTING_VCN_INPUT_BUFFER

USN_JOURNAL_DATA

USN_RECORD

VOLUME_BITMAP_BUFFER

File System Macros:The following macros are used with file systems.以下宏用于檔案系統

IsReparseTagMicrosoft

/*The IsReparseTagMicrosoft macro determines whether a reparse point tag indicates a Microsoft reparse point.issetagmicrosoft宏确定reparse點标記是否表示Microsoft reparse點。
  Return Values:The return value is a ULONG that must be treated as zero or nonzero. A nonzero return value indicates that the tag is a Microsoft tag. A zero return value indicates that the tag is not a Microsoft tag. Only software developed by Microsoft or in partnership with Microsoft can use Microsoft tags. All other software must use non-Microsoft tags.傳回值是一個必須被視為零或非零的ULONG。非零傳回值表示标記是Microsoft标記。零傳回值表示标記不是Microsoft标記。隻有微軟開發的軟體或與微軟合作開發的軟體才能使用微軟的标簽。所有其他軟體必須使用非微軟标簽。
  Remarks:If the Microsoft tag bit is set, Microsoft provides the tag. All other tags must use zero for this bit.如果設定了Microsoft标記位,則Microsoft提供标記。所有其他标記都必須為這個位使用0。
  Header: Declared in Winnt.h; include Windows.h*/
  
ULONG IsReparseTagMicrosoft(
  ULONG _tag  // tag to be tested  \Reparse point tag to be tested.
);
           

IsReparseTagNameSurrogate

/*The IsReparseTagNameSurrogate macro determines whether a tag's associated reparse point is a surrogate for another named entity, for example a mount volume point.确定标記關聯的重新解析點是否為另一個命名實體(例如挂載卷點)的代理。
  Return Values:The return value is a ULONG that must be treated as zero or nonzero. A nonzero return value means that the tag indicates a surrogate reparse point. A zero return value means that the tag does not indicate a surrogate reparse point.傳回值是一個必須被視為零或非零的ULONG。非零傳回值意味着标記訓示代理重新解析點。零傳回值意味着标記不訓示代理重新解析點。
  Remarks:If the surrogacy bit is set, the file or directory represents another named entity in the system, such as a volume mounted at this directory. For more information on volume mounting, 請查閱URL: File Storage--》Volume Mount Points. 
  Header: Declared in Winnt.h; include Windows.h*/
  
ULONG IsReparseTagNameSurrogate(
  ULONG _tag  // tag to be tested \Reparse point tag to be tested for surrogacy. 
);