But when I use this flag in my code, it doesn't take effect. I create a
temporary profile with OPEN Authentication and NONE encryption. Then use
WlanConnect with this profile to connect to an WPA-AP. WlanConnect returns
SUCCESS, but I cannot capture any authentication request and association
request sent out.
Can anyone help on this issue? Is there any example on how to use this bit?
pWriter->WriteStartElement(NULL,L"WLANProfile",NULL);
pWriter->WriteAttributeString(L"p1",L"xmlns",NULL,L"http://www.microsoft.com/networking/WLAN/profile/v1");
ReadWriteXML_Name(TRUE,xmlToWlan,L"name",pWriter);
ReadWriteXML_SSID(TRUE,xmlToWlan,L"SSIDConfig",pWriter);
pWriter->WriteStartElement(NULL,L"connectionType",NULL);
pWriter->WriteString(L"ESS");
pWriter->WriteFullEndElement();
pWriter->WriteStartElement(NULL,L"connectionMode",NULL);
pWriter->WriteString(L"auto");
pWriter->WriteFullEndElement();
pWriter->WriteStartElement(NULL,L"MSM",NULL);
pWriter->WriteStartElement(NULL,L"security",NULL);
pWriter->WriteStartElement(NULL,L"authEncryption",NULL);
pWriter->WriteStartElement(NULL,L"authentication",NULL);
pWriter->WriteString(L"open");
pWriter->WriteFullEndElement();
pWriter->WriteStartElement(NULL,L"encryption",NULL);
pWriter->WriteString(L"none");
pWriter->WriteFullEndElement();
pWriter->WriteStartElement(NULL,L"useOneX",NULL);
pWriter->WriteString(L"false");
pWriter->WriteFullEndElement(); //useOneX
pWriter->WriteFullEndElement(); //authEncryption
pWriter->WriteFullEndElement(); // security
pWriter->WriteFullEndElement(); // MSM
pWriter->WriteFullEndElement(); // wlanProfile
pWriter->WriteEndDocument();
pWriter->Flush();
// create a COM object to read the XML file
hr = CoCreateInstance(
CLSID_DOMDocument60,
NULL,
CLSCTX_INPROC_SERVER,
IID_IXMLDOMDocument2,
(void**)&pXmlDoc
);
if (hr != S_OK)
{
dwError = WIN32_FROM_HRESULT(hr);
return dwError;
}
hr = pXmlDoc->load((CComVariant)TempStr, &vbSuccess);
if (hr != S_OK || vbSuccess != VARIANT_TRUE)
{
dwError = ERROR_BAD_PROFILE;
return dwError;
}
hr = pXmlDoc->get_xml(&bstrXml);
if (hr != S_OK)
{
dwError = ERROR_BAD_PROFILE;
return dwError;
}
ZeroMemory(&dot11Ssid,sizeof(DOT11_SSID));
StringWToSsid(xmlToWlan->SSID,&dot11Ssid);
wlanConnPara.wlanConnectionMode = wlan_connection_mode_temporary_profile;
wlanConnPara.pDot11Ssid = &dot11Ssid;
wlanConnPara.strProfile = bstrXml;
wlanConnPara.dot11BssType = dot11_BSS_type_infrastructure;
wlanConnPara.pDesiredBssidList = NULL;
wlanConnPara.dwFlags = WLAN_CONNECTION_IGNORE_PRIVACY_BIT;
dwError = WlanConnect(
wlandevice,
&AdapterGUID,
&wlanConnPara,
NULL // reserved
);