zhoujiamurong
驱动小牛
驱动小牛
  • 注册日期2006-03-20
  • 最后登录2009-05-06
  • 粉丝4
  • 关注0
  • 积分1081分
  • 威望360点
  • 贡献值0点
  • 好评度215点
  • 原创分0分
  • 专家分0分
阅读:2216回复:4

USBD_INTERFACE_INFORMATION中的Pipes的问题

楼主#
更多 发布于:2008-05-13 17:44
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不是出去了么?
zhoujiamurong
驱动小牛
驱动小牛
  • 注册日期2006-03-20
  • 最后登录2009-05-06
  • 粉丝4
  • 关注0
  • 积分1081分
  • 威望360点
  • 贡献值0点
  • 好评度215点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2008-05-13 18:05
请知道的大大们赐教!
zhoujiamurong
驱动小牛
驱动小牛
  • 注册日期2006-03-20
  • 最后登录2009-05-06
  • 粉丝4
  • 关注0
  • 积分1081分
  • 威望360点
  • 贡献值0点
  • 好评度215点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2008-05-14 09:46
这样不是有隐患了?不就自动覆盖了后面的内存地址,是吗?
游客

返回顶部