/* Copyright (C) 2008-2016 Peter Palotas, Jeffrey Jangli, Alexandr Normuradov * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ using System; using System.Diagnostics.CodeAnalysis; using System.IO; namespace Alphaleonis.Win32.Filesystem { /// Specifies how the operating system should open a file. [SuppressMessage("Microsoft.Usage", "CA2217:DoNotMarkEnumsWithFlags")] [Flags] public enum ExtendedFileAttributes { /// If you pass , the set of attributes is unspecified. explicitly sets no attributes. None = 0, #region FILE_ATTRIBUTE - Attributes applying to any file /// The file is read only. Applications can read the file, but cannot write to or delete it. /// Equals 1 ReadOnly = FileAttributes.ReadOnly, /// The file is hidden. Do not include it in an ordinary directory listing. /// Equals 2 Hidden = FileAttributes.Hidden, /// The file is part of or used exclusively by an operating system. /// Equals 4 System = FileAttributes.System, /// The handle that identifies a directory. /// Equals 16 Directory = FileAttributes.Directory, /// The file should be archived. Applications use this attribute to mark files for backup or removal. /// Equals 32 Archive = FileAttributes.Archive, /// The file should be archived. Applications use this attribute to mark files for backup or removal. /// Equals 64 Device = FileAttributes.Device, /// The file does not have other attributes set. This attribute is valid only if used alone. /// Equals 128 Normal = FileAttributes.Normal, /// The file is being used for temporary storage. /// Equals 256 Temporary = FileAttributes.Temporary, /// A file that is a sparse file. /// Equals 512 SparseFile = FileAttributes.SparseFile, /// A file or directory that has an associated reparse point, or a file that is a symbolic link. /// Equals 1024 ReparsePoint = FileAttributes.ReparsePoint, /// 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. /// Equals 2048 Compressed = FileAttributes.Compressed, /// The data of a file is not immediately available. This attribute indicates that file data is physically moved to offline storage. This attribute is used by Remote Storage, the hierarchical storage management software. Applications should not arbitrarily change this attribute. /// Equals 4096 Offline = FileAttributes.Offline, /// The file or directory is not to be indexed by the content indexing service. /// Equals 8192 NotContentIndexed = FileAttributes.NotContentIndexed, /// 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 subdirectories. /// Equals 16384 Encrypted = FileOptions.Encrypted, #endregion // FILE_ATTRIBUTE - Attributes applying to any file /// 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. /// This flag is not supported until Windows Server 2012. IntegrityStream = 32768, /// 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. /// This flag is not supported until Windows Server 2012. NoScrubData = 131072, /// ... FirstPipeInstance = 524288, /// 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. OpenNoRecall = 1048576, /// Normal reparse point processing will not occur; an attempt to open the reparse point will be made. When a file is opened, a file handle is returned, whether or not the filter that controls the reparse point is operational. See MSDN documentation for more information. OpenReparsePoint = 2097152, /// 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. [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Posix")] PosixSemantics = 16777216, /// 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. 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. BackupSemantics = 33554432, /// 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 share mode. Subsequent open requests for the file fail, unless the share mode is specified. /// Equals 67108864 DeleteOnClose = FileOptions.DeleteOnClose, /// Access is intended to be sequential from beginning to end. The system can use this as a hint to optimize file caching. /// Equals 134217728 SequentialScan = FileOptions.SequentialScan, /// Access is intended to be random. The system can use this as a hint to optimize file caching. /// Equals 268435456 RandomAccess = FileOptions.RandomAccess, /// There are strict requirements for successfully working with files opened with the flag, for details see the section on "File Buffering" in the online MSDN documentation. NoBuffering = 536870912, /// The file or device is being opened or created for asynchronous I/O. /// Equals 1073741824 Overlapped = FileOptions.Asynchronous, /// Write operations will not go through any intermediate cache, they will go directly to disk. /// Equals .NET -2147483648 WriteThrough = FileOptions.WriteThrough } }