@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: Used with DeviceIoControl and [IOCTL_USB_GET_NODE_CONNECTION_NAME] to get the Device Path of a downstream Hub !!!!C# Definition: [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] struct USB_NODE_CONNECTION_NAME { public int ConnectionIndex; public int ActualLength; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = BUFFER_SIZE)] public string NodeName; } !!!!VB Definition: Structure USB_NODE_CONNECTION_NAME Public TODO End Structure !!!!User-Defined Field Types: None. !!!!Notes: typedef struct _USB_NODE_CONNECTION_NAME { ULONG ConnectionIndex; ULONG ActualLength; WCHAR NodeName[1]; } USB_NODE_CONNECTION_NAME, *PUSB_NODE_CONNECTION_NAME; Documentation: USB_NODE_CONNECTION_NAME@msdn on MSDN !!!!Example: // Open a handle to the Host Controller IntPtr h = CreateFile(PortHubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero); if (h.ToInt32() != INVALID_HANDLE_VALUE) { // Get the DevicePath for downstream hub int nBytesReturned; USB_NODE_CONNECTION_NAME NodeName = new USB_NODE_CONNECTION_NAME(); NodeName.ConnectionIndex = PortPortNumber; int nBytes = Marshal.SizeOf(NodeName); IntPtr ptrNodeName = Marshal.AllocHGlobal(nBytes); Marshal.StructureToPtr(NodeName, ptrNodeName, true); // Use an IOCTL call to request the Node Name if (DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_NAME, ptrNodeName, nBytes, ptrNodeName, nBytes, out nBytesReturned, IntPtr.Zero)) { NodeName = (USB_NODE_CONNECTION_NAME)Marshal.PtrToStructure(ptrNodeName, typeof(USB_NODE_CONNECTION_NAME)); string HubDevicePath = @"\\.\" + NodeName.NodeName; } Marshal.FreeHGlobal(ptrNodeName); (h); }
Edit Structures.USB_NO...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.