1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/DeviceManagementDeclarations.cs Wed May 14 07:52:21 2014 +0200
1.3 @@ -0,0 +1,58 @@
1.4 +using System;
1.5 +using System.Runtime.InteropServices;
1.6 +
1.7 +namespace GenericHid
1.8 +{
1.9 + internal sealed partial class DeviceManagement
1.10 + {
1.11 + internal static class NativeMethods
1.12 + {
1.13 + ///<summary >
1.14 + // API declarations relating to device management (SetupDixxx and
1.15 + // RegisterDeviceNotification functions).
1.16 + /// </summary>
1.17 +
1.18 + // from setupapi.h
1.19 +
1.20 + internal const Int32 DIGCF_PRESENT = 2;
1.21 + internal const Int32 DIGCF_DEVICEINTERFACE = 0X10;
1.22 +
1.23 + internal struct SP_DEVICE_INTERFACE_DATA
1.24 + {
1.25 + internal Int32 cbSize;
1.26 + internal Guid InterfaceClassGuid;
1.27 + internal Int32 Flags;
1.28 + internal IntPtr Reserved;
1.29 + }
1.30 +
1.31 + internal struct SP_DEVICE_INTERFACE_DETAIL_DATA
1.32 + {
1.33 + internal Int32 cbSize;
1.34 + internal String DevicePath;
1.35 + }
1.36 +
1.37 + internal struct SP_DEVINFO_DATA
1.38 + {
1.39 + internal Int32 cbSize;
1.40 + internal Guid ClassGuid;
1.41 + internal Int32 DevInst;
1.42 + internal Int32 Reserved;
1.43 + }
1.44 +
1.45 + [DllImport("setupapi.dll", SetLastError = true)]
1.46 + internal static extern IntPtr SetupDiCreateDeviceInfoList(ref Guid ClassGuid, IntPtr hwndParent);
1.47 +
1.48 + [DllImport("setupapi.dll", SetLastError = true)]
1.49 + internal static extern Int32 SetupDiDestroyDeviceInfoList(IntPtr DeviceInfoSet);
1.50 +
1.51 + [DllImport("setupapi.dll", SetLastError = true)]
1.52 + internal static extern Boolean SetupDiEnumDeviceInterfaces(IntPtr DeviceInfoSet, IntPtr DeviceInfoData, ref Guid InterfaceClassGuid, Int32 MemberIndex, ref SP_DEVICE_INTERFACE_DATA DeviceInterfaceData);
1.53 +
1.54 + [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)]
1.55 + internal static extern IntPtr SetupDiGetClassDevs(ref Guid ClassGuid, IntPtr Enumerator, IntPtr hwndParent, Int32 Flags);
1.56 +
1.57 + [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)]
1.58 + internal static extern Boolean SetupDiGetDeviceInterfaceDetail(IntPtr DeviceInfoSet, ref SP_DEVICE_INTERFACE_DATA DeviceInterfaceData, IntPtr DeviceInterfaceDetailData, Int32 DeviceInterfaceDetailDataSize, ref Int32 RequiredSize, IntPtr DeviceInfoData);
1.59 + }
1.60 + }
1.61 +}