|
From: Dan M. <dan...@gm...> - 2007-04-02 22:12:52
|
Hi there,
When trying to compile the example program [testlibusb_win.c], I get an
error when I try to access the variables of the struct usb_config_descriptor,
which is been pointed by the variable struct usb_device *dev. The function,
for (i = 0; i < dev->descriptor.bNumConfigurations; i++)
print_configuration(&dev->config[i]);
passes a valid memory address, but all of its values are NULL. So when I try
to run this function,
static void print_configuration(struct usb_config_descriptor *config)
{
int i;
edit_printf(" wTotalLength: %d\r\n", config->wTotalLength);
edit_printf(" bNumInterfaces: %d\r\n", config->bNumInterfaces);
edit_printf(" bConfigurationValue: %d\r\n",
config->bConfigurationValue);
edit_printf(" iConfiguration: %d\r\n", config->iConfiguration);
edit_printf(" bmAttributes: %02xh\r\n", config->bmAttributes);
edit_printf(" MaxPower: %d\r\n", config->MaxPower);
for (i = 0; i < config->bNumInterfaces; i++)
print_interface(&config->interface[i]);
}
it stops on this line,
edit_printf(" wTotalLength: %d\r\n", config->wTotalLength);
giving the following error message:
Project raised exception EAccessViolation with message 'Access violation at
address 00401A82. Read of address 00000035'. Process stopped.
the address 00000035 is owned by the variable the program tried to access,
config->wTotalLength.
If I don't use this struct, the program runs fine, but I don't get all the
info the pre-compiled program gets, only Bus, Device, Vendor ID, Product ID,
Manufacturer and Product.
Do you have an idea of why this is happening? Could be the compiler's fault?
I'm using Borland C++ Builder 6's compiler. Any comments will be very
welcomed. Thanks in advance,
Dan Leite Martins
|