|
| 1 | +// Licensed to the .NET Foundation under one or more agreements. |
| 2 | +// The .NET Foundation licenses this file to you under the MIT license. |
| 3 | +// See the LICENSE file in the project root for more information. |
| 4 | + |
| 5 | +using System; |
| 6 | + |
| 7 | +namespace Interop_TEMP.Windows.NtDll |
| 8 | +{ |
| 9 | + /// <summary> |
| 10 | + /// Options for creating/opening files with NtCreateFile. |
| 11 | + /// </summary> |
| 12 | + [Flags] |
| 13 | + internal enum CreateOptions : uint |
| 14 | + { |
| 15 | + /// <summary> |
| 16 | + /// File being created or opened must be a directory file. Disposition must be FILE_CREATE, FILE_OPEN, |
| 17 | + /// or FILE_OPEN_IF. |
| 18 | + /// </summary> |
| 19 | + /// <remarks> |
| 20 | + /// Can only be used with FILE_SYNCHRONOUS_IO_ALERT/NONALERT, FILE_WRITE_THROUGH, FILE_OPEN_FOR_BACKUP_INTENT, |
| 21 | + /// and FILE_OPEN_BY_FILE_ID flags. |
| 22 | + /// </remarks> |
| 23 | + FILE_DIRECTORY_FILE = 0x00000001, |
| 24 | + |
| 25 | + /// <summary> |
| 26 | + /// Applications that write data to the file must actually transfer the data into |
| 27 | + /// the file before any requested write operation is considered complete. This flag |
| 28 | + /// is set automatically if FILE_NO_INTERMEDIATE_BUFFERING is set. |
| 29 | + /// </summary> |
| 30 | + FILE_WRITE_THROUGH = 0x00000002, |
| 31 | + |
| 32 | + /// <summary> |
| 33 | + /// All accesses to the file are sequential. |
| 34 | + /// </summary> |
| 35 | + FILE_SEQUENTIAL_ONLY = 0x00000004, |
| 36 | + |
| 37 | + /// <summary> |
| 38 | + /// File cannot be cached in driver buffers. Cannot use with AppendData desired access. |
| 39 | + /// </summary> |
| 40 | + FILE_NO_INTERMEDIATE_BUFFERING = 0x00000008, |
| 41 | + |
| 42 | + /// <summary> |
| 43 | + /// All operations are performed synchronously. Any wait on behalf of the caller is |
| 44 | + /// subject to premature termination from alerts. |
| 45 | + /// </summary> |
| 46 | + /// <remarks> |
| 47 | + /// Cannot be used with FILE_SYNCHRONOUS_IO_NONALERT. |
| 48 | + /// Synchronous DesiredAccess flag is required. I/O system will maintain file position context. |
| 49 | + /// </remarks> |
| 50 | + FILE_SYNCHRONOUS_IO_ALERT = 0x00000010, |
| 51 | + |
| 52 | + /// <summary> |
| 53 | + /// All operations are performed synchronously. Waits in the system to synchronize I/O queuing |
| 54 | + /// and completion are not subject to alerts. |
| 55 | + /// </summary> |
| 56 | + /// <remarks> |
| 57 | + /// Cannot be used with FILE_SYNCHRONOUS_IO_ALERT. |
| 58 | + /// Synchronous DesiredAccess flag is required. I/O system will maintain file position context. |
| 59 | + /// </remarks> |
| 60 | + FILE_SYNCHRONOUS_IO_NONALERT = 0x00000020, |
| 61 | + |
| 62 | + /// <summary> |
| 63 | + /// File being created or opened must not be a directory file. Can be a data file, device, |
| 64 | + /// or volume. |
| 65 | + /// </summary> |
| 66 | + FILE_NON_DIRECTORY_FILE = 0x00000040, |
| 67 | + |
| 68 | + /// <summary> |
| 69 | + /// Create a tree connection for this file in order to open it over the network. |
| 70 | + /// </summary> |
| 71 | + /// <remarks> |
| 72 | + /// Not used by device and intermediate drivers. |
| 73 | + /// </remarks> |
| 74 | + FILE_CREATE_TREE_CONNECTION = 0x00000080, |
| 75 | + |
| 76 | + /// <summary> |
| 77 | + /// Complete the operation immediately with a success code of STATUS_OPLOCK_BREAK_IN_PROGRESS if |
| 78 | + /// the target file is oplocked. |
| 79 | + /// </summary> |
| 80 | + /// <remarks> |
| 81 | + /// Not compatible with ReserveOpfilter or OpenRequiringOplock. |
| 82 | + /// Not used by device and intermediate drivers. |
| 83 | + /// </remarks> |
| 84 | + FILE_COMPLETE_IF_OPLOCKED = 0x00000100, |
| 85 | + |
| 86 | + /// <summary> |
| 87 | + /// If the extended attributes on an existing file being opened indicate that the caller must |
| 88 | + /// understand extended attributes to properly interpret the file, fail the request. |
| 89 | + /// </summary> |
| 90 | + /// <remarks> |
| 91 | + /// Not used by device and intermediate drivers. |
| 92 | + /// </remarks> |
| 93 | + FILE_NO_EA_KNOWLEDGE = 0x00000200, |
| 94 | + |
| 95 | + // Behavior undocumented, defined in headers |
| 96 | + // FILE_OPEN_REMOTE_INSTANCE = 0x00000400, |
| 97 | + |
| 98 | + /// <summary> |
| 99 | + /// Accesses to the file can be random, so no sequential read-ahead operations should be performed |
| 100 | + /// on the file by FSDs or the system. |
| 101 | + /// </summary> |
| 102 | + FILE_RANDOM_ACCESS = 0x00000800, |
| 103 | + |
| 104 | + /// <summary> |
| 105 | + /// Delete the file when the last handle to it is passed to NtClose. Requires Delete flag in |
| 106 | + /// DesiredAccess parameter. |
| 107 | + /// </summary> |
| 108 | + FILE_DELETE_ON_CLOSE = 0x00001000, |
| 109 | + |
| 110 | + /// <summary> |
| 111 | + /// Open the file by reference number or object ID. The file name that is specified by the ObjectAttributes |
| 112 | + /// name parameter includes the 8 or 16 byte file reference number or ID for the file in the ObjectAttributes |
| 113 | + /// name field. The device name can optionally be prefixed. |
| 114 | + /// </summary> |
| 115 | + /// <remarks> |
| 116 | + /// NTFS supports both reference numbers and object IDs. 16 byte reference numbers are 8 byte numbers padded |
| 117 | + /// with zeros. ReFS only supports reference numbers (not object IDs). 8 byte and 16 byte reference numbers |
| 118 | + /// are not related. Note that as the UNICODE_STRING will contain raw byte data, it may not be a "valid" string. |
| 119 | + /// Not used by device and intermediate drivers. |
| 120 | + /// </remarks> |
| 121 | + /// <example> |
| 122 | + /// \??\C:\{8 bytes of binary FileID} |
| 123 | + /// \device\HardDiskVolume1\{16 bytes of binary ObjectID} |
| 124 | + /// {8 bytes of binary FileID} |
| 125 | + /// </example> |
| 126 | + FILE_OPEN_BY_FILE_ID = 0x00002000, |
| 127 | + |
| 128 | + /// <summary> |
| 129 | + /// The file is being opened for backup intent. Therefore, the system should check for certain access rights |
| 130 | + /// and grant the caller the appropriate access to the file before checking the DesiredAccess parameter |
| 131 | + /// against the file's security descriptor. |
| 132 | + /// </summary> |
| 133 | + /// <remarks> |
| 134 | + /// Not used by device and intermediate drivers. |
| 135 | + /// </remarks> |
| 136 | + FILE_OPEN_FOR_BACKUP_INTENT = 0x00004000, |
| 137 | + |
| 138 | + /// <summary> |
| 139 | + /// When creating a file, specifies that it should not inherit the compression bit from the parent directory. |
| 140 | + /// </summary> |
| 141 | + FILE_NO_COMPRESSION = 0x00008000, |
| 142 | + |
| 143 | + /// <summary> |
| 144 | + /// The file is being opened and an opportunistic lock (oplock) on the file is being requested as a single atomic |
| 145 | + /// operation. |
| 146 | + /// </summary> |
| 147 | + /// <remarks> |
| 148 | + /// The file system checks for oplocks before it performs the create operation and will fail the create with a |
| 149 | + /// return code of STATUS_CANNOT_BREAK_OPLOCK if the result would be to break an existing oplock. |
| 150 | + /// Not compatible with CompleteIfOplocked or ReserveOpFilter. Windows 7 and up. |
| 151 | + /// </remarks> |
| 152 | + FILE_OPEN_REQUIRING_OPLOCK = 0x00010000, |
| 153 | + |
| 154 | + /// <summary> |
| 155 | + /// CreateFile2 uses this flag to prevent opening a file that you don't have access to without specifying |
| 156 | + /// FILE_SHARE_READ. (Preventing users that can only read a file from denying access to other readers.) |
| 157 | + /// </summary> |
| 158 | + /// <remarks> |
| 159 | + /// Windows 7 and up. |
| 160 | + /// </remarks> |
| 161 | + FILE_DISALLOW_EXCLUSIVE = 0x00020000, |
| 162 | + |
| 163 | + /// <summary> |
| 164 | + /// The client opening the file or device is session aware and per session access is validated if necessary. |
| 165 | + /// </summary> |
| 166 | + /// <remarks> |
| 167 | + /// Windows 8 and up. |
| 168 | + /// </remarks> |
| 169 | + FILE_SESSION_AWARE = 0x00040000, |
| 170 | + |
| 171 | + /// <summary> |
| 172 | + /// This flag allows an application to request a filter opportunistic lock (oplock) to prevent other applications |
| 173 | + /// from getting share violations. |
| 174 | + /// </summary> |
| 175 | + /// <remarks> |
| 176 | + /// Not compatible with CompleteIfOplocked or OpenRequiringOplock. |
| 177 | + /// If there are already open handles, the create request will fail with STATUS_OPLOCK_NOT_GRANTED. |
| 178 | + /// </remarks> |
| 179 | + FILE_RESERVE_OPFILTER = 0x00100000, |
| 180 | + |
| 181 | + /// <summary> |
| 182 | + /// Open a file with a reparse point attribute, bypassing the normal reparse point processing. |
| 183 | + /// </summary> |
| 184 | + FILE_OPEN_REPARSE_POINT = 0x00200000, |
| 185 | + |
| 186 | + /// <summary> |
| 187 | + /// Causes files that are marked with the Offline attribute not to be recalled from remote storage. |
| 188 | + /// </summary> |
| 189 | + /// <remarks> |
| 190 | + /// More details can be found in Remote Storage documentation (see Basic Concepts). |
| 191 | + /// https://technet.microsoft.com/en-us/library/cc938459.aspx |
| 192 | + /// </remarks> |
| 193 | + FILE_OPEN_NO_RECALL = 0x00400000 |
| 194 | + |
| 195 | + // Behavior undocumented, defined in headers |
| 196 | + // FILE_OPEN_FOR_FREE_SPACE_QUERY = 0x00800000 |
| 197 | + } |
| 198 | +} |
0 commit comments