阅读:1272回复:1
用NDIS实现过wifi设备的连接的兄弟请进
SetNetworkMode(pAdapter , &nNetworkMode); \\设置为Ndis802_11Infrastructure
SetAuthMode(pAdapter , &nAuthMode); \\设置为Ndis802_11AuthModeOpen SetWepMode(pAdapter , &nWepMode); \\设置为Ndis802_11WEPDisabled \\前三个设置都通过,到了设置SSID的时候,过程如下,参考了网上很多例程,很多都是这么写,可在这就是不成功,GetError得到Error87 应该是参数设置的问题,请高手帮忙看看这个参数哪里设置错误 SetSSID(pAdapter ,szSSID) HRESULT WLan::SetSSID(LPWSTR pAdapter , char * szSSID) { UCHAR SetBuffer[sizeof(NDISUIO_SET_OID) + sizeof(NDIS_802_11_SSID)]; PNDISUIO_SET_OID pSetOid; HRESULT hRes = E_HANDLE; DWORD dwBytesReturned; NDIS_802_11_SSID ssid; if (szSSID == NULL) { hRes = E_POINTER; } else { pSetOid = (PNDISUIO_SET_OID) &SetBuffer[0]; pSetOid->ptcDeviceName = pAdapter;//m_DeviceName; pSetOid->Oid = OID_802_11_SSID; memset(&ssid , 0 , sizeof(ssid)); ssid.SsidLength = strlen(szSSID); memcpy((char*)ssid.Ssid , szSSID , ssid.SsidLength); memcpy(&pSetOid->Data[0], &ssid, sizeof(NDIS_802_11_SSID)); if (!DeviceIoControl(m_handle, IOCTL_NDISUIO_SET_OID_VALUE, (LPVOID) &SetBuffer[0], sizeof(SetBuffer), (LPVOID) &SetBuffer[0], 0, &dwBytesReturned, NULL)) { hRes = E_FAIL; } } return hRes; } |
|
沙发#
发布于:2008-12-10 08:35
顶啊,等待高人
|
|