访问结构变量双指针 [英] Accessing a structure variable double pointer
问题描述
一些代码:
typedef struct _WDF_USB_DEVICE_SELECT_CONFIG_PARAMS {
ULONG Size;
WdfUsbTargetDeviceSelectConfigType Type;
union {
struct {
PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor;
PUSB_INTERFACE_DESCRIPTOR* InterfaceDescriptors;
ULONG NumInterfaceDescriptors;
} Descriptor;
struct {
PURB Urb;
} Urb;
} Types;
} WDF_USB_DEVICE_SELECT_CONFIG_PARAMS,*PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS;WDF_USB_DEVICE_SELECT_CONFIG_PARAMS 参数;
} WDF_USB_DEVICE_SELECT_CONFIG_PARAMS,*PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS; WDF_USB_DEVICE_SELECT_CONFIG_PARAMS params;
typedef struct _USB_INTERFACE_DESCRIPTOR {
UCHAR bLength ;
UCHAR bInterfaceClass ;
UCHAR bInterfaceSubClass ;
} USB_INTERFACE_DESCRIPTOR, *PUSB_INTERFACE_DESCRIPTOR ;
能够通过 -> params.Types.Descriptor.NumInterfaceDescriptors 访问 NumInterfaceDescriptors
Able to acess NumInterfaceDescriptors via -> params.Types.Descriptor.NumInterfaceDescriptors
我想通过 WDF_USB_DEVICE_SELECT_CONFIG_PARAMS 访问 bInterfaceClass.请注意,此结构由库填充,我必须访问它
I want to acess bInterfaceClass via WDF_USB_DEVICE_SELECT_CONFIG_PARAMS . Please note that this structure is filled by the library I have to just access it
推荐答案
看起来你想要的是:
ULONG iface;
for (iface = 0; iface < params.Types.Descriptor.NumInterfaceDescriptors; iface++)
{
do_something_with(params.Types.Descriptor.InterfaceDescriptors[iface]);
}
..但是你真的应该多花点时间把你的问题说清楚,这样人们就不必猜测你的意思了.
..but you should really put some more time into making your questions clear so that people don't have to guess what you mean.
这篇关于访问结构变量双指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!