Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DeviceNotifications"/> class.
 /// </summary>
 /// <param name="broadcastDeviceInterfaceFactory">
 /// The broadcast Device Interface Factory.
 /// </param>
 /// <param name="marshallWrapper">
 /// The marshall wrapper.
 /// </param>
 /// <param name="unsafeNativeMethodsWrapper">
 /// The unsafe native methods wrapper.
 /// </param>
 /// <param name="processHandleResultFactory">
 /// The process handle result factory.
 /// </param>
 public DeviceNotifications(
     IBroadcastDeviceInterfaceFactory broadcastDeviceInterfaceFactory,
     IMarshalWrapper marshallWrapper,
     IUnsafeNativeMethodsWrapper unsafeNativeMethodsWrapper,
     IProcessHandleResultFactory processHandleResultFactory)
 {
     _broadcastDeviceInterfaceFactory = broadcastDeviceInterfaceFactory;
     _marshallWrapper            = marshallWrapper;
     _unsafeNativeMethodsWrapper = unsafeNativeMethodsWrapper;
     _processHandleResultFactory = processHandleResultFactory;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DeviceNotifications"/> class.
 /// </summary>
 /// <param name="broadcastDeviceInterfaceFactory">
 /// The broadcast Device Interface Factory.
 /// </param>
 /// <param name="marshallWrapper">
 /// The marshall wrapper.
 /// </param>
 /// <param name="unsafeNativeMethodsWrapper">
 /// The unsafe native methods wrapper.
 /// </param>
 /// <param name="processHandleResultFactory">
 /// The process handle result factory.
 /// </param>
 public DeviceNotifications(
     IBroadcastDeviceInterfaceFactory broadcastDeviceInterfaceFactory, 
     IMarshalWrapper marshallWrapper, 
     IUnsafeNativeMethodsWrapper unsafeNativeMethodsWrapper,
     IProcessHandleResultFactory processHandleResultFactory)
 {
     _broadcastDeviceInterfaceFactory = broadcastDeviceInterfaceFactory;
     _marshallWrapper = marshallWrapper;
     _unsafeNativeMethodsWrapper = unsafeNativeMethodsWrapper;
     _processHandleResultFactory = processHandleResultFactory;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DeviceInterfaceDetail"/> class.
 /// </summary>
 /// <param name="deviceInformationSetHandle">
 /// The device Information Set Handle.
 /// </param>
 /// <param name="size">
 /// The size.
 /// </param>
 /// <param name="marshalWrapper">
 /// The marshal Wrapper.
 /// </param>
 /// <param name="deviceInfoDataFactory">
 /// The device Info Data Factory.
 /// </param>
 /// <param name="unsafeNativeMethodsWrapper">
 /// The unsafe Native Methods Wrapper.
 /// </param>
 public DeviceInterfaceDetail(
     IntPtr deviceInformationSetHandle, 
     int size, 
     IMarshalWrapper marshalWrapper, 
     IDeviceInfoDataFactory deviceInfoDataFactory, 
     IUnsafeNativeMethodsWrapper unsafeNativeMethodsWrapper)
 {
     _deviceInformationSetHandle = deviceInformationSetHandle;
     DeviceInfoData = deviceInfoDataFactory.Create();
     _marshalWrapper = marshalWrapper;
     _unsafeNativeMethodsWrapper = unsafeNativeMethodsWrapper;
     DeviceInterfaceDetailBuffer = Marshal.AllocHGlobal(size);
     _marshalWrapper.WriteInteger32(DeviceInterfaceDetailBuffer, (IntPtr.Size == 4) ? (4 + Marshal.SystemDefaultCharSize) : 8);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DeviceInterfaceDetail"/> class.
 /// </summary>
 /// <param name="deviceInformationSetHandle">
 /// The device Information Set Handle.
 /// </param>
 /// <param name="size">
 /// The size.
 /// </param>
 /// <param name="marshalWrapper">
 /// The marshal Wrapper.
 /// </param>
 /// <param name="deviceInfoDataFactory">
 /// The device Info Data Factory.
 /// </param>
 /// <param name="unsafeNativeMethodsWrapper">
 /// The unsafe Native Methods Wrapper.
 /// </param>
 public DeviceInterfaceDetail(
     IntPtr deviceInformationSetHandle,
     int size,
     IMarshalWrapper marshalWrapper,
     IDeviceInfoDataFactory deviceInfoDataFactory,
     IUnsafeNativeMethodsWrapper unsafeNativeMethodsWrapper)
 {
     _deviceInformationSetHandle = deviceInformationSetHandle;
     DeviceInfoData              = deviceInfoDataFactory.Create();
     _marshalWrapper             = marshalWrapper;
     _unsafeNativeMethodsWrapper = unsafeNativeMethodsWrapper;
     DeviceInterfaceDetailBuffer = Marshal.AllocHGlobal(size);
     _marshalWrapper.WriteInteger32(DeviceInterfaceDetailBuffer, (IntPtr.Size == 4) ? (4 + Marshal.SystemDefaultCharSize) : 8);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DeviceInformationElement"/> class.
 /// </summary>
 /// <param name="guid">
 /// The guid.
 /// </param>
 /// <param name="deviceInformationSetHandle">
 /// The device Information Set Handle.
 /// </param>
 /// <param name="deviceInfoData">
 /// The device info data.
 /// </param>
 /// <param name="unsafeNativeMethodsWrapper">
 /// The unsafe Native Methods Wrapper.
 /// </param>
 public DeviceInformationElement(Guid guid, IntPtr deviceInformationSetHandle, DeviceInfoData deviceInfoData, IUnsafeNativeMethodsWrapper unsafeNativeMethodsWrapper)
 {
     DeviceInterfaces = unsafeNativeMethodsWrapper.GetDeviceInterfaces(deviceInformationSetHandle, deviceInfoData, guid);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DeviceInterface"/> class.
 /// </summary>
 /// <param name="deviceInformationSetHandle">
 /// The device Information Set Handle.
 /// </param>
 /// <param name="deviceInterfaceData">
 /// The device interface data.
 /// </param>
 /// <param name="unsafeNativeMethodsWrapper">
 /// The unsafe Native Methods Wrapper.
 /// </param>
 public DeviceInterface(IntPtr deviceInformationSetHandle, DeviceInterfaceData deviceInterfaceData, IUnsafeNativeMethodsWrapper unsafeNativeMethodsWrapper)
 {
     _deviceInterfaceData   = deviceInterfaceData;
     _deviceInterfaceDetail = unsafeNativeMethodsWrapper.GetDeviceInterfaceDetail(deviceInformationSetHandle, deviceInterfaceData);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DeviceInformationSet"/> class.
 /// </summary>
 /// <param name="guid">
 /// The guid.
 /// </param>
 /// <param name="unsafeNativeMethodsWrapper">
 /// The unsafe native methods wrapper.
 /// </param>
 public DeviceInformationSet(Guid guid, IUnsafeNativeMethodsWrapper unsafeNativeMethodsWrapper)
 {
     _unsafeNativeMethodsWrapper = unsafeNativeMethodsWrapper;
     Handle = _unsafeNativeMethodsWrapper.GetDeviceInformationSet(guid, IntPtr.Zero, IntPtr.Zero, (uint)(DeviceInformationGetClassFlags.DeviceInterface | DeviceInformationGetClassFlags.Present));
     DeviceInformationElements = _unsafeNativeMethodsWrapper.GetDeviceInformationElements(Handle);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DeviceInformationSet"/> class.
 /// </summary>
 /// <param name="guid">
 /// The guid.
 /// </param>
 /// <param name="unsafeNativeMethodsWrapper">
 /// The unsafe native methods wrapper.
 /// </param>
 public DeviceInformationSet(Guid guid, IUnsafeNativeMethodsWrapper unsafeNativeMethodsWrapper)
 {
     _unsafeNativeMethodsWrapper = unsafeNativeMethodsWrapper;
     Handle = _unsafeNativeMethodsWrapper.GetDeviceInformationSet(guid, IntPtr.Zero, IntPtr.Zero, (uint)(DeviceInformationGetClassFlags.DeviceInterface | DeviceInformationGetClassFlags.Present));
     DeviceInformationElements = _unsafeNativeMethodsWrapper.GetDeviceInformationElements(Handle);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DeviceInterface"/> class.
 /// </summary>
 /// <param name="deviceInformationSetHandle">
 /// The device Information Set Handle.
 /// </param>
 /// <param name="deviceInterfaceData">
 /// The device interface data.
 /// </param>
 /// <param name="unsafeNativeMethodsWrapper">
 /// The unsafe Native Methods Wrapper.
 /// </param>
 public DeviceInterface(IntPtr deviceInformationSetHandle, DeviceInterfaceData deviceInterfaceData, IUnsafeNativeMethodsWrapper unsafeNativeMethodsWrapper)
 {
     _deviceInterfaceData = deviceInterfaceData;
     _deviceInterfaceDetail = unsafeNativeMethodsWrapper.GetDeviceInterfaceDetail(deviceInformationSetHandle, deviceInterfaceData);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UsbFileHandle"/> class.
 /// </summary>
 /// <param name="unsafeNativeMethodsWrapper">
 /// The unsafe native methods wrapper.
 /// </param>
 /// <param name="safeFileHandle">
 /// The safe file handle.
 /// </param>
 /// <param name="winUsbHandle">
 /// The win usb handle.
 /// </param>
 public UsbFileHandle(IUnsafeNativeMethodsWrapper unsafeNativeMethodsWrapper, SafeFileHandle safeFileHandle, IntPtr winUsbHandle)
 {
     _unsafeNativeMethodsWrapper = unsafeNativeMethodsWrapper;
     _safeFileHandle             = safeFileHandle;
     _winUsbHandle = winUsbHandle;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DeviceInformationElement"/> class.
 /// </summary>
 /// <param name="guid">
 /// The guid.
 /// </param>
 /// <param name="deviceInformationSetHandle">
 /// The device Information Set Handle.
 /// </param>
 /// <param name="deviceInfoData">
 /// The device info data.
 /// </param>
 /// <param name="unsafeNativeMethodsWrapper">
 /// The unsafe Native Methods Wrapper.
 /// </param>
 public DeviceInformationElement(Guid guid, IntPtr deviceInformationSetHandle, DeviceInfoData deviceInfoData, IUnsafeNativeMethodsWrapper unsafeNativeMethodsWrapper)
 {
     DeviceInterfaces = unsafeNativeMethodsWrapper.GetDeviceInterfaces(deviceInformationSetHandle, deviceInfoData, guid);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UsbFileHandle"/> class.
 /// </summary>
 /// <param name="unsafeNativeMethodsWrapper">
 /// The unsafe native methods wrapper.
 /// </param>
 /// <param name="safeFileHandle">
 /// The safe file handle.
 /// </param>
 /// <param name="winUsbHandle">
 /// The win usb handle.
 /// </param>
 public UsbFileHandle(IUnsafeNativeMethodsWrapper unsafeNativeMethodsWrapper, SafeFileHandle safeFileHandle, IntPtr winUsbHandle)
 {
     _unsafeNativeMethodsWrapper = unsafeNativeMethodsWrapper;
     _safeFileHandle = safeFileHandle;
     _winUsbHandle = winUsbHandle;
 }