SafeFileHandle (kernel32)
Last changed: -81.247.25.174

.

using Microsoft.Win32.SafeHandles;

C# Signature:

[DllImport("kernel32.dll", SetLastError = true, CharSet=CharSet.Unicode)]

    static extern SafeFileHandle CreateFile(string lpFileName, uint dwDesiredAccess,
      uint dwShareMode, IntPtr lpSecurityAttributes, uint dwCreationDisposition,
      uint dwFlagsAndAttributes, IntPtr hTemplateFile);

VB.NET

<DllImport("kernel32.dll", SetLastError:=True, CharSet:=CharSet.Unicode)> _

    Private Shared Function CreateFile(ByVal lpFileName As String, ByVal dwDesiredAccess As System.UInt32, ByVal dwShareMode As System.UInt32, ByVal lpSecurityAttributes As IntPtr, ByVal dwCreationDisposition As System.UInt32, ByVal dwFlagsAndAttributes As System.UInt32, ByVal hTemplateFile As IntPtr) As Microsoft.Win32.SafeHandles.SafeFileHandle