驱动小牛
|
阅读:2216回复:4
USBD_INTERFACE_INFORMATION中的Pipes的问题
typedef struct _USBD_INTERFACE_INFORMATION {
USHORT Length; //0x00 // Length of this structure, including // all pipe information structures that // follow. // // INPUT // // Interface number and Alternate setting this // structure is associated with // UCHAR InterfaceNumber;//0x02 UCHAR AlternateSetting;//0x03 // // OUTPUT // These fields are filled in by USBD // UCHAR Class;//0x04 UCHAR SubClass;//0x05 UCHAR Protocol;//0x06 UCHAR Reserved;//0x07 USBD_INTERFACE_HANDLE InterfaceHandle;//0x08 ULONG NumberOfPipes; //0x0c // // INPUT/OUPUT // see PIPE_INFORMATION #ifdef OSR21_COMPAT USBD_PIPE_INFORMATION Pipes[0];//0x10 #else USBD_PIPE_INFORMATION Pipes[1];//0x10 #endif } USBD_INTERFACE_INFORMATION, *PUSBD_INTERFACE_INFORMATION; 而BulkUsb的代码里面写的一个函数SelectInterfaces有一段代码 for(i=0; i<Interface->NumberOfPipes; i++) { // // perform pipe initialization here // set the transfer size and any pipe flags we use // USBD sets the rest of the Interface struct members // Interface->Pipes[ i ].MaximumTransferSize = USBD_DEFAULT_MAXIMUM_TRANSFER_SIZE; } 总共定义Pipes的最大为Pipes[1],还这样循环不会有问题么,Interface->NumberOfPipes如果大于2不是出去了么? |
驱动小牛
|
沙发#
发布于:2008-05-13 18:05
请知道的大大们赐教!
|
驱动小牛
|
板凳#
发布于:2008-05-14 09:46
这样不是有隐患了?不就自动覆盖了后面的内存地址,是吗?
|