您的位置:程序门 -> windows专区 ->



windows ce5.0 wep key


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


windows ce5.0 wep key[已结贴,结贴人:kinlin]
发表于:2007-01-17 13:56:42 楼主
#define   ndisuio_device_name                     text( "uio1: ")
#define   file_any_access                                   0
#define   method_buffered                             0
#define   file_device_network                     0x00000012

#define   fsctl_ndisuio_base             file_device_network

typedef   struct   _ndisuio_query_binding{
          ulong       bindingindex;                   //   0-based   binding   number
          ulong       devicenameoffset;   //   from   start   of   this   struct
          ulong       devicenamelength;   //   in   bytes
          ulong       devicedescroffset;   //   from   start   of   this   struct
          ulong       devicedescrlength;   //   in   bytes

}   ndisuio_query_binding,   *pndisuio_query_binding;

typedef   ulong   ndis_oid,   *pndis_oid;

typedef   struct   _ndisuio_query_oid{
        ndis_oid                 oid;
          ptchar       ptcdevicename;  
        uchar                       data[sizeof(ulong)];
}   ndisuio_query_oid,   *pndisuio_query_oid;

#define   ctl_code(   devicetype,   function,   method,   access   )   (                                   \
        ((devicetype)   < <   16)   ¦   ((access)   < <   14)   ¦   ((function)   < <   2)   ¦   (method)   \
)
#define   _ndisuio_ctl_code(_function,   _method,   _access)     \
                        ctl_code(fsctl_ndisuio_base,   _function,   _method,   _access)

#define   ioctl_ndisuio_query_binding     \
                        _ndisuio_ctl_code(0x203,   method_buffered,   file_any_access)

#define   ioctl_ndisuio_open_device     \
                        _ndisuio_ctl_code(0x200,   method_buffered,   file_any_access)

#define   ioctl_ndisuio_query_oid_value       \
                        _ndisuio_ctl_code(0x201,   method_buffered,   file_any_access)


void   ctest_newmadlg::onbutton1()   {

      char   chdata[1024];  

      //   デバイスファイルをオープンする
      handle   hadapter   =   createfile   (       ndisuio_device_name,  
                                                                                                generic_read   ¦   generic_write,  
                                                                                                file_share_read   ¦   file_share_write,  
                                                                                                null,  
                                                                                                open_existing,  
                                                                                                file_attribute_normal   ¦   file_flag_overlapped,  
                                                                                                null);

      if   (invalid_handle_value   ==   hadapter)   {  
            return;  
      }  

      //---------------------------------------------------------------------
      //   retrieve   the   name   and   description   of   the   adapter.
      //---------------------------------------------------------------------
      pndisuio_query_binding   pbindinfo   =   (pndisuio_query_binding)   chdata;  
      pbindinfo-> bindingindex   =   0;  
      int   length   =   sizeof   (ndisuio_query_binding);  
      dword   bytesconsumed   =0;
      bool   bvalue   =   deviceiocontrol   (hadapter,  
                                                                                          ioctl_ndisuio_query_binding,  
                                                                                          pbindinfo,  
                                                                                          length,  
                                                                                          null,  
                                                                                          1024,  
                                                                                          &bytesconsumed,  
                                                                                          null);  
      if   (!bvalue)   {  
            return;  
      }  

      dword   dwreturnedbytes;  
      ptchar   ptcdevicename   =  
                        (ptchar)((puchar)pbindinfo   +   pbindinfo-> devicenameoffset);  

      //---------------------------------------------------------------------
      //   open   device
      //---------------------------------------------------------------------  
      dword   deerrcode   =   0;  
      bvalue   =   deviceiocontrol(   hadapter,  
                                                                          ioctl_ndisuio_open_device,  
                                                                          ptcdevicename,  
                                                                          wcslen(ptcdevicename)   *   sizeof(tchar),  
                                                                          null,  
                                                                          0,  
                                                                          &dwreturnedbytes,  
                                                                          null);  

      if   (0   ==   bvalue)   {  
            deerrcode   =   getlasterror();
            return;  
      }  

      //---------------------------------------------------------------------
      //   wep情報を取得する
      //---------------------------------------------------------------------  
      pndisuio_query_oid   queryoid;  
      tchar   devicename[50];  
      puchar   querybuffer;  
      pulong   puldata;  

      querybuffer   =   (puchar)   malloc   (1024);  
      queryoid   =   (pndisuio_query_oid)   querybuffer;  

      queryoid-> oid   =   0xff010102;                 //   custom   oid;  
      queryoid-> ptcdevicename   =   null;   //   you   dont   need   this   once   you   have   done   a   open   device.  


      bvalue   =   deviceiocontrol   (hadapter,  
                                                                          ioctl_ndisuio_query_oid_value,  
                                                                          (lpvoid)   queryoid,  
                                                                          sizeof(ndisuio_query_oid)   +   sizeof   (dword),  
                                                                          (lpvoid)   queryoid,  
                                                                          sizeof(ndisuio_query_oid)   +   sizeof   (dword),  
                                                                          &bytesconsumed,  
                                                                          null);  
 
}

上边的代码,在打开设备时,出错误,deerrcode是31.
该怎样解决这个问题啊
发表于:2007-01-17 13:58:281楼 得分:10
发表于:2007-01-23 19:19:082楼 得分:8
mark   多多学习
发表于:2007-01-30 19:56:533楼 得分:8
发错地方   了
发表于:2007-04-27 16:09:514楼 得分:8
发表于:2007-04-29 16:03:475楼 得分:8
up
发表于:2007-05-02 15:54:186楼 得分:8
接分,谢谢


快速检索

最新资讯
热门点击