ULONG Length; //缓冲区的长度
// 存放接收的数据的缓冲区: 
UCHAR Data[1]; 
Data是怎么存放的?它只有一个字节, 需要自己分配空间吗?

解决方案 »

  1.   

    Data[1]是个形式变量,形式变量,我再说一遍,具体作用请看下面的用法
    typedef struct PACKET
    {
       int type;
       int len;
       BYTE buf[1];
    }PACKET;#define PACKET_LEN (sizeof(PACKET) - 1)void recv_xxx(char *buf, int len)
    {
       PACKET *packet = (PACKET *)buf;
       ...
    }void send_xxx(int type, char *buf, int len)
    {
       PACKET *packet = (PACKET *)new char[len + PACKET_LEN];
       packet->type = type;
       packet->len  = len;
       memcpy((char *)packet, buf, len);
       ...
       发送整个packet
    }
      

  2.   

    3x,给分!
    另外:我想问一个问题:
    怎么根据Packet.inf用程序的方式添加驱动程序,而不是用控制面板添加!