0

为了连接到一个开放的接入点,我填写了 WLAN_CONNECTION_PARAMETERS 结构如下

WLAN_CONNECTION_PARAMETERS ConnectionParameters;
ConnectionParameters.wlanConnectionMode = wlan_connection_mode_discovery_unsecure;
ConnectionParameters.strProfile         = L"";
ConnectionParameters.pDot11Ssid         = &Dot11Ssid;
ConnectionParameters.pDesiredBssidList  = nullptr;
ConnectionParameters.dot11BssType       = dot11_BSS_type_independent;
ConnectionParameters.dwFlags            = WLAN_CONNECTION_ADHOC_JOIN_ONLY;

WlanConnect()函数ERROR_SUCCESS返回。

NotificationCallback()函数打印:

wlan_notification_acm_connection_start
Currently connecting to "BT.03" using profile "BT.03" **// Correct**
WLAN_NOTIFICATION_SOURCE_ACM
**wlan_notification_acm_connection_attempt_fail**
The connection failed. wlanReasonCode:  163851
The reason is "La rete specificata non è disponibile."

错误在哪里?

您是否有一段代码可以连接到具有特定 ssid 的新开放无线接入点?

4

2 回答 2

1

WLAN_CONNECTION_PARAMETERS使用strProfile时应设置为的状态的文档,但您的代码将其设置为.NULLwlan_connection_mode_discovery_unsecureL""

如果wlanConnectionMode设置为wlan_connection_mode_discovery_securewlan_connection_mode_discovery_unsecurestrProfile则应设置为NULL

因此,将您的代码更改为:

ConnectionParameters.strProfile = NULL;
于 2020-12-28T16:43:08.573 回答
0

ConnectionParameters.strProfile= nullptr;

不解决。

解决方案是添加

memset(&ConnectionParameters, 0, sizeof(WLAN_CONNECTION_PARAMETERS));
于 2020-12-29T13:07:26.630 回答