Windows File System API Reference
Overview
The Windows File System APIs provide a comprehensive set of functions for interacting with files, directories, and volumes on Windows operating systems. These APIs allow developers to perform operations such as creating, reading, writing, deleting, and managing file system objects, as well as querying file system properties and security information.
Key components of the file system API include the Win32 file functions, the Windows NTFS API, and the Volume Management API. Understanding these interfaces is crucial for building robust file management applications, system utilities, and high-performance data processing tools.
Core File Operations
These functions are the foundation for most file system interactions:
| Function Name | Description |
|---|---|
CreateFile |
Creates or opens a file or I/O device. |
ReadFile |
Reads data from a file or I/O device. |
WriteFile |
Writes data to a file or I/O device. |
CloseHandle |
Closes an open object handle. |
DeleteFile |
Deletes a file. |
CopyFile |
Copies an existing file to a new location. |
MoveFile |
Moves an existing file or directory. |
Directory and Path Management
Manage directories and work with file paths effectively:
| Function Name | Description |
|---|---|
CreateDirectory |
Creates a directory. |
RemoveDirectory |
Deletes an empty directory. |
FindFirstFile / FindNextFile |
Enumerates files and directories within a specified path. |
GetFullPathName |
Converts a relative path to an absolute path. |
PathCanonicalize |
Simplifies a path string. |
File Attributes and Properties
Query and modify file system object attributes:
| Function Name | Description |
|---|---|
GetFileAttributes |
Retrieves attributes for a file or directory. |
SetFileAttributes |
Sets attributes for a file or directory. |
GetFileSizeEx |
Retrieves the size of a file. |
SetEndOfFile |
Sets the end-of-file position for a file. |
Advanced Concepts
- NTFS API: For advanced NTFS features like alternate data streams, hard links, and reparse points.
- File Compression: Using APIs for transparent file compression.
- File Encryption: Utilizing Encrypting File System (EFS) APIs.
- Volume Management: APIs for managing disks, partitions, and volumes.
- Asynchronous I/O: For non-blocking file operations.