Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CreateFileHandle()

static unsafe SafeFileHandle System.IO.FileSystemAclExtensions.CreateFileHandle ( string fullPath,
FileMode mode,
FileSystemRights rights,
FileShare share,
FileOptions options,
FileSecurity security )
inlinestaticprivate

Definition at line 186 of file FileSystemAclExtensions.cs.

187 {
188 if (mode == FileMode.Append)
189 {
190 mode = FileMode.OpenOrCreate;
191 }
192 int dwFlagsAndAttributes = (int)(options | (FileOptions)1048576 | FileOptions.None);
193 SafeFileHandle safeFileHandle;
194 fixed (byte* ptr = security.GetSecurityDescriptorBinaryForm())
195 {
196 global::Interop.Kernel32.SECURITY_ATTRIBUTES sECURITY_ATTRIBUTES = default(global::Interop.Kernel32.SECURITY_ATTRIBUTES);
197 sECURITY_ATTRIBUTES.nLength = (uint)sizeof(global::Interop.Kernel32.SECURITY_ATTRIBUTES);
198 sECURITY_ATTRIBUTES.bInheritHandle = (((share & FileShare.Inheritable) != 0) ? global::Interop.BOOL.TRUE : global::Interop.BOOL.FALSE);
199 sECURITY_ATTRIBUTES.lpSecurityDescriptor = (IntPtr)ptr;
200 global::Interop.Kernel32.SECURITY_ATTRIBUTES sECURITY_ATTRIBUTES2 = sECURITY_ATTRIBUTES;
202 {
203 safeFileHandle = global::Interop.Kernel32.CreateFile(fullPath, (int)rights, share, &sECURITY_ATTRIBUTES2, mode, dwFlagsAndAttributes, IntPtr.Zero);
204 ValidateFileHandle(safeFileHandle, fullPath);
205 }
206 }
207 return safeFileHandle;
208 }
static unsafe SafeFileHandle CreateFile(string fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
static void ValidateFileHandle(SafeFileHandle handle, string fullPath)
static System.IO.DisableMediaInsertionPrompt Create()

References System.IO.DisableMediaInsertionPrompt.Create(), Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(), System.Security.AccessControl.ObjectSecurity< T >.GetSecurityDescriptorBinaryForm(), System.options, System.IO.FileSystemAclExtensions.ValidateFileHandle(), and System.IntPtr.Zero.

Referenced by System.IO.FileSystemAclExtensions.Create().