FileInformationClass Enum
The FileInformationClass enumeration defines the categories of information that can be queried or set for a file or directory using the NtQueryInformationFile and NtSetInformationFile functions.
| Member | Value | Description |
|---|---|---|
| FileDirectoryInformation | 1 | Information about a directory file. |
| FileFullDirectoryInformation | 2 | Complete information about a directory entry. |
| FileBothDirectoryInformation | 3 | Information about a directory entry with short name. |
| FileBasicInformation | 4 | Basic attributes and timestamps. |
| FileStandardInformation | 5 | Standard file information such as allocation size. |
| FileInternalInformation | 6 | Internal identifier for the file. |
| FileEaInformation | 7 | Extended attributes. |
| FileAccessInformation | 8 | Access rights. |
| FileNameInformation | 9 | File name. |
| FileRenameInformation | 10 | Rename operation data. |
| FileLinkInformation | 11 | Hard link information. |
| FileNamesInformation | 12 | Names of files in a directory. |
| FileDispositionInformation | 13 | Delete pending flag. |
| FilePositionInformation | 14 | Current file pointer position. |
| FileEndOfFileInformation | 15 | End-of-file position. |
| FileAllocationInformation | 16 | Allocation size. |
| FileVolumeInformation | 18 | Volume information for a file. |
| FileAttributeTagInformation | 19 | Attribute tag information. |
| FileSecurityInformation | 25 | Security descriptor. |
| FileEndOfFileInformation | 15 | Alias for setting end-of-file. |
Usage Example (C++)
#include <windows.h>
#include <ntdef.h>
#include <ntifs.h>
int main() {
HANDLE hFile = CreateFileW(L"C:\\\\temp\\\\example.txt",
GENERIC_READ,
FILE_SHARE_READ,
nullptr,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
nullptr);
if (hFile == INVALID_HANDLE_VALUE) return 1;
FILE_BASIC_INFORMATION basicInfo;
ULONG retLen;
NTSTATUS status = NtQueryInformationFile(
hFile,
&retLen,
&basicInfo,
sizeof(basicInfo),
FileBasicInformation);
// Process basicInfo...
CloseHandle(hFile);
return 0;
}