views:

286

answers:

2

Some code:

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 params;

typedef struct _USB_INTERFACE_DESCRIPTOR {
UCHAR bLength ;
UCHAR bInterfaceClass ;
UCHAR bInterfaceSubClass ;
} USB_INTERFACE_DESCRIPTOR, *PUSB_INTERFACE_DESCRIPTOR ;

Able to acess NumInterfaceDescriptors via -> params.Types.Descriptor.NumInterfaceDescriptors

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

+2  A: 

It appears that what you want is:

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.

caf
InterfaceDescriptors is a double pointer pointing to structure
Sikandar
I can see that. The structure definition strongly implies that it is a pointer to an array of `NumInterfaceDescriptors` pointers to structures.
caf
A: 

Google for WDF_USB_DEVICE_SELECT_CONFIG_PARAMS. The first hit leads you to the relevant MSDN page, which tells you that Types.Descriptor.InterfaceDescriptors

contains a driver-supplied pointer to an array of USB_INTERFACE_DESCRIPTOR structures

and that Types.Descriptor.NumInterfaceDescriptors indeed

contains the number of elements that are in the interface array that Types.Descriptor.InterfaceDescriptors points to.

Ergo, your "pointer to pointer" is actually an array of USB_INTERFACE_DESCRIPTOR pointers.

DevSolar