I am trying to port the UsbIoCtl.h to a PB *.inc file and have run into 2 scenario's that I can not seem to find an answer for.
The first is if a UDT can be filled with a value at declaration? For example, I have translated
To the below in PB
But can I declare HubIs2xCapable with a default value of 1? or do I have to do that from one of my functions?
The other question I have and can not find in documentation is when the variable is not declared as some sort of type. In this case from the C code
I currently have ported to PB as
and looking up what each variable means from MSDN
I could guess that variables such as NoDeviceConnected and DeviceConnected are longs or Dwords (for 0 or 1), but I would rather get the declaration correct than "guesstimate" what it would be.
Any help would be appreciated
The first is if a UDT can be filled with a value at declaration? For example, I have translated
Code:
typedef struct _USB_HUB_CAPABILITIES { /* Unlike the USB_HUB_INFORMATION structure used by IOCTL_USB_GET_NODE_INFORMATION, this structure can be extended in the future to accomodate more data. The IOCTL will return only as much data as indicated by the size of the request buffer, to maintain backward compatibility with older callers that don't know about the new data. */ ULONG HubIs2xCapable:1; } USB_HUB_CAPABILITIES, *PUSB_HUB_CAPABILITIES;
Code:
TYPE USB_HUB_CAPABILITIES '*** Unlike the USB_HUB_INFORMATION structure used by IOCTL_USB_GET_NODE_INFORMATION, this structure can be extended in the '*** future to accomodate more data. The IOCTL will return only AS much data as indicated by the size of the request buffer, '*** to maintain backward compatibility with older callers that don't know about the new data. ' ULONG HubIs2xCapable:1 '<--- Original Declaration HubIs2xCapable AS DWORD '<--- Was ULONG END TYPE
The other question I have and can not find in documentation is when the variable is not declared as some sort of type. In this case from the C code
Code:
typedef enum _USB_CONNECTION_STATUS { NoDeviceConnected, DeviceConnected, /* failure codes, these map to fail reasons */ DeviceFailedEnumeration, DeviceGeneralFailure, DeviceCausedOvercurrent, DeviceNotEnoughPower, DeviceNotEnoughBandwidth, DeviceHubNestedTooDeeply, DeviceInLegacyHub } USB_CONNECTION_STATUS, *PUSB_CONNECTION_STATUS;
Code:
TYPE USB_CONNECTION_STATUS NoDeviceConnected DeviceConnected '*** Failure codes, these map to fail reasons DeviceFailedEnumeration DeviceGeneralFailure DeviceCausedOvercurrent DeviceNotEnoughPower DeviceNotEnoughBandwidth DeviceHubNestedTooDeeply DeviceInLegacyHub END TYPE
NoDeviceConnected
Indicates that there is no device connected to the port.
DeviceConnected
Indicates that a device was successfully connected to the port.
DeviceFailedEnumeration
Indicates that an attempt was made to connect a device to the port, but the enumeration of the device failed.
DeviceGeneralFailure
Indicates that an attempt was made to connect a device to the port, but the connection failed for unspecified reasons.
DeviceCausedOvercurrent
Indicates that an attempt was made to connect a device to the port, but the attempt failed because of an overcurrent condition.
DeviceNotEnoughPower
Indicates that an attempt was made to connect a device to the port, but there was not enough power to drive the device, and the connection failed.
DeviceNotEnoughBandwidth
Indicates that an attempt was made to connect a device to the port, but there was not enough bandwidth available for the device to function properly, and the connection failed.
DeviceHubNestedTooDeeply
Indicates that an attempt was made to connect a device to the port, but the nesting of USB hubs was too deep, so the connection failed.
DeviceInLegacyHub
Indicates that an attempt was made to connect a device to the port of an unsupported legacy hub, and the connection failed.
Indicates that there is no device connected to the port.
DeviceConnected
Indicates that a device was successfully connected to the port.
DeviceFailedEnumeration
Indicates that an attempt was made to connect a device to the port, but the enumeration of the device failed.
DeviceGeneralFailure
Indicates that an attempt was made to connect a device to the port, but the connection failed for unspecified reasons.
DeviceCausedOvercurrent
Indicates that an attempt was made to connect a device to the port, but the attempt failed because of an overcurrent condition.
DeviceNotEnoughPower
Indicates that an attempt was made to connect a device to the port, but there was not enough power to drive the device, and the connection failed.
DeviceNotEnoughBandwidth
Indicates that an attempt was made to connect a device to the port, but there was not enough bandwidth available for the device to function properly, and the connection failed.
DeviceHubNestedTooDeeply
Indicates that an attempt was made to connect a device to the port, but the nesting of USB hubs was too deep, so the connection failed.
DeviceInLegacyHub
Indicates that an attempt was made to connect a device to the port of an unsupported legacy hub, and the connection failed.
Any help would be appreciated
Comment