Mercurial > hg > ucis.core
diff USBLib/Windows/USB/UsbHub.cs @ 87:9b898d8b2541
Small improvements in Windows USB device handling
author | Ivo Smits <Ivo@UCIS.nl> |
---|---|
date | Thu, 05 Jun 2014 00:46:15 +0200 |
parents | e811297f5aa4 |
children |
line wrap: on
line diff
--- a/USBLib/Windows/USB/UsbHub.cs Thu Jun 05 00:24:24 2014 +0200 +++ b/USBLib/Windows/USB/UsbHub.cs Thu Jun 05 00:46:15 2014 +0200 @@ -22,9 +22,8 @@ if (HasNodeInformation) return; NodeInformation = new USB_NODE_INFORMATION(); int nBytes = Marshal.SizeOf(typeof(USB_NODE_INFORMATION)); - using (SafeFileHandle handle = OpenHandle()) - if (!Kernel32.DeviceIoControl(handle, UsbApi.IOCTL_USB_GET_NODE_INFORMATION, ref NodeInformation, nBytes, out NodeInformation, nBytes, out nBytes, IntPtr.Zero)) - throw new Win32Exception(Marshal.GetLastWin32Error()); + using (SafeFileHandle handle = OpenHandle()) + HasNodeInformation = Kernel32.DeviceIoControl(handle, UsbApi.IOCTL_USB_GET_NODE_INFORMATION, ref NodeInformation, nBytes, out NodeInformation, nBytes, out nBytes, IntPtr.Zero); } public bool IsRootHub { get; private set; }