Sylloge
A C# helper library
code/WinAPI/SetupAPI.cs
Go to the documentation of this file.
00001 using System;
00002 using System.Collections.Generic;
00003 using System.Linq;
00004 using System.Runtime.InteropServices;
00005 using System.Text;
00006 
00007 namespace Sylloge
00008 {
00009     public static partial class WinAPI
00010     {
00011         public static class SetupAPI
00012         {
00013             #region SetupAPI
00014 
00015             [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
00016             public static extern int CM_Get_Device_ID(IntPtr dnDevInst,
00017                                                         IntPtr Buffer,
00018                                                         int BufferLen,
00019                                                         int ulFlags);
00020 
00021             [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
00022             public static extern int CM_Get_Parent(out IntPtr pdnDevInst,
00023                                             int dnDevInst,
00024                                             int ulFlags);
00025 
00026             [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
00027             public static extern IntPtr SetupDiGetClassDevs(ref Guid ClassGuid,
00028                                                             IntPtr Enumerator,
00029                                                             IntPtr hwndParent,
00030                                                             int Flags);
00031 
00032             [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
00033             [return: MarshalAs(UnmanagedType.Bool)]
00034             public static extern bool SetupDiEnumDeviceInterfaces(IntPtr hDevInfo,
00035                                                                     IntPtr devInfo,
00036                                                                     ref Guid interfaceClassGuid,
00037                                                                     int memberIndex,
00038                                                                     ref SP_DEVICE_INTERFACE_DATA deviceInterfaceData);
00039 
00040             [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
00041             [return: MarshalAs(UnmanagedType.Bool)]
00042             public static extern bool SetupDiEnumDeviceInterfaces(IntPtr hDevInfo,
00043                                                                     ref SP_DEVINFO_DATA devInfo,
00044                                                                     ref Guid interfaceClassGuid,
00045                                                                     int memberIndex,
00046                                                                     ref SP_DEVICE_INTERFACE_DATA deviceInterfaceData);
00047 
00048             [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
00049             [return: MarshalAs(UnmanagedType.Bool)]
00050             public static extern bool SetupDiGetDeviceInterfaceDetail(IntPtr hDevInfo,
00051                                                                         ref SP_DEVICE_INTERFACE_DATA deviceInterfaceData,
00052                                                                         ref SP_DEVICE_INTERFACE_DETAIL_DATA deviceInterfaceDetailData,
00053                                                                         int deviceInterfaceDetailDataSize,
00054                                                                         ref int requiredSize,
00055                                                                         ref SP_DEVINFO_DATA deviceInfoData);
00056 
00057             [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
00058             [return: MarshalAs(UnmanagedType.Bool)]
00059             public static extern bool SetupDiGetDeviceRegistryProperty(IntPtr DeviceInfoSet,
00060                                                                         ref SP_DEVINFO_DATA DeviceInfoData,
00061                                                                         uint Property,
00062                                                                         IntPtr PropertyRegDataType,
00063                                                                         ref byte[] PropertyBuffer,
00064                                                                         uint PropertyBufferSize,
00065                                                                         IntPtr RequiredSize);
00066 
00067             [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
00068             [return: MarshalAs(UnmanagedType.Bool)]
00069             public static extern bool SetupDiDestroyDeviceInfoList(IntPtr DeviceInfoSet);
00070 
00071             [DllImport("setupapi.dll", SetLastError = true)]
00072             [return: MarshalAs(UnmanagedType.Bool)]
00073             public static extern bool SetupDiEnumDeviceInfo(IntPtr DeviceInfoSet, int Index, SP_DEVINFO_DATA InfoData);
00074 
00075             [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)]
00076             [return: MarshalAs(UnmanagedType.Bool)]
00077             public static extern bool SetupDiSetClassInstallParams(IntPtr DeviceInfoSet, IntPtr DeviceInfoData, IntPtr ClassInstallParams, int ClassInstallParamsSize);
00078 
00079             [DllImport("setupapi.dll", CharSet = CharSet.Auto)]
00080             public static extern bool SetupDiCallClassInstaller(UInt32 InstallFunction, IntPtr DeviceInfoSet, IntPtr DeviceInfoData);
00081 
00082             #endregion
00083         }
00084     }
00085 }
 All Classes Namespaces Files Functions Variables Enumerations Properties Events