Windows Wireless API

How to programmatically access the WiFi API

(Updated 2007/01/29 with new download paths – API is now out of beta, thank you Aichi!)
After searching for hours and hours I finally found a solution for accessing and changing the windows wireless settings through a programming interface. Using the Wireless Zero Configuration service and the WiFi Native API I was able to change anything that I wanted to. This will allow me to programmatically roll out changes to clients WiFi interfaces through logon scripts or on a client to client basis.

Below I documented the steps that are needed to use the program, and I also have shown the steps needed to use the source code which I have released under the GNU GPL for your own projects. This is my first release of this software, so I encourage you to provide feedback, suggestions, and code!

Download the wifi config executable – 636KB for Windows XP SP2 Only.

To use wifi_config.exe perform the following steps in this order:

  1. Install the Microsoft Core XML Services (MSXML) 6.0
  2. Install KB893357
  3. Install the WLAN API for Windows XP SP2

Executable Options:
-Enable Enable the wireless interfaces specified by limit. If no limit specified, enable all wireless interfaces. This option effectively checks the “Use Windows to configure my wireless network settings” checkbox under the Wireless Network Connection Properties.
-Add Path(s) to an XML file containing the information about the Wireless Access point that you wish to setup.
-Delete Access Point name(s) that you wish to remove from the profile list.
-Nics List wireless interfaces by their description and GUID.
-Aps List access points by AP name.
-Limit GUID of the interface(s) to limit the additions, deletions, and access point listings to. The default is to use all interfaces.
-Help Displays the command line arguments and sample usage (this screen.)

Sample Usage:
Delete access point from all interfaces:
wifi_config.exe -delete SAMPLE-AP

Delete multiple access points from a specific interface:
wifi_config.exe -delete SAMPLE-AP1 SAMPLE-AP2 -limit {GUID}

Add multiple profiles:
wifi_config.exe -add “C:\profile1.xml” “C:\profile2.xml”

List access points:
wifi_config.exe -aps

Microsoft has also provided some sample XML files detailing many common access point configurations.

For those that wish to compile their own Wifi Config

Download the Wifi Config Source – 3.53MB

I had much difficulty in actually getting this (or any) Wifi API to function the way I needed it to.

Here are the steps that I took to get this code to work for me:

Using Visual Studio 2005

  1. Install the Microsoft Core XML Services (MSXML) 6.0
  2. Install KB893357
  3. Install Wireless SDK + API

  4. WLAN API for Windows XP SP2 Beta
  5. WLAN SDK for Windows XP SP2
  6. Place wlanapi.h, wlanapi.lib, and wlanapi.dll in your build directory
  7. Add wlanapi.lib to the library includes
  8. Install Install Vista RC1 SDK
  9. http://www.microsoft.com/downloads/details.aspx?FamilyId=C2B1E300-F358-4523-B479-F53D234CDCCF&displaylang=en

  10. Add the Vista SDK path to your include paths

Includes should contain at least the following:
#define WIN32_LEAN_AND_MEAN
#include <stdio.h>
#include <windows.h>
#include <winnt.h>
#include "wlanapi.h"

Ensure that the following DLLs exist on the target machines or in the run directory of your program -
For Release:
– All from:
"C:\Program Files\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT"

8 Responses to “Windows Wireless API”

  1. 1
    Ulrik Says:

    It works fine I just see to small problems

    1) you will have to install WLAN API for Windows XP SP2 Beta and Microsoft Core XML Services (MSXML) 6.0 to each client.

    2) you are not allowed to distribute WLAN API for Windows XP SP2 Beta, it says so quite clearly just above the download button.

    There must be a way around that because zwlancfg.exe (freeware from http://www.engl.co.uk/) works without any additional installs or downloads, I just wonder how.

  2. 2
    Vaibhav Says:

    Hi,
    I am interested in using this software but the links to the API and sample xml documents dont work for me. Is there any way you could provide me with those files as i need to implement 30 wireless networks on more than 500 computers.

    Thanks,
    Vaibhav

  3. 3
    William P Says:

    Thank you so much! This application is priceless… I’ve been scouring google to find a solution, and you’ve created exactly what I need.

    You’re welcome for a beer in Australia anytime :-)

    Cheers

  4. 4
    Aichi Says:

    Hello there,

    As part of my final year project at uni, I am trying to write an app which can roughly predict the position of a robot from the signal strength of a collection of wireless access points.

    I thought the WLAN API for Windows XP SP2 might be useful. However, I could not find it anywhere. The link you provided above takes me the MS connect. When I log on, it says that the thing doesn’t exist or I don’t have the right to access it. I had a look at the list of programs they have at MS connect and could not see WLAN API Beta.

    So, has it been released? Or I just missed it from the site.

    And if so, do you know where I can find it. Is it part of an SDK released by Microsoft.

    Many thanks

    Aichi, UK

  5. 5
    Aichi Says:

    Sorry, I actually got it. The API is at
    http://www.microsoft.com/downloads/details.aspx?FamilyId=52A43BAB-DC4E-413F-AC71-158EFD1ADA50

    It has been released.

    Windows Vista SDK has also been released.
    http://www.microsoft.com/downloads/details.aspx?FamilyId=C2B1E300-F358-4523-B479-F53D234CDCCF&displaylang=en

    There is also a good example at in
    C:\Program Files\Microsoft SDKs\Windows\v6.0\Samples\NetDs\wlan\AutoConfig

    You need to include the paths for include and lib as you mentionned

  6. 6
    Dave Says:

    I love your prog, but have one issue….every xml file I attempt to utilize always errors out. I tried the sample xml files from microsoft, and any sample xml that I could find with googling, but none work….any help would be greatly appreciated.

  7. 7
    Ryan Says:

    Thanks a ton, this is exactly what I was looking to do with this API. As for Ulrik’s remarks, zwlancfg.exe might be implementing the Wireless Provisioning API (http://msdn2.microsoft.com/en-us/library/ms940173.aspx)…? None the less, I’d rather install the required hotfixes and use the Wireless LAN API, which is much more versatile… not to mention, it uses the same XML syntax as the NET SH WLAN command in Vista, so you can use the same XML file to configure XP and Vista… again, thank you very much for posting this code, it is very helpful…!

  8. 8
    Alexis Says:

    Hi guys,
    I’ve been using ok wifi config to set OEM computers in the enterprise (WPA-AES-MSCAHPv2), with XP SP2, but now we’re installing computers with SP3 and “wifi_config” doesn’t work, it shows “327696 error, The eap connection properties specified int he profiel are invalid”.
    I suppose that de KBs neccesary to work for Wifi_config now are integrated in SP3, but for any reason the XML schema it has to be changed, but I can’t find the problem.
    Do you know some issue about this?

    Thanks from Spain !

Leave a Reply

Search

Subscribe!

Subscribe to the RSS Feed

Have a question or comment?

Send me an email - mincus@gmail.com

Most Popular

Recent Posts

Categories

Sponsors

Links

Meta

Classic Kids Games