Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

USB_NODE_INFORMATION (Structures)
 
.
Summary
Used with DeviceIoControl and IOCTL_USB_GET_NODE_INFORMATION to get connection-related information about a port on a USB Hub

C# Definition:

[StructLayout(LayoutKind.Sequential)]
struct USB_NODE_INFORMATION
{
   public int NodeType;
   public USB_HUB_INFORMATION HubInformation;      // Yeah, I'm assuming we'll just use the first form
}

VB Definition:

Structure USB_NODE_INFORMATION
   Public TODO
End Structure

User-Defined Field Types:

None.

Notes:

Although this is a nested structure (and a Union too), you might find it easier to use if you just pick one of the forms

typedef struct _USB_NODE_INFORMATION {
   USB_HUB_NODE  NodeType;
   union {
     USB_HUB_INFORMATION  HubInformation;
     USB_MI_PARENT_INFORMATION  MiParentInformation;
   } u;
} USB_NODE_INFORMATION, *PUSB_NODE_INFORMATION;

Documentation

Example:

IntPtr h = CreateFile(Root.HubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero);
if (h.ToInt32() != INVALID_HANDLE_VALUE)
{
   USB_NODE_INFORMATION NodeInfo = new USB_NODE_INFORMATION();
   NodeInfo.NodeType = (int)USB_HUB_NODE.UsbHub;
   int nBytes = Marshal.SizeOf(NodeInfo);
   IntPtr ptrNodeInfo = Marshal.AllocHGlobal(nBytes);
   Marshal.StructureToPtr(NodeInfo, ptrNodeInfo, true);

   // get the Hub Information
   if (DeviceIoControl(h2, IOCTL_USB_GET_NODE_INFORMATION, ptrNodeInfo, nBytes, ptrNodeInfo, nBytes, out nBytesReturned, IntPtr.Zero))
   {
     NodeInfo = (USB_NODE_INFORMATION)Marshal.PtrToStructure(ptrNodeInfo, typeof(USB_NODE_INFORMATION));
       // Do something here
   }
   Marshal.FreeHGlobal(ptrNodeInfo);
   CloseHandle(h);
}

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • alternate definitions?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.

 
Access PInvoke.net directly from VS:
Terms of Use
Find References
Show Printable Version
Revisions