Esempio n. 1
0
 static extern bool SetupDiGetDeviceInterfaceDetail(
    IntPtr DeviceInfoSet,
    ref SP_DEVICE_INTERFACE_DATA DeviceInterfaceData,
    ref SP_DEVICE_INTERFACE_DETAIL_DATA DeviceInterfaceDetailData,
    UInt32 DeviceInterfaceDetailDataSize,
    ref UInt32 RequiredSize,
    IntPtr DeviceInfoData
 );
Esempio n. 2
0
 static extern bool SetupDiGetDeviceInterfaceDetail(
     IntPtr DeviceInfoSet,
     ref SP_DEVICE_INTERFACE_DATA DeviceInterfaceData,
     ref SP_DEVICE_INTERFACE_DETAIL_DATA DeviceInterfaceDetailData,
     UInt32 DeviceInterfaceDetailDataSize,
     ref UInt32 RequiredSize,
     IntPtr DeviceInfoData
     );
Esempio n. 3
0
      public bool SetupDiGetDeviceInterfaceDetail()
      {
         uint uDeviceInterfaceDetailDataSize = 0, uRequiredSize = 0;
         _deviceInterfaceDetailData = new SP_DEVICE_INTERFACE_DETAIL_DATA();
          
          if (IntPtr.Size == 8)
            _deviceInterfaceDetailData.cbSize = 8;
          else
            _deviceInterfaceDetailData.cbSize = 5; ;  // …
         
         bool rv = SetupDiGetDeviceInterfaceDetail(
            _hDevInfo,
            ref _deviceInterfaceData,
            IntPtr.Zero,
            (uint)uDeviceInterfaceDetailDataSize,
            ref uRequiredSize,
            IntPtr.Zero);

         uDeviceInterfaceDetailDataSize = uRequiredSize;
         int err = Marshal.GetLastWin32Error();
         bool bResult = SetupDiGetDeviceInterfaceDetail(
            _hDevInfo,
            ref _deviceInterfaceData,
            ref _deviceInterfaceDetailData,
            uDeviceInterfaceDetailDataSize,
            ref uRequiredSize,
            IntPtr.Zero);

         _strDevicePathName = _deviceInterfaceDetailData.DevicePath;
         return bResult;
      }
Esempio n. 4
0
        public bool SetupDiGetDeviceInterfaceDetail()
        {
            UInt32 uDeviceInterfaceDetailDataSize = 0, uRequiredSize = 0;
             _deviceInterfaceDetailData = new SP_DEVICE_INTERFACE_DETAIL_DATA();
             _deviceInterfaceDetailData.cbSize = 5;  // …

             SetupDiGetDeviceInterfaceDetail(
            _hDevInfo,
            ref _deviceInterfaceData,
            IntPtr.Zero,
            uDeviceInterfaceDetailDataSize,
            ref uRequiredSize,
            IntPtr.Zero);

             uDeviceInterfaceDetailDataSize = uRequiredSize;

             bool bResult = SetupDiGetDeviceInterfaceDetail(
            _hDevInfo,
            ref _deviceInterfaceData,
            ref _deviceInterfaceDetailData,
            uDeviceInterfaceDetailDataSize,
            ref uRequiredSize,
            IntPtr.Zero);

             _strDevicePathName = _deviceInterfaceDetailData.DevicePath;
             return bResult;
        }