資源簡介
采用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\UsbEnumxm
?????文件???????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個文件信息
- 上一篇:ASP.NET通訊錄小程序
- 下一篇:調用cyUSB.dllC#源碼
評論
共有 條評論