wlanAPI on Windows XP SP3
My WPF application is using ManagedWifi to manually control the wifi adapter to connect to a specified network. However, when I run the application on Windows XP, I keep getting Win32Exception: The request is not supported (Native Error code 50).
The system that I was testing used Windows XP SP3, and I'm pretty sure that Windows XP SP3 supports NativeWifi:
http://msdn.microsoft.com/en-us/library/ms706556(v=vs.85).aspx
This is the profile I'm using f开发者_运维知识库or the connection:
<?xml version="1.0"?>
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
<name>Louis_flucard</name>
<SSIDConfig>
<SSID>
<hex>4C6F7569735F666C7563617264</hex>
<name>Louis_flucard</name>
</SSID>
</SSIDConfig>
<connectionType>IBSS</connectionType>
<connectionMode>manual</connectionMode>
<MSM>
<security>
<authEncryption>
<authentication>open</authentication>
<encryption>none</encryption>
<useOneX>false</useOneX>
</authEncryption>
</security>
</MSM>
</WLANProfile>
And this is the code section that I used to connect to the wireless network:
//profileXml is basically the Xml file above
wlanIface.SetProfile(Wlan.WlanProfileFlags.AllUser, profileXml, true);
wlanIface.Connect(Wlan.WlanConnectionMode.Profile, Wlan.Dot11BssType.Any, profileName);
Any help would be appreciated. Thank you.
EDIT: add tag c++. This should be relevant since C/C++ can also work with Native Wifi.
IIRC the WlanConnect call isn't supported on XP. See the list of supported APIs at http://msdn.microsoft.com/en-us/library/windows/desktop/bb204766(v=vs.85).aspx.
精彩评论