HidLibrary.NativeMethods.CreateFile C# (CSharp) Method

CreateFile() private method

private CreateFile ( string lpFileName, uint dwDesiredAccess, int dwShareMode, SECURITY_ATTRIBUTES &lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, int hTemplateFile ) : IntPtr
lpFileName string
dwDesiredAccess uint
dwShareMode int
lpSecurityAttributes SECURITY_ATTRIBUTES
dwCreationDisposition int
dwFlagsAndAttributes int
hTemplateFile int
return System.IntPtr
        internal static extern IntPtr CreateFile(string lpFileName, uint dwDesiredAccess, int dwShareMode, ref SECURITY_ATTRIBUTES lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, int hTemplateFile);

Same methods

NativeMethods::CreateFile ( String lpFileName, UInt32 dwDesiredAccess, Int32 dwShareMode, IntPtr lpSecurityAttributes, Int32 dwCreationDisposition, Int32 dwFlagsAndAttributes, Int32 hTemplateFile ) : SafeFileHandle

Usage Example

Example #1
0
        private static IntPtr OpenDeviceIO(string devicePath, DeviceMode deviceMode, uint deviceAccess)
        {
            NativeMethods.SECURITY_ATTRIBUTES lpSecurityAttributes = default(NativeMethods.SECURITY_ATTRIBUTES);
            int dwFlagsAndAttributes = 0;

            if (deviceMode == DeviceMode.Overlapped)
            {
                dwFlagsAndAttributes = 1073741824;
            }
            lpSecurityAttributes.lpSecurityDescriptor = IntPtr.Zero;
            lpSecurityAttributes.bInheritHandle       = true;
            lpSecurityAttributes.nLength = Marshal.SizeOf((object)lpSecurityAttributes);
            return(NativeMethods.CreateFile(devicePath, deviceAccess, 3, ref lpSecurityAttributes, 3, dwFlagsAndAttributes, 0));
        }
All Usage Examples Of HidLibrary.NativeMethods::CreateFile