1

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;
struct {
  UCHAR  NumberConfiguredPipes;
  WDFUSBINTERFACE  ConfiguredUsbInterface;
} SingleInterface;
struct {
  UCHAR  NumberInterfaces;
  PWDF_USB_INTERFACE_SETTING_PAIR  Pairs;
  UCHAR  NumberOfConfiguredInterfaces;
} MultiInterface;

} 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

3
  • Why do you want the type IntDesc to be a double pointer? typedef PUSB_INTERFACE_DESCRIPTOR* IntDesc; Wouldn't it be easier just to use a single pointer? What's the benefit of another layer of indirection here? Commented Jan 18, 2010 at 7:07
  • 2
    Hey, dude... you've changed the question significantly two times now, each time breaking previously valid answers, and each time breaking the layout others had fixed for you previously. I have very little patience with people who are that careless with other people's time. -1 from me, and I won't bother to edit / answer your question again. Commented Jan 18, 2010 at 13:49
  • Oh, and by the way, this is now a duplicate to stackoverflow.com/questions/2085761/… Commented Jan 18, 2010 at 13:54

6 Answers 6

6
(*someIntDesc)->iInterface
Sign up to request clarification or add additional context in comments.

Comments

2
IntDesc foo;
// somehow initialize foo to actually point to (a pointer to) a valid structure
(*foo)->iInterface = 10;

1 Comment

You're right, of course. I shouldn't take linguistic shortcuts.
1

Deference it like this

(*intDesc)->iInterface

Comments

1

IntDesc is a type, not a variable. So the first thing you need to do is create a variable of the correct type:

IntDesc id;

Next, you'll need to have it point to allocated memory. I'm going to put everything on the stack, you may have other needs:

USB_INTERFACE_DESCRIPTOR usb;
PUSB_INTERFACE_DESCRIPTOR pusb = &usb;
id = &pusb;

Now that you have a valid pointer, you can go ahead an dereference it. Since this is a double pointer, you will need to dereference it twice:

(*(*id)).iInterface = 10;

Because C defines -> as a combination of * and ., you can express that more succinctly with:

(*id)->iInterface = 10; 

Comments

1

From the name InterfaceDescriptors, it would appear to point to an array of pointers to the structure. So the more idiomatic way would be:

InterfaceDescriptors[0]->iInterface = 10;

Comments

0

Your code is quite wrong

NODE* ptr;
k.N.iInterface = 100;
ptr = (NODE*)malloc(sizeof(NODE));

And before accesing:

ptr->N1->iInterface

N1 should be initialized to something.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.