sl@0
|
1 |
using Microsoft.Win32.SafeHandles;
|
sl@0
|
2 |
using System.Runtime.InteropServices;
|
sl@0
|
3 |
using System;
|
sl@0
|
4 |
|
sl@0
|
5 |
namespace GenericHid
|
sl@0
|
6 |
{
|
sl@0
|
7 |
/// <summary>
|
sl@0
|
8 |
/// Win32 API declarations relating to file I/O.
|
sl@0
|
9 |
/// </summary>
|
sl@0
|
10 |
///
|
sl@0
|
11 |
internal sealed class FileIo
|
sl@0
|
12 |
{
|
sl@0
|
13 |
internal const Int32 FileShareRead = 1;
|
sl@0
|
14 |
internal const Int32 FileShareWrite = 2;
|
sl@0
|
15 |
internal const uint GenericRead = 0X80000000U;
|
sl@0
|
16 |
internal const Int32 GenericWrite = 0X40000000;
|
sl@0
|
17 |
internal const Int32 InvalidHandleValue = -1;
|
sl@0
|
18 |
internal const Int32 OpenExisting = 3;
|
sl@0
|
19 |
|
sl@0
|
20 |
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
sl@0
|
21 |
internal static extern SafeFileHandle CreateFile(String lpFileName, UInt32 dwDesiredAccess, Int32 dwShareMode, IntPtr lpSecurityAttributes, Int32 dwCreationDisposition, Int32 dwFlagsAndAttributes, IntPtr hTemplateFile);
|
sl@0
|
22 |
}
|
sl@0
|
23 |
}
|