public static extern SafeFileHandle CreateFileW( [MarshalAs(UnmanagedType.LPWStr)] string lpFileName, [MarshalAs(UnmanagedType.U4)] FileAccess dwDesiredAccess, [MarshalAs(UnmanagedType.U4)] FileShare dwShareMode, IntPtr lpSecurityAttributes, [MarshalAs(UnmanagedType.U4)] CreationDisposition dwCreationDisposition, [MarshalAs(UnmanagedType.U4)] FileFlagsAttributes dwFlagsAndAttributes, IntPtr hTemplateFile);
public static extern SafeFileHandle CreateFile( [MarshalAs(UnmanagedType.LPTStr)] string lpFileName, [MarshalAs(UnmanagedType.U4)] FileAccess dwDesiredAccess, [MarshalAs(UnmanagedType.U4)] FileShare dwShareMode, IntPtr lpSecurityAttributes, // optional SECURITY_ATTRIBUTES struct or IntPtr.Zero [MarshalAs(UnmanagedType.U4)] CreationDisposition dwCreationDisposition, [MarshalAs(UnmanagedType.U4)] FileFlagsAttributes dwFlagsAndAttributes, IntPtr hTemplateFile);
public static extern IntPtr CreateFile(string path, FileAccess access, FileSharing sharing, IntPtr security, FileCreation creation, FileFlagsAttributes flagsAndAttributes, IntPtr templateFile);