public static extern bool SetupDiGetDeviceInterfaceDetail( IntPtr deviceInfoSet, DeviceInterfaceData deviceInterfaceData, IntPtr deviceInterfaceDetailData, int deviceInterfaceDetailDataSize, ref int requiredSize, DeviceInfoData deviceInfoData);
public static extern bool SetupDiGetDeviceRegistryProperty( IntPtr deviceInfoSet, DeviceInfoData deviceInfoData, Spdrp property, IntPtr propertyRegDataType, IntPtr propertyBuffer, uint propertyBufferSize, out uint requiredSize);
/// <summary> /// The setup di get device interface detail. /// </summary> /// <returns> /// The <see cref="bool"/>. /// </returns> /// <exception cref="Win32Exception"> /// Is thrown when the unsafe method calls fails. /// </exception> /// <summary> /// The get property. /// </summary> /// <param name="deviceInfoSet"> /// The device info set. /// </param> /// <param name="deviceInfoData"> /// The device info data. /// </param> /// <param name="spdrpDeviceDescription"> /// The spdrp Device Description. /// </param> /// <returns> /// The <see cref="BaseDeviceProperty"/>. /// </returns> public BaseDeviceProperty GetProperty(IntPtr deviceInfoSet, DeviceInfoData deviceInfoData, Spdrp spdrpDeviceDescription) { uint requiredSize; var success = UnsafeNativeMethods.SetupDiGetDeviceRegistryProperty(deviceInfoSet, deviceInfoData, spdrpDeviceDescription, IntPtr.Zero, IntPtr.Zero, 0, out requiredSize); var lastError = _marshalWrapper.GetLastWin32Error(); if (!success && lastError.IsInsufficientBuffer) { var buffer = new byte[requiredSize]; RegistryType regType; success = UnsafeNativeMethods.SetupDiGetDeviceRegistryProperty(deviceInfoSet, deviceInfoData, spdrpDeviceDescription, out regType, buffer, (uint)buffer.Length, out requiredSize); if (success) { return(_devicePropertyFactory.Create(regType, buffer)); } } return(_devicePropertyFactory.Create(RegistryType.Unknown, null)); }
/// <summary> /// The get device interfaces. /// </summary> /// <param name="deviceInformationSetHandle"> /// The device information set handle. /// </param> /// <param name="deviceInfoData"> /// The device Info Data. /// </param> /// <param name="guid"> /// The guid. /// </param> /// <returns> /// The <see> /// <cref>IEnumerable</cref> /// </see> /// . /// </returns> public IEnumerable <DeviceInterface> GetDeviceInterfaces(IntPtr deviceInformationSetHandle, DeviceInfoData deviceInfoData, Guid guid) { var memberIndex = 0U; bool success; if (IsHandleInvalid(deviceInformationSetHandle)) { yield break; } do { var deviceInterfaceData = _deviceInterfaceDataFactory.Create(); success = UnsafeNativeMethods.SetupDiEnumDeviceInterfaces(deviceInformationSetHandle, deviceInfoData, ref guid, memberIndex++, deviceInterfaceData); if (success) { yield return(_deviceInterfaceFactory.Create(deviceInformationSetHandle, deviceInterfaceData)); } }while (success); }
/// <summary> /// The setup di get device interface detail. /// </summary> /// <returns> /// The <see cref="bool"/>. /// </returns> /// <exception cref="Win32Exception"> /// Is thrown when the unsafe method calls fails. /// </exception> /// <summary> /// The get property. /// </summary> /// <param name="deviceInfoSet"> /// The device info set. /// </param> /// <param name="deviceInfoData"> /// The device info data. /// </param> /// <param name="spdrpDeviceDescription"> /// The spdrp Device Description. /// </param> /// <returns> /// The <see cref="BaseDeviceProperty"/>. /// </returns> public BaseDeviceProperty GetProperty(IntPtr deviceInfoSet, DeviceInfoData deviceInfoData, Spdrp spdrpDeviceDescription) { uint requiredSize; var success = UnsafeNativeMethods.SetupDiGetDeviceRegistryProperty(deviceInfoSet, deviceInfoData, spdrpDeviceDescription, IntPtr.Zero, IntPtr.Zero, 0, out requiredSize); var lastError = _marshalWrapper.GetLastWin32Error(); if (!success && lastError.IsInsufficientBuffer) { var buffer = new byte[requiredSize]; RegistryType regType; success = UnsafeNativeMethods.SetupDiGetDeviceRegistryProperty(deviceInfoSet, deviceInfoData, spdrpDeviceDescription, out regType, buffer, (uint)buffer.Length, out requiredSize); if (success) { return _devicePropertyFactory.Create(regType, buffer); } } return _devicePropertyFactory.Create(RegistryType.Unknown, null); }
/// <summary> /// The get device interfaces. /// </summary> /// <param name="deviceInformationSetHandle"> /// The device information set handle. /// </param> /// <param name="deviceInfoData"> /// The device Info Data. /// </param> /// <param name="guid"> /// The guid. /// </param> /// <returns> /// The <see> /// <cref>IEnumerable</cref> /// </see> /// . /// </returns> public IEnumerable<DeviceInterface> GetDeviceInterfaces(IntPtr deviceInformationSetHandle, DeviceInfoData deviceInfoData, Guid guid) { var memberIndex = 0U; bool success; if (IsHandleInvalid(deviceInformationSetHandle)) { yield break; } do { var deviceInterfaceData = _deviceInterfaceDataFactory.Create(); success = UnsafeNativeMethods.SetupDiEnumDeviceInterfaces(deviceInformationSetHandle, deviceInfoData, ref guid, memberIndex++, deviceInterfaceData); if (success) { yield return _deviceInterfaceFactory.Create(deviceInformationSetHandle, deviceInterfaceData); } } while (success); }
public static extern bool SetupDiEnumDeviceInterfaces( IntPtr deviceInfoSet, DeviceInfoData deviceInfoData, ref Guid interfaceClassGuid, uint memberIndex, DeviceInterfaceData deviceInterfaceData);
public static extern bool SetupDiEnumDeviceInfo(IntPtr deviceInfoSet, uint memberIndex, DeviceInfoData deviceInfoData);
public static extern bool SetupDiEnumDeviceInterfaces( IntPtr deviceInfoSet, DeviceInfoData deviceInfoData, ref Guid interfaceClassGuid, uint memberIndex, DeviceInterfaceData deviceInterfaceData);
public static extern bool SetupDiEnumDeviceInfo(IntPtr deviceInfoSet, uint memberIndex, DeviceInfoData deviceInfoData);