CreateFileFlags Enumeration

Specifies the file or device flags for the CreateFile(String, FileAccessRights, FileShare, IntPtr, FileMode, CreateFileFlags, IntPtr) function.

These flags can be combined with any value of the FileAttributes enumeration.

Definition

Namespace: DevCase.Win32.Enums
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[FlagsAttribute]
public enum CreateFileFlags

Remarks

Members

None 0 None.
FileAttributeReadOnly 1 The file is read-only.
FileAttributeHidden 2 The file is hidden, and thus is not included in an ordinary directory listing.
FileAttributeSystem 4 The file is a system file.

That is, the file is part of the operating system or is used exclusively by the operating system.

FileAttributeArchive 32 The file is a candidate for backup or removal.
FileAttributeNormal 128 The file is a standard file that has no special attributes. This attribute is valid only if it is used alone.
FileAttributeTemporary 256 The file is temporary. A temporary file contains data that is needed while an application is executing but is not needed after the application is finished.

File systems try to keep all the data in memory for quicker access rather than flushing the data back to mass storage.

A temporary file should be deleted by the application As soon As it Is no longer needed.

FileAttributeOffline 4,096 The file is offline. The data of the file is not immediately available.
FileAttributeEncrypted 16,384 The file or directory is encrypted.

For a file, this means that all data in the file is encrypted.

For a directory, this means that encryption is the default for newly created files and directories.

OpenNoRecall 1,048,576 The file data is requested, but it should continue to be located in remote storage. It should not be transported back to local storage.

This flag is for use by remote storage systems.

OpenReparsePoint 2,097,152 Normal reparse point processing will not occur; CreateFile(String, FileAccessRights, FileShare, IntPtr, FileMode, CreateFileFlags, IntPtr) will attempt to open the reparse point.

When a file is opened, a file handle is returned, whether or not the filter that controls the reparse point is operational.

This flag cannot be used with the OpenOrCreate flag.

If the file is not a reparse point, then this flag is ignored.

SessionAware 8,388,608 The file or device is being opened with session awareness.

If this flag is not specified, then per-session devices (such as a device using RemoteFX USB Redirection) cannot be opened by processes running in session 0.

This flag has no effect for callers not in session 0.

This flag is supported only on server editions of Windows.

PosixSemantics 16,777,216 Access will occur according to POSIX rules.

This includes allowing multiple files with names, differing only in case, for file systems that support that naming.

Use care when using this option, because files created with this flag may not be accessible by applications that are written for MS-DOS or 16-bit Windows.

BackupSemantics 33,554,432 The file is being opened or created for a backup or restore operation.

The system ensures that the calling process overrides file security checks when the process has BackupPrivilege and RestorePrivilege privileges.

You must set this flag to obtain a handle to a directory. A directory handle can be passed to some functions instead of a file handle.

DeleteOnClose 67,108,864 The file is to be deleted immediately after all of its handles are closed, which includes the specified handle and any other open or duplicated handles.

If there are existing open handles to a file, the call fails unless they were all opened with the Delete share mode.

SequentialScan 134,217,728 Access is intended to be sequential from beginning to end.

The system can use this as a hint to optimize file caching.

This flag should not be used if read-behind (that is, reverse scans) will be used.

This flag has no effect if the file system does not support cached I/O and NoBuffering flag.

RandomAccess 268,435,456 Access is intended to be random. The system can use this as a hint to optimize file caching.

This flag has no effect if the file system does not support cached I/O and NoBuffering flag.

NoBuffering 536,870,912 he file or device is being opened with no system caching for data reads and writes.

This flag does not affect hard disk caching or memory mapped files.

There are strict requirements for successfully working with files opened with CreateFile(String, FileAccessRights, FileShare, IntPtr, FileMode, CreateFileFlags, IntPtr) using the NoBuffering flag.

Overlapped 1,073,741,824 The file or device is being opened or created for asynchronous I/O.

When subsequent I/O operations are completed on this handle, the event specified in the OVERLAPPED structure will be set to the signaled state.

If this flag is specified, the file can be used for simultaneous read and write operations.

If this flag is not specified, then I/O operations are serialized, even if the calls to the read and write functions specify an OVERLAPPED structure.

WriteThrough 2,147,483,648 Write operations will not go through any intermediate cache, they will go directly to disk.

See Also