Hello
I am trying to write a program to connect to wifi routers/ap. I have been successfull into connecting to open networks.
However when i try to connect to secured networks, a baloon pop up asking for password. Can i not pass the password automatically.
My code is as below. Can someone modify this to work for secured network. My APs does not have any profile names.
status = WlanOpenHandle( WLAN_API_VERSION, NULL, &dwCurVersion,&hClient );
status = WlanEnumInterfaces(hClient, NULL, &pIfList);
pIfInfo = (WLAN_INTERFACE_INFO *) &pIfList->InterfaceInfo[0];
status = WlanGetAvailableNetworkList (hClient,&pIfInfo->InterfaceGuid,0,NULL,&pBssList);
for (tmploop = 0; tmploop < pBssList->dwNumberOfItems; tmploop++)
{
pBssEntry = (WLAN_AVAILABLE_NETWORK *) & pBssList->Network[tmploop];
if (pBssEntry->dot11Ssid.uSSIDLength != 0)
{
strcpy(tmpBuffer,(char *) pBssEntry->dot11Ssid.ucSSID );
if(strcmp(tmpBuffer,"2WIRE472") == 0)
{
wlanConnPara.wlanConnectionMode = wlan_connection_mode_discovery_secure; wlanConnPara.strProfile = pBssEntry->strProfileName;
strcpy( (char *)(infoForSSID.ucSSID), tmpBuffer);
infoForSSID.uSSIDLength = pBssEntry->dot11Ssid.uSSIDLength;
wlanConnPara.pDot11Ssid =&infoForSSID;
wlanConnPara.pDesiredBssidList = NULL;
wlanConnPara.dot11BssType = pBssEntry->dot11BssType;
wlanConnPara.dwFlags = pBssEntry->dwFlags;
status = WlanConnect( hClient, &pIfInfo->InterfaceGuid, &wlanConnPara, NULL );
}
}
}
Thanks
Nishith