Configure Wifi Settings using C#

那年仲夏 提交于 2019-12-05 06:39:28

问题


How to configure Wifi Settings for a Win Mobile application using C# (compact framework)?

So the deal is:

  • Configure the network (SSID for an hiden AP)
  • WPA authentication with TKIP
  • Force user and password (the end-user won't be prompted for authentication)

回答1:


Take a look at the Smart Device Framework. It has a NetworkInformation namespace that wrap a large amount of the WZC functionality. I know it will do WEP and WPA with TKIP (as well as open). It allows you to pass in the key material, set up most options, etc.

Look specifically at the WirelessZeroConfigNetworkInterface class and it's AddPreferredNetwork method.

Edit: If you're curious what APIs you'd use directly, you'd start here.




回答2:


I'm not sure whether it's possible to programatically change those settings.

The Configuration Service Providers is what you usually use to provision devices with settings like these (also it's used for GPRS settings for example).

What you do is that you create a special CAB-file containing a special _setup.xml which Windows Mobile will use to change the settings.

Read about it here on MSDN (and here for the specific Wifi configuration).

Also note that depending on the device, your cab-file will need to be signed by the device manufacturer (good luck with that...)




回答3:


Alternatively, you could probably utilize the Connection Manager API.




回答4:


The username and password must be set in the registry directly. They're in [HKCU]\Comm\Eapol\<ssid>\Identity and [HKCU]\Comm\Eapol\<ssid>\Password. The username is cleartext, the password is encrypted. Those locations are defined in the platform builder header eapol.h.

-PaulH



来源:https://stackoverflow.com/questions/469113/configure-wifi-settings-using-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!