using System; namespace Vanara.PInvoke { /// /// File attributes are metadata values stored by the file system on disk and are used by the system and are available to developers via /// various file I/O APIs. /// [Flags] [PInvokeData("winnt.h")] public enum FileFlagsAndAttributes : uint { /// /// A file that is read-only. Applications can read the file, but cannot write to it or delete it. This attribute is not honored on /// directories. For more information, see You cannot view or change the Read-only or the System attributes of folders in Windows /// Server 2003, in Windows XP, in Windows Vista or in Windows 7. /// FILE_ATTRIBUTE_READONLY = 0x00000001, /// The file or directory is hidden. It is not included in an ordinary directory listing. FILE_ATTRIBUTE_HIDDEN = 0x00000002, /// A file or directory that the operating system uses a part of, or uses exclusively. FILE_ATTRIBUTE_SYSTEM = 0x00000004, /// The handle that identifies a directory. FILE_ATTRIBUTE_DIRECTORY = 0x00000010, /// /// A file or directory that is an archive file or directory. Applications typically use this attribute to mark files for backup or /// removal . /// FILE_ATTRIBUTE_ARCHIVE = 0x00000020, /// This value is reserved for system use. FILE_ATTRIBUTE_DEVICE = 0x00000040, /// A file that does not have other attributes set. This attribute is valid only when used alone. FILE_ATTRIBUTE_NORMAL = 0x00000080, /// /// A file that is being used for temporary storage. File systems avoid writing data back to mass storage if sufficient cache memory /// is available, because typically, an application deletes a temporary file after the handle is closed. In that scenario, the system /// can entirely avoid writing the data. Otherwise, the data is written after the handle is closed. /// FILE_ATTRIBUTE_TEMPORARY = 0x00000100, /// A file that is a sparse file. FILE_ATTRIBUTE_SPARSE_FILE = 0x00000200, /// A file or directory that has an associated reparse point, or a file that is a symbolic link. FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400, /// /// A file or directory that is compressed. For a file, all of the data in the file is compressed. For a directory, compression is /// the default for newly created files and subdirectories. /// FILE_ATTRIBUTE_COMPRESSED = 0x00000800, /// /// The data of a file is not available immediately. This attribute indicates that the file data is physically moved to offline /// storage. This attribute is used by Remote Storage, which is the hierarchical storage management software. Applications should not /// arbitrarily change this attribute. /// FILE_ATTRIBUTE_OFFLINE = 0x00001000, /// The file or directory is not to be indexed by the content indexing service. FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x00002000, /// /// A file or directory that is encrypted. For a file, all data streams in the file are encrypted. For a directory, encryption is the /// default for newly created files and subdirectories. /// FILE_ATTRIBUTE_ENCRYPTED = 0x00004000, /// /// The directory or user data stream is configured with integrity (only supported on ReFS volumes). It is not included in an /// ordinary directory listing. The integrity setting persists with the file if it's renamed. If a file is copied the destination /// file will have integrity set if either the source file or destination directory have integrity set. /// /// Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This flag is /// not supported until Windows Server 2012. /// /// FILE_ATTRIBUTE_INTEGRITY_STREAM = 0x00008000, /// This value is reserved for system use. FILE_ATTRIBUTE_VIRTUAL = 0x00010000, /// /// The user data stream not to be read by the background data integrity scanner (AKA scrubber). When set on a directory it only /// provides inheritance. This flag is only supported on Storage Spaces and ReFS volumes. It is not included in an ordinary directory listing. /// /// Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This flag is /// not supported until Windows 8 and Windows Server 2012. /// /// FILE_ATTRIBUTE_NO_SCRUB_DATA = 0x00020000, /// FILE_ATTRIBUTE_EA = 0x00040000, /// Used to prevent the file from being purged from local storage when running low on disk space. FILE_ATTRIBUTE_PINNED = 0x00080000, /// Indicate that the file is not stored locally. FILE_ATTRIBUTE_UNPINNED = 0x00100000, /// /// This attribute only appears in directory enumeration classes (FILE_DIRECTORY_INFORMATION, FILE_BOTH_DIR_INFORMATION, etc.). When /// this attribute is set, it means that the file or directory has no physical representation on the local system; the item is /// virtual. Opening the item will be more expensive than normal, e.g. it will cause at least some of it to be fetched from a remote store. /// FILE_ATTRIBUTE_RECALL_ON_OPEN = 0x00040000, /// /// When this attribute is set, it means that the file or directory is not fully present locally. For a file that means that not all /// of its data is on local storage (e.g. it may be sparse with some data still in remote storage). For a directory it means that /// some of the directory contents are being virtualized from another location. Reading the file / enumerating the directory will be /// more expensive than normal, e.g. it will cause at least some of the file/directory content to be fetched from a remote store. /// Only kernel-mode callers can set this bit. /// FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS = 0x00400000, /// FILE_ATTRIBUTE_STRICTLY_SEQUENTIAL = 0x20000000, /// /// Write operations will not go through any intermediate cache, they will go directly to disk. /// For additional information, see the Caching Behavior section of this topic. /// FILE_FLAG_WRITE_THROUGH = 0x80000000, /// /// 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. /// /// /// For information about considerations when using a file handle created with this flag, see the Synchronous and Asynchronous I/O /// Handles section of this topic. /// /// FILE_FLAG_OVERLAPPED = 0x40000000, /// /// The 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 using the FILE_FLAG_NO_BUFFERING flag, /// for details see File Buffering. /// /// FILE_FLAG_NO_BUFFERING = 0x20000000, /// /// 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 FILE_FLAG_NO_BUFFERING. /// For more information, see the Caching Behavior section of this topic. /// FILE_FLAG_RANDOM_ACCESS = 0x10000000, /// /// 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 FILE_FLAG_NO_BUFFERING. /// For more information, see the Caching Behavior section of this topic. /// FILE_FLAG_SEQUENTIAL_SCAN = 0x08000000, /// /// 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 FILE_SHARE_DELETE share mode. /// /// Subsequent open requests for the file fail, unless the FILE_SHARE_DELETE share mode is specified. /// FILE_FLAG_DELETE_ON_CLOSE = 0x04000000, /// /// 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 SE_BACKUP_NAME and SE_RESTORE_NAME privileges. For more information, see Changing Privileges /// in a Token. /// /// 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. For more information, see the Remarks section. /// /// FILE_FLAG_BACKUP_SEMANTICS = 0x02000000, /// /// 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. /// FILE_FLAG_POSIX_SEMANTICS = 0x01000000, /// /// 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. /// Windows Server 2008 R2 and Windows Server 2008: This flag is not supported before Windows Server 2012. /// FILE_FLAG_SESSION_AWARE = 0x00800000, /// /// Normal reparse point processing will not occur; CreateFile 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 CREATE_ALWAYS flag. /// If the file is not a reparse point, then this flag is ignored. /// FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000, /// /// 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. /// FILE_FLAG_OPEN_NO_RECALL = 0x00100000, /// /// If you attempt to create multiple instances of a pipe with this flag, creation of the first instance succeeds, but creation of /// the next instance fails with ERROR_ACCESS_DENIED. /// FILE_FLAG_FIRST_PIPE_INSTANCE = 0x00080000, /// Impersonates a client at the Anonymous impersonation level. SECURITY_ANONYMOUS = 0x00000000, /// Impersonates a client at the Identification impersonation level. SECURITY_IDENTIFICATION = 0x00010000, /// /// Impersonate a client at the impersonation level. This is the default behavior if no other flags are specified along with the /// SECURITY_SQOS_PRESENT flag. /// SECURITY_IMPERSONATION = 0x00020000, /// Impersonates a client at the Delegation impersonation level. SECURITY_DELEGATION = 0x00030000, /// The security tracking mode is dynamic. If this flag is not specified, the security tracking mode is static. SECURITY_CONTEXT_TRACKING = 0x00040000, /// /// Only the enabled aspects of the client's security context are available to the server. If you do not specify this flag, all /// aspects of the client's security context are available. /// This allows the client to limit the groups and privileges that a server can use while impersonating the client. /// SECURITY_EFFECTIVE_ONLY = 0x00080000, /// Include to enable the other SECURITY_ flags. SECURITY_SQOS_PRESENT = 0x00100000, } }