PDA

View Full Version : problems with WlanConnect()



Victor.Morozko@gmail.com
05-19-08, 06:13 AM
Greetings...

I'm trying automatically connect to my wireless network.
I'm using such:

std::auto_ptr<DOT11_SSID> dot11SSID(new DOT11_SSID);
dot11SSID->uSSIDLength = ssid.size();
::memcpy(dot11SSID->ucSSID, ssid.c_str(), ssid.size());

WLAN_CONNECTION_PARAMETERS connectionParameters;
connectionParameters.wlanConnectionMode = wlan_connection_mode_auto;
connectionParameters.strProfile = L"";
connectionParameters.pDot11Ssid = dot11SSID.get();
connectionParameters.pDesiredBssidList = NULL;
connectionParameters.dot11BssType = dot11_BSS_type_any;
connectionParameters.dwFlags = WLAN_CONNECTION_HIDDEN_NETWORK;

result = ::WlanConnect(clientHandle, &wlanInterfaceGuid,
&connectionParameters, NULL);

code. (ssid -- std::string) But result always ==
ERROR_INVALID_PARAMETER

What I'm doing wrong?

Best regards...

Pavel A.
05-19-08, 02:26 PM
Try to set connectionParameters.strProfile = NULL (not a empty string).

--PA


<Victor.Morozko@gmail.com> wrote in message
news:59ae27e8-8ca1-4695-b27c-3b5c5b622bdf@d1g2000hsg.googlegroups.com...
> Greetings...
>
> I'm trying automatically connect to my wireless network.
> I'm using such:
>
> std::auto_ptr<DOT11_SSID> dot11SSID(new DOT11_SSID);
> dot11SSID->uSSIDLength = ssid.size();
> ::memcpy(dot11SSID->ucSSID, ssid.c_str(), ssid.size());
>
> WLAN_CONNECTION_PARAMETERS connectionParameters;
> connectionParameters.wlanConnectionMode = wlan_connection_mode_auto;
> connectionParameters.strProfile = L"";
> connectionParameters.pDot11Ssid = dot11SSID.get();
> connectionParameters.pDesiredBssidList = NULL;
> connectionParameters.dot11BssType = dot11_BSS_type_any;
> connectionParameters.dwFlags = WLAN_CONNECTION_HIDDEN_NETWORK;
>
> result = ::WlanConnect(clientHandle, &wlanInterfaceGuid,
> &connectionParameters, NULL);
>
> code. (ssid -- std::string) But result always ==
> ERROR_INVALID_PARAMETER
>
> What I'm doing wrong?
>
> Best regards...

Victor.Morozko@gmail.com
05-21-08, 02:15 PM
NULL changed nothing...

Pavel A.
05-21-08, 03:56 PM
<Victor.Morozko@gmail.com> wrote in message
news:0427e122-ac49-4846-9f14-41d33d6c5f0f@t54g2000hsg.googlegroups.com...
> NULL changed nothing...

XP or Vista?

Victor.Morozko@gmail.com
05-22-08, 02:58 AM
> XP or Vista?

Sorry. Vista 32 bit (home ultimate).