• 大小: 416KB
    文件类型: .zip
    金币: 2
    下载: 3 次
    发布日期: 2021-06-25
  • 语言: C#
  • 标签: WPF  

资源简介

采用WPF开发的USB设备浏览器,可以查看系统所有USB HUB和USB设备的详细信息。

资源截图

代码片段和文件信息

/* ----------------------------------------------------------
文件名称:DeviceIoControl.cs

作者:秦建辉

MSN:splashcn@msn.com
QQ:36748897

博客:http://blog.csdn.net/jhqin

开发环境:
    Visual Studio V2010
    .NET framework 4 Client Profile

版本历史:
    V1.0 2011年10月10日
实现对DeviceIoControl接口的PInvoke

参考资料:
    http://www.pinvoke.net/
------------------------------------------------------------ */
using System;
using System.Runtime.InteropServices;

namespace Splash.IO.PORTS
{
    #region ENUM
    public enum USB_HUB_NODE : uint
    {
        UsbHub
        UsbMIParent
    }

    public enum USB_CONNECTION_STATUS
    {
        NoDeviceConnected
        DeviceConnected
        DeviceFailedEnumeration
        DeviceGeneralFailure
        DeviceCausedOvercurrent
        DeviceNotEnoughPower
        DeviceNotEnoughBandwidth
        DeviceHubNestedTooDeeply
        DeviceInLegacyHub
    }

    public enum USB_DEVICE_SPEED : byte
    {
        UsbLowSpeed    // 低速USB 1.1
        UsbFullSpeed   // 全速USB 1.1
        UsbHighSpeed   // 高速USB 2.0
        UsbSuperSpeed   // 极速USB 3.0
    }
    #endregion

    public partial class USB
    {
        internal const Int32 IOCTL_GET_HCD_DRIVERKEY_NAME = 0x220424;
        internal const Int32 IOCTL_USB_GET_ROOT_HUB_NAME = 0x220408;
        internal const Int32 IOCTL_USB_GET_NODE_CONNECTION_NAME = 0x220414;
        internal const Int32 IOCTL_USB_GET_NODE_INFORMATION = 0x220408;
        internal const Int32 IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX = 0x220448;
        internal const Int32 IOCTL_USB_GET_DEscriptOR_FROM_NODE_CONNECTION = 0x220410;

        internal const Int32 MAXIMUM_USB_STRING_LENGTH = 255;
        internal const Int32 USB_STRING_DEscriptOR_TYPE = 3;

        [StructLayout(LayoutKind.Sequential CharSet = CharSet.Auto)]
        internal struct USB_HCD_DRIVERKEY_NAME
        {
            public Int32 ActualLength;
            [MarshalAs(UnmanagedType.ByValTStr SizeConst = 256)]
            public String Name;
        }

        #region USB_NODE_INFORMATION
        [StructLayout(LayoutKind.Sequential Pack = 1)]
        internal struct USB_HUB_DEscriptOR
        {
            public Byte bDescriptorLength;
            public Byte bDescriptorType;    // 描述符类型:0x29
            public Byte bNumberOfPorts;     // 支持的下游端口数目
            public Int16 wHubCharacteristics;   // 特征描述
            public Byte bPowerOnToPowerGood;    // 从端口加电到端口正常工作的时间间隔(以2ms为单位)
            public Byte bHubControlCurrent;     // 设备所需最大电流
            [MarshalAs(UnmanagedType.ByValArray SizeConst = 64)]
            public Byte[] bRemoveAndPowerMask;  // 指示连接在集线器端口的设备是否可移走
        }

        [StructLayout(LayoutKind.Sequential)]
        internal struct USB_HUB_INFORMATION
        {
            public USB_HUB_DEscriptOR HubDescriptor;
            public Byte HubIsBusPowered;
        }

        [StructLayout(LayoutKind.Sequential)]
     

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件       32768  2011-11-09 09:20  WPFUsbView\EZUSB.dll
     文件      144896  2011-11-09 09:20  WPFUsbView\USBWatcher.exe
     文件       90112  2011-11-09 09:20  WPFUsbView\WPFUsbView.exe
     文件        3505  2011-11-08 18:05  EZUSB\EZUSB.sln
     文件      135168  2011-11-09 09:20  EZUSB\EZUSB.suo
     目录           0  2011-11-09 11:39  EZUSB\EZUSB\
     文件        9654  2011-10-28 16:04  EZUSB\EZUSB\DeviceIoControl.cs
     文件        1620  2011-10-28 16:04  EZUSB\EZUSB\Environment.cs
     文件        2790  2011-10-27 14:04  EZUSB\EZUSB\EZUSB.csproj
     文件        7552  2011-10-28 16:04  EZUSB\EZUSB\Kernel32.cs
     目录           0  2011-11-09 11:38  EZUSB\EZUSB\Properties\
     文件        1430  2011-08-30 16:03  EZUSB\EZUSB\Properties\AssemblyInfo.cs
     文件        8298  2011-09-23 15:32  EZUSB\EZUSB\SetupApi.cs
     文件       11070  2011-11-04 14:48  EZUSB\EZUSB\UsbEnumxml.cs
     文件       26703  2011-11-07 20:29  EZUSB\EZUSB\WDKUsbEnum.cs
     文件        7299  2011-09-23 09:45  EZUSB\EZUSB\WDKUsbQuery.cs
     文件        5781  2011-09-23 09:45  EZUSB\EZUSB\WDKVidPidQuery.cs
     文件       23474  2011-09-26 10:18  EZUSB\EZUSB\WMIUsbQuery.cs
     文件        4705  2011-09-23 09:45  EZUSB\EZUSB\WMIUsbWatcher.cs
     目录           0  2011-11-09 11:39  EZUSB\USBWatcher\
     文件        1853  2011-10-28 16:37  EZUSB\USBWatcher\Form1.cs
     文件        2465  2011-08-31 09:23  EZUSB\USBWatcher\Form1.Designer.cs
     文件      106819  2011-08-19 15:42  EZUSB\USBWatcher\Form1.resx
     文件         435  2011-10-28 16:32  EZUSB\USBWatcher\Program.cs
     目录           0  2011-11-09 11:38  EZUSB\USBWatcher\Properties\
     文件        1440  2011-08-31 09:23  EZUSB\USBWatcher\Properties\AssemblyInfo.cs
     文件        2870  2011-08-31 09:15  EZUSB\USBWatcher\Properties\Resources.Designer.cs
     文件        5612  2011-08-31 09:15  EZUSB\USBWatcher\Properties\Resources.resx
     文件        1095  2011-08-31 09:15  EZUSB\USBWatcher\Properties\Settings.Designer.cs
     文件         249  2011-08-31 09:15  EZUSB\USBWatcher\Properties\Settings.settings
     文件        4189  2011-10-28 16:32  EZUSB\USBWatcher\USBWatcher.csproj
............此处省略37个文件信息

评论

共有 条评论