USB_NODE_INFORMATION

C# Definition:

// We need a separate struct to hold the union due to the fact that on 64-bit USB_HUB_NODE gets marshaled
// as 8 bytes while on 32-bit it gets marshaled as 4 bytes. We cannot explicitly lay out the members of this
// struct since FieldOffset requires a constant but here FieldOffset might be 4 or 8 depending on the platform.
[StructLayout(LayoutKind.Sequential)]
struct USB_NODE_INFORMATION
{
   public USB_HUB_NODE NodeType;    /* hub, mi parent */
   public UsbNodeUnion u;
}

// Simpler version if you do not care about USB_MI_PARENT_INFORMATION
[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:

User-Defined Field Types:

Notes:

Example:

Última actualización