sl@0
|
1 |
using System;
|
sl@0
|
2 |
using System.Runtime.InteropServices;
|
sl@0
|
3 |
|
sl@0
|
4 |
namespace GenericHid
|
sl@0
|
5 |
{
|
sl@0
|
6 |
internal sealed partial class DeviceManagement
|
sl@0
|
7 |
{
|
sl@0
|
8 |
internal static class NativeMethods
|
sl@0
|
9 |
{
|
sl@0
|
10 |
///<summary >
|
sl@0
|
11 |
// API declarations relating to device management (SetupDixxx and
|
sl@0
|
12 |
// RegisterDeviceNotification functions).
|
sl@0
|
13 |
/// </summary>
|
sl@0
|
14 |
|
sl@0
|
15 |
// from setupapi.h
|
sl@0
|
16 |
|
sl@0
|
17 |
internal const Int32 DIGCF_PRESENT = 2;
|
sl@0
|
18 |
internal const Int32 DIGCF_DEVICEINTERFACE = 0X10;
|
sl@0
|
19 |
|
sl@0
|
20 |
internal struct SP_DEVICE_INTERFACE_DATA
|
sl@0
|
21 |
{
|
sl@0
|
22 |
internal Int32 cbSize;
|
sl@0
|
23 |
internal Guid InterfaceClassGuid;
|
sl@0
|
24 |
internal Int32 Flags;
|
sl@0
|
25 |
internal IntPtr Reserved;
|
sl@0
|
26 |
}
|
sl@0
|
27 |
|
sl@0
|
28 |
internal struct SP_DEVICE_INTERFACE_DETAIL_DATA
|
sl@0
|
29 |
{
|
sl@0
|
30 |
internal Int32 cbSize;
|
sl@0
|
31 |
internal String DevicePath;
|
sl@0
|
32 |
}
|
sl@0
|
33 |
|
sl@0
|
34 |
internal struct SP_DEVINFO_DATA
|
sl@0
|
35 |
{
|
sl@0
|
36 |
internal Int32 cbSize;
|
sl@0
|
37 |
internal Guid ClassGuid;
|
sl@0
|
38 |
internal Int32 DevInst;
|
sl@0
|
39 |
internal Int32 Reserved;
|
sl@0
|
40 |
}
|
sl@0
|
41 |
|
sl@0
|
42 |
[DllImport("setupapi.dll", SetLastError = true)]
|
sl@0
|
43 |
internal static extern IntPtr SetupDiCreateDeviceInfoList(ref Guid ClassGuid, IntPtr hwndParent);
|
sl@0
|
44 |
|
sl@0
|
45 |
[DllImport("setupapi.dll", SetLastError = true)]
|
sl@0
|
46 |
internal static extern Int32 SetupDiDestroyDeviceInfoList(IntPtr DeviceInfoSet);
|
sl@0
|
47 |
|
sl@0
|
48 |
[DllImport("setupapi.dll", SetLastError = true)]
|
sl@0
|
49 |
internal static extern Boolean SetupDiEnumDeviceInterfaces(IntPtr DeviceInfoSet, IntPtr DeviceInfoData, ref Guid InterfaceClassGuid, Int32 MemberIndex, ref SP_DEVICE_INTERFACE_DATA DeviceInterfaceData);
|
sl@0
|
50 |
|
sl@0
|
51 |
[DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)]
|
sl@0
|
52 |
internal static extern IntPtr SetupDiGetClassDevs(ref Guid ClassGuid, IntPtr Enumerator, IntPtr hwndParent, Int32 Flags);
|
sl@0
|
53 |
|
sl@0
|
54 |
[DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)]
|
sl@0
|
55 |
internal static extern Boolean SetupDiGetDeviceInterfaceDetail(IntPtr DeviceInfoSet, ref SP_DEVICE_INTERFACE_DATA DeviceInterfaceData, IntPtr DeviceInterfaceDetailData, Int32 DeviceInterfaceDetailDataSize, ref Int32 RequiredSize, IntPtr DeviceInfoData);
|
sl@0
|
56 |
}
|
sl@0
|
57 |
}
|
sl@0
|
58 |
}
|