Mercurial > hg > ucis.core
comparison USBLib/Internal/Windows/SetupApi.cs @ 21:dcfec2be27c9
Added USBLib
author | Ivo Smits <Ivo@UCIS.nl> |
---|---|
date | Mon, 15 Apr 2013 01:04:59 +0200 |
parents | |
children | 5b14fed54a89 |
comparison
equal
deleted
inserted
replaced
20:c873e3dd73fe | 21:dcfec2be27c9 |
---|---|
1 using System; | |
2 using System.Collections.Generic; | |
3 using System.Runtime.InteropServices; | |
4 using System.Text; | |
5 using UCIS.HWLib.Windows.Devices; | |
6 using Microsoft.Win32; | |
7 using Microsoft.Win32.SafeHandles; | |
8 | |
9 namespace UCIS.USBLib.Internal.Windows { | |
10 class SafeDeviceInfoSetHandle : SafeHandleZeroOrMinusOneIsInvalid { | |
11 public SafeDeviceInfoSetHandle() : base(true) { } | |
12 //public SafeDeviceInfoSetHandle(IntPtr handle) : base(true) { SetHandle(handle); } | |
13 protected override bool ReleaseHandle() { | |
14 if (IsInvalid) return true; | |
15 bool bSuccess = SetupApi.SetupDiDestroyDeviceInfoList(handle); | |
16 handle = IntPtr.Zero; | |
17 return bSuccess; | |
18 } | |
19 } | |
20 class SetupApi { | |
21 [DllImport("setupapi.dll", CharSet = CharSet.Auto)] | |
22 public static extern SafeDeviceInfoSetHandle SetupDiGetClassDevs(IntPtr ClassGuid, [MarshalAs(UnmanagedType.LPTStr)] string Enumerator, IntPtr hwndParent, int Flags); | |
23 [DllImport("setupapi.dll", CharSet = CharSet.Auto)] | |
24 public static extern SafeDeviceInfoSetHandle SetupDiGetClassDevsA(ref Guid ClassGuid, [MarshalAs(UnmanagedType.LPTStr)] string Enumerator, IntPtr hwndParent, DICFG Flags); | |
25 [DllImport("setupapi.dll", CharSet = CharSet.Auto)] | |
26 public static extern SafeDeviceInfoSetHandle SetupDiGetClassDevsA(IntPtr ClassGuid, [MarshalAs(UnmanagedType.LPStr)] string Enumerator, IntPtr hwndParent, DICFG Flags); | |
27 | |
28 [DllImport("setupapi.dll", CharSet = CharSet.Auto /*, SetLastError = true*/)] | |
29 public static extern bool SetupDiDestroyDeviceInfoList(IntPtr hDevInfo); | |
30 | |
31 [DllImport("setupapi.dll", SetLastError = true)] | |
32 public static extern bool SetupDiEnumDeviceInfo(SafeDeviceInfoSetHandle DeviceInfoSet, int MemberIndex, ref SP_DEVINFO_DATA DeviceInfoData); | |
33 [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)] | |
34 public static extern Boolean SetupDiEnumDeviceInterfaces(SafeDeviceInfoSetHandle hDevInfo, ref SP_DEVINFO_DATA devInfo, ref Guid interfaceClassGuid, int memberIndex, ref SP_DEVICE_INTERFACE_DATA deviceInterfaceData); | |
35 [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)] | |
36 public static extern Boolean SetupDiEnumDeviceInterfaces(SafeDeviceInfoSetHandle hDevInfo, IntPtr devInfo, ref Guid interfaceClassGuid, int memberIndex, ref SP_DEVICE_INTERFACE_DATA deviceInterfaceData); | |
37 [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)] | |
38 public static extern Boolean SetupDiGetDeviceInterfaceDetail(SafeDeviceInfoSetHandle hDevInfo, ref SP_DEVICE_INTERFACE_DATA deviceInterfaceData, ref SP_DEVICE_INTERFACE_DETAIL_DATA deviceInterfaceDetailData, int deviceInterfaceDetailDataSize, out int requiredSize, ref SP_DEVINFO_DATA deviceInfoData); | |
39 | |
40 [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)] | |
41 public static extern bool SetupDiGetCustomDeviceProperty(SafeDeviceInfoSetHandle DeviceInfoSet, ref SP_DEVINFO_DATA DeviceInfoData, string CustomPropertyName, DICUSTOMDEVPROP Flags, out RegistryValueKind PropertyRegDataType, Byte[] PropertyBuffer, int PropertyBufferSize, out int RequiredSize); | |
42 [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Ansi)] | |
43 public static extern bool SetupDiGetDeviceInstanceIdA(SafeDeviceInfoSetHandle DeviceInfoSet, ref SP_DEVINFO_DATA DeviceInfoData, StringBuilder DeviceInstanceId, int DeviceInstanceIdSize, out int RequiredSize); | |
44 [DllImport("setupapi.dll", CharSet = CharSet.Auto)] | |
45 public static extern bool SetupDiGetDeviceInterfacePropertyKeys(SafeDeviceInfoSetHandle DeviceInfoSet, ref SP_DEVICE_INTERFACE_DATA DeviceInterfaceData, byte[] propKeyBuffer, int propKeyBufferElements, out int RequiredPropertyKeyCount, int Flags); | |
46 [DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)] | |
47 public static extern bool SetupDiGetDeviceRegistryProperty(SafeDeviceInfoSetHandle DeviceInfoSet, ref SP_DEVINFO_DATA DeviceInfoData, SPDRP Property, out RegistryValueKind PropertyRegDataType, byte[] PropertyBuffer, int PropertyBufferSize, out int RequiredSize); | |
48 [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] | |
49 public static extern bool SetupDiGetDeviceRegistryProperty(SafeDeviceInfoSetHandle DeviceInfoSet, ref SP_DEVINFO_DATA DeviceInfoData, SPDRP iProperty, out int PropertyRegDataType, IntPtr PropertyBuffer, int PropertyBufferSize, out int RequiredSize); | |
50 [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] | |
51 public static extern bool SetupDiGetDeviceRegistryProperty(SafeDeviceInfoSetHandle DeviceInfoSet, ref SP_DEVINFO_DATA DeviceInfoData, SPDRP iProperty, out int PropertyRegDataType, [MarshalAs(UnmanagedType.LPTStr)] StringBuilder PropertyBuffer, int PropertyBufferSize, out int RequiredSize); | |
52 | |
53 [DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)] | |
54 public static extern bool SetupDiGetDeviceInstanceId(SafeDeviceInfoSetHandle DeviceInfoSet, ref SP_DEVINFO_DATA DeviceInfoData, StringBuilder DeviceInstanceId, int DeviceInstanceIdSize, out int RequiredSize); | |
55 | |
56 [DllImport("setupapi.dll")] | |
57 public static extern bool SetupDiSetClassInstallParams(SafeDeviceInfoSetHandle DeviceInfoSet, ref SP_DEVINFO_DATA DeviceInfoData, ref SP_CLASSINSTALL_HEADER ClassInstallParams, int ClassInstallParamsSize); | |
58 | |
59 [DllImport("setupapi.dll")] | |
60 public static extern bool SetupDiCallClassInstaller(int InstallFunction, SafeDeviceInfoSetHandle DeviceInfoSet, ref SP_DEVINFO_DATA DeviceInfoData); | |
61 | |
62 [DllImport("setupapi.dll", CharSet = CharSet.Auto)] | |
63 public static extern CR CM_Get_Device_ID(UInt32 dnDevInst, StringBuilder Buffer, int BufferLen, int ulFlags); | |
64 [DllImport("setupapi.dll", CharSet = CharSet.Auto)] | |
65 public static extern CR CM_Get_Device_ID(UInt32 dnDevInst, IntPtr Buffer, int BufferLen, int ulFlags); | |
66 [DllImport("setupapi.dll", CharSet = CharSet.Auto)] | |
67 public static extern CR CM_Get_Device_ID_Size(out UInt32 pulLen, UInt32 dnDevInst, UInt32 ulFlags); | |
68 [DllImport("setupapi.dll")] | |
69 public static extern CR CM_Get_Parent(out UInt32 pdnDevInst, UInt32 dnDevInst, int ulFlags); | |
70 | |
71 [DllImport("setupapi.dll", CharSet = CharSet.Auto)] | |
72 public static extern CR CM_Locate_DevNode(out UInt32 pdnDevInst, [MarshalAs(UnmanagedType.LPWStr)] String pDeviceID, UInt32 ulFlags); | |
73 [DllImport("setupapi.dll", CharSet = CharSet.Auto)] | |
74 public static extern CR CM_Get_Sibling(out UInt32 pdnDevInst, UInt32 DevInst, UInt32 ulFlags); | |
75 [DllImport("setupapi.dll", CharSet = CharSet.Auto)] | |
76 public static extern CR CM_Get_Child(out UInt32 pdnDevInst, UInt32 dnDevInst, UInt32 ulFlags); | |
77 [DllImport("setupapi.dll", CharSet = CharSet.Auto)] | |
78 public static extern CR CM_Get_DevNode_Registry_Property(UInt32 dnDevInst, CMRDP ulProperty, out UInt32 pulRegDataType, Byte[] Buffer, ref UInt32 pulLength, UInt32 ulFlags); | |
79 [DllImport("setupapi.dll", CharSet = CharSet.Auto)] | |
80 public static extern CR CM_Get_Device_Interface_List([In] ref Guid InterfaceClassGuid, [MarshalAs(UnmanagedType.LPWStr)] String pDeviceID, Byte[] Buffer, UInt32 BufferLen, UInt32 ulFlags); | |
81 [DllImport("setupapi.dll", CharSet = CharSet.Auto)] | |
82 public static extern CR CM_Get_Device_Interface_List_Size(out UInt32 pulLen, [In] ref Guid InterfaceClassGuid, [MarshalAs(UnmanagedType.LPWStr)] String pDeviceID, UInt32 ulFlags); | |
83 [DllImport("setupapi.dll", CharSet = CharSet.Auto)] | |
84 public static extern CR CM_Enumerate_Classes(UInt32 ulClassIndex, out Guid ClassGuid, UInt32 ulFlags); | |
85 [DllImport("setupapi.dll", CharSet = CharSet.Auto)] | |
86 public static extern CR CM_Get_DevNode_Status(out UInt32 pulStatus, out UInt32 pulProblemNumber, UInt32 dnDevInst, UInt32 ulFlags); | |
87 | |
88 | |
89 //public const int DIGCF_DEFAULT = 0x00000001; // only valid with DIGCF_DEVICEINTERFACE | |
90 public const int DIGCF_PRESENT = 0x00000002; | |
91 public const int DIGCF_ALLCLASSES = 0x00000004; | |
92 public const int DIGCF_PROFILE = 0x00000008; | |
93 public const int DIGCF_DEVICEINTERFACE = 0x00000010; | |
94 | |
95 internal static Guid? GetAsGuid(byte[] buffer) { if (buffer == null) return null; else return GetAsGuid(buffer, buffer.Length); } | |
96 internal static Guid GetAsGuid(byte[] buffer, int len) { | |
97 if (len != 16) return Guid.Empty; | |
98 byte[] guidBytes = new byte[len]; | |
99 Array.Copy(buffer, guidBytes, guidBytes.Length); | |
100 return new Guid(guidBytes); | |
101 } | |
102 internal static string GetAsString(byte[] buffer) { return GetAsString(buffer, buffer.Length); } | |
103 internal static string GetAsString(byte[] buffer, int len) { | |
104 if (len <= 2) return String.Empty; | |
105 return Encoding.Unicode.GetString(buffer, 0, len).TrimEnd('\0'); | |
106 } | |
107 internal static string[] GetAsStringArray(byte[] buffer) { return GetAsStringArray(buffer, buffer.Length); } | |
108 internal static string[] GetAsStringArray(byte[] buffer, int len) { | |
109 return GetAsString(buffer, len).Split(new char[] { '\0' }, StringSplitOptions.RemoveEmptyEntries); | |
110 } | |
111 internal static Int32? GetAsInt32(byte[] buffer) { if (buffer == null) return null; else return GetAsInt32(buffer, buffer.Length); } | |
112 internal static Int32 GetAsInt32(byte[] buffer, int len) { | |
113 if (len != 4) return 0; | |
114 return buffer[0] | ((buffer[1]) << 8) | ((buffer[2]) << 16) | ((buffer[3]) << 24); | |
115 } | |
116 | |
117 public static IDictionary<String, Object> GetSPDRPProperties(DeviceNode device) { | |
118 Dictionary<string, object> deviceProperties = new Dictionary<string, object>(); | |
119 foreach (SPDRP prop in Enum.GetValues(typeof(SPDRP))) { | |
120 Byte[] propBuffer = device.GetProperty(prop); | |
121 if (propBuffer == null) continue; | |
122 int iReturnBytes = propBuffer.Length; | |
123 object oValue = null; | |
124 switch (prop) { | |
125 case SPDRP.PhysicalDeviceObjectName: | |
126 case SPDRP.LocationInformation: | |
127 case SPDRP.Class: | |
128 case SPDRP.Mfg: | |
129 case SPDRP.DeviceDesc: | |
130 case SPDRP.Driver: | |
131 case SPDRP.EnumeratorName: | |
132 case SPDRP.FriendlyName: | |
133 case SPDRP.ClassGuid: | |
134 case SPDRP.Service: | |
135 oValue = GetAsString(propBuffer, iReturnBytes); | |
136 break; | |
137 case SPDRP.HardwareId: | |
138 case SPDRP.CompatibleIds: | |
139 case SPDRP.LocationPaths: | |
140 oValue = GetAsStringArray(propBuffer, iReturnBytes); | |
141 break; | |
142 case SPDRP.BusNumber: | |
143 case SPDRP.InstallState: | |
144 case SPDRP.LegacyBusType: | |
145 case SPDRP.RemovalPolicy: | |
146 case SPDRP.UiNumber: | |
147 case SPDRP.Address: | |
148 oValue = GetAsInt32(propBuffer, iReturnBytes); | |
149 break; | |
150 case SPDRP.BusTypeGuid: | |
151 oValue = GetAsGuid(propBuffer, iReturnBytes); | |
152 break; | |
153 default: | |
154 oValue = propBuffer; | |
155 break; | |
156 } | |
157 deviceProperties.Add(prop.ToString(), oValue); | |
158 } | |
159 return deviceProperties; | |
160 } | |
161 } | |
162 | |
163 [StructLayout(LayoutKind.Sequential)] | |
164 struct SP_DEVICE_INTERFACE_DATA { | |
165 public UInt32 cbSize; | |
166 public Guid interfaceClassGuid; | |
167 public UInt32 flags; | |
168 private UIntPtr reserved; | |
169 public SP_DEVICE_INTERFACE_DATA(Boolean b) : this() { | |
170 cbSize = (uint)Marshal.SizeOf(typeof(SP_DEVICE_INTERFACE_DATA)); | |
171 } | |
172 } | |
173 [StructLayout(LayoutKind.Sequential)] | |
174 struct SP_DEVINFO_DATA { | |
175 public UInt32 cbSize; | |
176 public Guid ClassGuid; | |
177 public UInt32 DevInst; | |
178 public IntPtr Reserved; | |
179 public SP_DEVINFO_DATA(Boolean b) | |
180 : this() { | |
181 cbSize = (uint)Marshal.SizeOf(typeof(SP_DEVINFO_DATA)); | |
182 } | |
183 } | |
184 [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] | |
185 struct SP_DEVICE_INTERFACE_DETAIL_DATA { | |
186 public uint cbSize; //<summary>The size, in bytes, of the fixed portion of the SP_DEVICE_INTERFACE_DETAIL_DATA structure.</summary> | |
187 //Byte[1] DevicePath | |
188 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)] | |
189 public String DevicePath; //<summary>A NULL-terminated string that contains the device interface path. This path can be passed to Win32 functions such as CreateFile.</summary> | |
190 public SP_DEVICE_INTERFACE_DETAIL_DATA(Boolean b) | |
191 : this() { | |
192 //cbSize should be sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA) which is the same as the following | |
193 //if DevicePath is a 1-byte array and the structure is properly padded... is it really? | |
194 if (IntPtr.Size == 8) cbSize = 8; //Workaround for x64 | |
195 else cbSize = 4 + (uint)Marshal.SystemDefaultCharSize; | |
196 } | |
197 } | |
198 | |
199 enum CR { | |
200 SUCCESS = (0x00000000), | |
201 DEFAULT = (0x00000001), | |
202 OUT_OF_MEMORY = (0x00000002), | |
203 INVALID_POINTER = (0x00000003), | |
204 INVALID_FLAG = (0x00000004), | |
205 INVALID_DEVNODE = (0x00000005), | |
206 INVALID_DEVINST = INVALID_DEVNODE, | |
207 INVALID_RES_DES = (0x00000006), | |
208 INVALID_LOG_CONF = (0x00000007), | |
209 INVALID_ARBITRATOR = (0x00000008), | |
210 INVALID_NODELIST = (0x00000009), | |
211 DEVNODE_HAS_REQS = (0x0000000A), | |
212 DEVINST_HAS_REQS = DEVNODE_HAS_REQS, | |
213 INVALID_RESOURCEID = (0x0000000B), | |
214 DLVXD_NOT_FOUND = (0x0000000C), // WIN 95 ONLY | |
215 NO_SUCH_DEVNODE = (0x0000000D), | |
216 NO_SUCH_DEVINST = NO_SUCH_DEVNODE, | |
217 NO_MORE_LOG_CONF = (0x0000000E), | |
218 NO_MORE_RES_DES = (0x0000000F), | |
219 ALREADY_SUCH_DEVNODE = (0x00000010), | |
220 ALREADY_SUCH_DEVINST = ALREADY_SUCH_DEVNODE, | |
221 INVALID_RANGE_LIST = (0x00000011), | |
222 INVALID_RANGE = (0x00000012), | |
223 FAILURE = (0x00000013), | |
224 NO_SUCH_LOGICAL_DEV = (0x00000014), | |
225 CREATE_BLOCKED = (0x00000015), | |
226 NOT_SYSTEM_VM = (0x00000016), // WIN 95 ONLY | |
227 REMOVE_VETOED = (0x00000017), | |
228 APM_VETOED = (0x00000018), | |
229 INVALID_LOAD_TYPE = (0x00000019), | |
230 BUFFER_SMALL = (0x0000001A), | |
231 NO_ARBITRATOR = (0x0000001B), | |
232 NO_REGISTRY_HANDLE = (0x0000001C), | |
233 REGISTRY_ERROR = (0x0000001D), | |
234 INVALID_DEVICE_ID = (0x0000001E), | |
235 INVALID_DATA = (0x0000001F), | |
236 INVALID_API = (0x00000020), | |
237 DEVLOADER_NOT_READY = (0x00000021), | |
238 NEED_RESTART = (0x00000022), | |
239 NO_MORE_HW_PROFILES = (0x00000023), | |
240 DEVICE_NOT_THERE = (0x00000024), | |
241 NO_SUCH_VALUE = (0x00000025), | |
242 WRONG_TYPE = (0x00000026), | |
243 INVALID_PRIORITY = (0x00000027), | |
244 NOT_DISABLEABLE = (0x00000028), | |
245 FREE_RESOURCES = (0x00000029), | |
246 QUERY_VETOED = (0x0000002A), | |
247 CANT_SHARE_IRQ = (0x0000002B), | |
248 NO_DEPENDENT = (0x0000002C), | |
249 SAME_RESOURCES = (0x0000002D), | |
250 NO_SUCH_REGISTRY_KEY = (0x0000002E), | |
251 INVALID_MACHINENAME = (0x0000002F), // NT ONLY | |
252 REMOTE_COMM_FAILURE = (0x00000030), // NT ONLY | |
253 MACHINE_UNAVAILABLE = (0x00000031), // NT ONLY | |
254 NO_CM_SERVICES = (0x00000032), // NT ONLY | |
255 ACCESS_DENIED = (0x00000033), // NT ONLY | |
256 CALL_NOT_IMPLEMENTED = (0x00000034), | |
257 INVALID_PROPERTY = (0x00000035), | |
258 DEVICE_INTERFACE_ACTIVE = (0x00000036), | |
259 NO_SUCH_DEVICE_INTERFACE = (0x00000037), | |
260 INVALID_REFERENCE_STRING = (0x00000038), | |
261 INVALID_CONFLICT_LIST = (0x00000039), | |
262 INVALID_INDEX = (0x0000003A), | |
263 INVALID_STRUCTURE_SIZE = (0x0000003B), | |
264 NUM_CR_RESULTS = (0x0000003C) | |
265 } | |
266 [Flags] | |
267 enum DICFG { | |
268 /// <summary> | |
269 /// Return only the device that is associated with the system default device interface, if one is set, for the specified device interface classes. | |
270 /// only valid with <see cref="DEVICEINTERFACE"/>. | |
271 /// </summary> | |
272 DEFAULT = 0x00000001, | |
273 /// <summary> | |
274 /// Return only devices that are currently present in a system. | |
275 /// </summary> | |
276 PRESENT = 0x00000002, | |
277 /// <summary> | |
278 /// Return a list of installed devices for all device setup classes or all device interface classes. | |
279 /// </summary> | |
280 ALLCLASSES = 0x00000004, | |
281 /// <summary> | |
282 /// Return only devices that are a part of the current hardware profile. | |
283 /// </summary> | |
284 PROFILE = 0x00000008, | |
285 /// <summary> | |
286 /// Return devices that support device interfaces for the specified device interface classes. | |
287 /// </summary> | |
288 DEVICEINTERFACE = 0x00000010, | |
289 } | |
290 enum DICUSTOMDEVPROP { | |
291 NONE = 0, | |
292 MERGE_MULTISZ = 0x00000001, | |
293 } | |
294 public enum SPDRP { | |
295 /// <summary> | |
296 /// Requests a string describing the device, such as "Microsoft PS/2 Port Mouse", typically defined by the manufacturer. | |
297 /// </summary> | |
298 DeviceDesc = (0x00000000), | |
299 /// <summary> | |
300 /// Requests the hardware IDs provided by the device that identify the device. | |
301 /// </summary> | |
302 HardwareId = (0x00000001), | |
303 /// <summary> | |
304 /// Requests the compatible IDs reported by the device. | |
305 /// </summary> | |
306 CompatibleIds = (0x00000002), | |
307 Service = 0x00000004, | |
308 /// <summary> | |
309 /// Requests the name of the device's setup class, in text format. | |
310 /// </summary> | |
311 Class = (0x00000007), | |
312 /// <summary> | |
313 /// Requests the GUID for the device's setup class. | |
314 /// </summary> | |
315 ClassGuid = (0x00000008), | |
316 /// <summary> | |
317 /// Requests the name of the driver-specific registry key. | |
318 /// </summary> | |
319 Driver = (0x00000009), | |
320 ConfigFlags = 0x0000000A, | |
321 /// <summary> | |
322 /// Requests a string identifying the manufacturer of the device. | |
323 /// </summary> | |
324 Mfg = (0x0000000B), | |
325 /// <summary> | |
326 /// Requests a string that can be used to distinguish between two similar devices, typically defined by the class installer. | |
327 /// </summary> | |
328 FriendlyName = (0x0000000C), | |
329 /// <summary> | |
330 /// Requests information about the device's location on the bus; the interpretation of this information is bus-specific. | |
331 /// </summary> | |
332 LocationInformation = (0x0000000D), | |
333 /// <summary> | |
334 /// Requests the name of the PDO for this device. | |
335 /// </summary> | |
336 PhysicalDeviceObjectName = (0x0000000E), | |
337 Capabilities = 0x0000000F, | |
338 /// <summary> | |
339 /// Requests a number associated with the device that can be displayed in the user interface. | |
340 /// </summary> | |
341 UiNumber = (0x00000010), | |
342 UpperFilters = 0x00000011, | |
343 LowerFilters = 0x00000012, | |
344 /// <summary> | |
345 /// Requests the GUID for the bus that the device is connected to. | |
346 /// </summary> | |
347 BusTypeGuid = (0x00000013), | |
348 /// <summary> | |
349 /// Requests the bus type, such as PCIBus or PCMCIABus. | |
350 /// </summary> | |
351 LegacyBusType = (0x00000014), | |
352 /// <summary> | |
353 /// Requests the legacy bus number of the bus the device is connected to. | |
354 /// </summary> | |
355 BusNumber = (0x00000015), | |
356 /// <summary> | |
357 /// Requests the name of the enumerator for the device, such as "USB". | |
358 /// </summary> | |
359 EnumeratorName = (0x00000016), | |
360 DevType = 0x00000019, | |
361 Exclusive = 0x0000001A, | |
362 Characteristics = 0x0000001B, | |
363 /// <summary> | |
364 /// Requests the address of the device on the bus. | |
365 /// </summary> | |
366 Address = (0x0000001C), | |
367 /// <summary> | |
368 /// (Windows XP and later.) Requests the device's current removal policy. The operating system uses this value as a hint to determine how the device is normally removed. | |
369 /// </summary> | |
370 RemovalPolicy = (0x0000001F), | |
371 /// <summary> | |
372 /// Windows XP and later.) Requests the device's installation state. | |
373 /// </summary> | |
374 InstallState = (0x00000022), | |
375 /// <summary> | |
376 /// Device Location Paths (R) | |
377 /// </summary> | |
378 LocationPaths = (0x00000023), | |
379 } | |
380 public enum CMRDP : uint { | |
381 DEVICEDESC = 0x00000001, | |
382 HARDWAREID = 0x00000002, | |
383 COMPATIBLEIDS = 0x00000003, | |
384 SERVICE = 0x00000005, | |
385 CLASS = 0x00000008, | |
386 CLASSGUID = 0x00000009, | |
387 DRIVER = 0x0000000A, | |
388 CONFIGFLAGS = 0x0000000B, | |
389 MFG = 0x0000000C, | |
390 FRIENDLYNAME = 0x0000000D, | |
391 LOCATION_INFORMATION = 0x0000000E, | |
392 PHYSICAL_DEVICE_OBJECT_NAME = 0x0000000F, | |
393 CAPABILITIES = 0x00000010, | |
394 UI_NUMBER = 0x00000011, | |
395 UPPERFILTERS = 0x00000012, | |
396 LOWERFILTERS = 0x00000013, | |
397 BUSTYPEGUID = 0x00000014, | |
398 LEGACYBUSTYPE = 0x00000015, | |
399 BUSNUMBER = 0x00000016, | |
400 ENUMERATOR_NAME = 0x00000017, | |
401 } | |
402 } |