@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: Used with DeviceIoControl and [IOCTL_USB_GET_ROOT_HUB_NAME] to return the "Symbolic Name" of a downstream USB Hub !!!!C# Definition: [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] struct USB_ROOT_HUB_NAME { public int ActualLength; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = BUFFER_SIZE)] public string RootHubName; } !!!!VB Definition: Structure USB_ROOT_HUB_NAME Public TODO End Structure !!!!User-Defined Field Types: None. !!!!Notes: typedef struct _USB_ROOT_HUB_NAME { ULONG ActualLength; WCHAR RootHubName[1]; } USB_ROOT_HUB_NAME, *PUSB_ROOT_HUB_NAME; Documentation: USB_ROOT_HUB_NAME@msdn on MSDN !!!!Example: // Open a handle to the Host Controller IntPtr h = CreateFile(ControllerDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero); if (h.ToInt32() != INVALID_HANDLE_VALUE) { int nBytesReturned; USB_ROOT_HUB_NAME HubName = new USB_ROOT_HUB_NAME(); int nBytes = Marshal.SizeOf(HubName); IntPtr ptrHubName = Marshal.AllocHGlobal(nBytes); // get the Hub Name if (DeviceIoControl(h, IOCTL_USB_GET_ROOT_HUB_NAME, ptrHubName, nBytes, ptrHubName, nBytes, out nBytesReturned, IntPtr.Zero)) { HubName = (USB_ROOT_HUB_NAME)Marshal.PtrToStructure(ptrHubName, typeof(USB_ROOT_HUB_NAME)); string HubDevicePath = @"\\.\" + HubName.RootHubName; } Marshal.FreeHGlobal(ptrHubName); CloseHandle(h); }
Edit Structures.USB_RO...
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.