Jump to content

Native Wifi Functions


MattyD
 Share

Recommended Posts

Sorry Doppio,

Manipulating the EAP part of profiles is now the only thing left to do.

The only EAP data currently implemented is what windows uses when "The key is provided for me automatically" is checked.

If you dont want to wait for me to add the functionality try this:

- Create a working profile manually

- Use the following code to get an XML template:

#include "Native_Wifi_Func_V2_2.au3"

$SSID = "Enter profile name here"
$hClientHandle = _Wlan_OpenHandle()
$Enum = _Wlan_EnumInterfaces($hClientHandle)
$pGUID = $Enum[0][0]

$a_iCall = DllCall($WLANAPIDLL, "dword", "WlanGetProfile", "hwnd", $hClientHandle, "ptr", $pGUID, "wstr", $SSID,"ptr", 0, "wstr*", 0, "ptr*", 0, "ptr*", 0)
ConsoleWrite("Call Error: " & @error & @LF)
ConsoleWrite(_Wlan_GetErrorMessage($a_iCall[0]))
ConsoleWrite($a_iCall[5] & @LF)
FileWrite("Profile.xml", $a_iCall[5])

-Use the following code to set a XML profile:

#include "Native_Wifi_Func_V2_2.au3"

$XMLProfile = FileRead("Profile.xml")
$hClientHandle = _Wlan_OpenHandle()
$Enum = _Wlan_EnumInterfaces($hClientHandle)
$pGUID = $Enum[0][0]

$a_iCall = DllCall($WLANAPIDLL, "dword", "WlanSetProfile", "hwnd", $hClientHandle, "ptr", $pGUID, "dword", 0, "wstr", $XMLProfile, "ptr", 0, "int", 1, "ptr", 0, "dword*", 0)
ConsoleWrite("Call Error: " & @error & @LF)
ConsoleWrite(_Wlan_GetErrorMessage($a_iCall[0]))
Link to comment
Share on other sites

Version 3.0 Release

Added Functions:

_Wlan_SetProfileList()

_Wlan_ConnectWait()

_Wlan_DisconnectWait()

_Wlan_StartSession()

_Wlan_EndSession()

_Wlan_pGuidToString()

Fix memory leaks from:

_Wlan_EnumInterfaces()

_Wlan_GetAvailableNetworkList()

_Wlan_GetProfileList()

_Wlan_QueryInterface()

New syntax in 3.0a (3.0b old syntax):

Incorperates optional parameters in function calls (including $pGUID and $hClientHandle)

Think i've got it stabilised but be wary of _Wlan_ConnectWait() and _Wlan_DisconnectWait() - its my first dabble with callbacks!

Suggest using while loop with ping() as an alternative

_Wlan_ConnectWait() and _Wlan_DisconnectWait() also requires the Network Connection (netman) service

Cheers,

Matt

Edited by MattyD
Link to comment
Share on other sites

WIFI UDF is really good idea!!

Looks nice.

Five stars from me.

Ditto, Real Nice!!

You have great error checking and return info, maybe place some of these is your demo scripts

#include <Array.au3>
#include "WIFI.au3"
$Handle = _Wlan_OpenHandle()
If @error Then MsgBoxer(@error, $Handle)
$Enum = _Wlan_EnumInterfaces($Handle)
_Wlan_SetGlobalConstants($Handle, $Enum[0][0])
_Wlan_Scan(-1, -1)
$AvailNet = _Wlan_GetAvailableNetworkList(-1, -1, 0)
_ArrayDisplay($AvailNet)
Dim $Profile[9]
$Profile[0] = "Bogus"
$Profile[1] = "Infrastructure"
$Profile[2] = "Automatic"
$Profile[3] = "WPA-PSK"
$Profile[4] = "AES"
$Profile[5] = "802.1x Disabled"
$Profile[6] = "Pass Phrase"
$Profile[7] = "password1"
$Profile[8] = "No Key Index"
_Wlan_SetProfile(-1, -1, $Profile)
$ProfileList = _Wlan_GetProfileList(-1, -1)
_ArrayDisplay($ProfileList)
_Wlan_DeleteProfile(-1, -1, "Bogus")
$ProfileList = _Wlan_GetProfileList(-1, -1)
_ArrayDisplay($ProfileList)

Func MsgBoxer($Er, $Stat)
    MsgBox(262208,"Error #" & $Er,"Fatal Error..." & @CRLF & @CRLF & $Stat & "   ", 5)
    Exit
EndFunc

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Sorry Doppio,

Manipulating the EAP part of profiles is now the only thing left to do.

The only EAP data currently implemented is what windows uses when "The key is provided for me automatically" is checked.

If you dont want to wait for me to add the functionality try this:

- Create a working profile manually

- Use the following code to get an XML template:

#include "Native_Wifi_Func_V2_2.au3"

$SSID = "Enter profile name here"
$hClientHandle = _Wlan_OpenHandle()
$Enum = _Wlan_EnumInterfaces($hClientHandle)
$pGUID = $Enum[0][0]

$a_iCall = DllCall($WLANAPIDLL, "dword", "WlanGetProfile", "hwnd", $hClientHandle, "ptr", $pGUID, "wstr", $SSID,"ptr", 0, "wstr*", 0, "ptr*", 0, "ptr*", 0)
ConsoleWrite("Call Error: " & @error & @LF)
ConsoleWrite(_Wlan_GetErrorMessage($a_iCall[0]))
ConsoleWrite($a_iCall[5] & @LF)
FileWrite("Profile.xml", $a_iCall[5])

-Use the following code to set a XML profile:

#include "Native_Wifi_Func_V2_2.au3"

$XMLProfile = FileRead("Profile.xml")
$hClientHandle = _Wlan_OpenHandle()
$Enum = _Wlan_EnumInterfaces($hClientHandle)
$pGUID = $Enum[0][0]

$a_iCall = DllCall($WLANAPIDLL, "dword", "WlanSetProfile", "hwnd", $hClientHandle, "ptr", $pGUID, "dword", 0, "wstr", $XMLProfile, "ptr", 0, "int", 1, "ptr", 0, "dword*", 0)
ConsoleWrite("Call Error: " & @error & @LF)
ConsoleWrite(_Wlan_GetErrorMessage($a_iCall[0]))
Great I'm able to create the profile but it asks for credentials, is there a way to include the credentials in the schema or code?

Thanks again for all your hard work.

Link to comment
Share on other sites

Thanks muchly guys, you flatter me.

I'm able to create the profile but it asks for credentials, is there a way to include the credentials in the schema or code?

If the new profile is a one to one match with the one generated from windows, I'd be guessing the entering of credetials are handled outside of the API. If this is the case I'll try to include a workaround but I'll tackle that when I get to it

If you wish to dig deeper with the XML schema in the meantime try here: http://msdn.microsoft.com/en-us/library/bb204691(VS.85).aspx Just be aware not all elements are valid in XP. There should be some examples floating around there too if its helpful to anyone.

Finally, I'd just like to post a list of functions to date:

_Wlan_StartSession()

_Wlan_EndSession()

_Wlan_OpenHandle()

_Wlan_CloseHandle()

_Wlan_EnumInterfaces()

_Wlan_SetGlobalConstants()

_Wlan_Scan()

_Wlan_GetAvailableNetworkList()

_Wlan_Connect()

_Wlan_Disconnect()

_Wlan_ConnectWait()

_Wlan_DisconnectWait()

_Wlan_GetProfileList()

_Wlan_SetProfileList()

_Wlan_GetProfile()

_Wlan_SetProfile()

_Wlan_DeleteProfile()

_Wlan_SetProfilePosition()

_Wlan_QueryInterface()

_Wlan_SetInterface()

_Wlan_StringTopGUID()

_Wlan_pGUIDToString()

Cheers,

Matt

Link to comment
Share on other sites

I could kiss you, this is *exactly* what I needed today for two XP wireless profile imports, both using WPA2 & AES that I've been stressing over for the past few days.. all the good stuff (netsh commands for wireless) is only available in Vista..

I've now been able to export both profiles and cobble together an app to import them which is great..

Thanks again.

Link to comment
Share on other sites

  • 3 weeks later...

Hi MattyD,

thanks for this great tool. But I'm not able to create a unsecured profile, _Wlan_SetProfile()

always returns, that the profile is corrupt. I used this array

$mondial[9] = ["mondial", "Infrastructure", "Automatic", "Open", "none", "802.1x Disabled", "", "", ""]

but I always get the error and no profile is created.

Can you help me?

Many thanks, Michael

Link to comment
Share on other sites

  • 2 months later...

Hi All,

I know Iv'e been a stranger of late and I apologise.

Version 3.1 is out... just minor bug fixes im afraid.

- Stops GetAvailableNetworkList() occasionally crashing

- SetProfile() now working for open, Unencyrpted profiles (sorry Michael its been a long time coming)

- StartSession() errors return properly

- Added better help for v3.Xb and threw some samples into the mix

Heres an update of whats (not) been happening:

Months ago a started to attack adding EAP info to the profiles - Ran into a wall of xml schema (which i dont know to well and learned to despise) and my eyes started to bleed! I had another crack at it later but got nowhere... So the project got shelved. ATM I am working full time and headed back to uni so I'm not too keen to go headlong into it again for the moment.

Good news is there are other things on the To Do list that may result in an earlier update...

- Add a function (or modify get/set profile) to get and set the <configblob> element from the XML profiles - basically a workaround for the EAP problem

- Add a function to set user credentials (can be done easier than I thought!)

- Total rework of the code... I was (still am really) pretty new to programming - let alone autoit - when writing this UDF so the code just ain't that efficient.

Again I don't have too much spare time these days and I'm half working on another project so bare with me...

Cheers,

Matt

Link to comment
Share on other sites

  • 4 weeks later...

Thanks for all your hard work and effort,

I'm currently using a very simple solution to backup and restore profiles using your UDF :D , however I encountered some problems with a Dell Latitude D505 laptop, and the solution was to update the WLan drivers because the original drivers did not support WPA.

My question is the following, Is there a way to detect if the WLan card supports WPA? if there was (maybe a return value from your UDF) I could initiate the WLAN driver update before I configure the profile.

I know you are very busy and I appreciate you valuable time spent here.

Thanks.

Link to comment
Share on other sites

Hey Mate,

I'm not sure if the API is smart enough to figure that one out, but theres a couple of things you could try...

Fisrt check to see if there is a Not Connectable reason from GetAvailableNetworkList on WPA networks

Second option is a workaround: you can check the registry for the driver date and/or version...

Check here for info on all of your installed network adaptors

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}

- just search the key with your adaptor name or GUID to find the right subkey

As for incorperating something into the UDF in the future:

I may be able to put more info in connectwait but Im guessing the not connectable reason from there will be idetical to that returned by GetAvailableNetworkList

EnumInterfaces and QueryInterface calls wont return any more information than alreadys there! (in XP anyway)

And I suppose I could just whip up something to check the above key in the registry...

Thanks and Good Luck,

Matt

P.S. I don't find myself in such situations so posts like these are more than welcome! same goes for bugs and requests... if you want something fixed or put in - i probly havn't found it or thought of it - tell me! (just be aware it may take me a while to get around to it)

Link to comment
Share on other sites

  • 1 month later...

Hi Matty D

I just wanted to thank you for sharing this script and knowledge.

I searched the net for a couple of hours before trying the AutoIT forum, no one had come up with any solutions that would work for me.

But this stuff is true gold cheers.

Regards,

Ian

Link to comment
Share on other sites

  • 1 month later...

Hey y'all,

It turns out I'm not as retarded a I thought... To add eap settings in the profiles without using a blob you need to get this hotfix. http://support.microsoft.com/kb/958071 (SP3 Only!). Oh and by the way it is supposed to be pushed out in SP4! Thats right as far as I can see SP4 hasn't even been announced. Anyway this revolution has given me new hope and insperation so after the next stable version 3 release (with EAP support) I'm planning to wipe the slate clean and start afresh with hopefully much betterer code. Before I plough into it I would like some feedback on my thoughts both as progammers and end users. If you want some input, now is the time to speak up...

Anayway this is what is on my mind for V4...

1. Vista/7 Support.

- Ok the problem with this is Vista and 7 have much more capability than XP. apart from blowing out the file size of the UDF with extra functions you can mostly do with one line commands in NETSH, the existing functions return a little differently to XP. For example, In XP interface states are either "Connected", "Disconnected" or "Authenticating". In Vista/7 states can be "Not Ready", "Connected", "Ad Hoc Network Formed", "Disconnecting", "Disconnected", "Associating", "Discovering" or "Authenticating". Obviously this makes it a nightmare to have working scripts when programming across platform.

2. Strings vs Declaring Tonnes of Constants.

- The traditional (and standard) method here as we know is to use declared constants. so instead of [if func(xyz) == "Connected"] we do [if func(xyz) == $WLAN_CONNECTED]. Im still leaning towards the string method cause when a function returns a table you will end up with a bunch of numbers which can get confusing. A disadvantage is for things like booleans where you cant do [if not func(xyz)] cause it will a string such as "Disabled". By the way I will turn off case sensitivity with the strings if i go down that path.

3. Error Handling

- Happy with it? I'm inclined to expand it a bit so all errors will return a reason for failure. Again it means you can't do this [if not func(xyz)]. The alternative is to have a geterrormsg() function that will return a string.

4. Handles

- Move the client handle handling behind the scenes. Basically it will mean you will lose the capability of opening more than one handle. huge loss ;). seriously if anyone has found a use for this let me know or it is going...

5. GUID Handling

- No longer working with GUID pointers... Thinking of setting up a GUID register where you can add or remove interfaces automatically (like enuminterfaces) or manually (like StringtopGUID). Basically you will be working with either an index or the actual GUID value - a default could be set of course. I was thinking this could be a good management tool etc... Edit: Better to use MAC address.

6. Annoyances

- a. Get rid of the file not found error message for bad GUIDs

- b. Change annoyingly long things. thinking of _Wlan_GetAvailableNetworkList() and Native_Wifi_Func_vxx.au3 (lots of this sort of thing behind the scenes!)

- c. Maybe try to get rid of the -adhoc suffix... might not be a way round this but we'll see. Thoughts?

- d. More specific error messages for bad profiles

- e. return an error for a failed connection before the function timeout in connectwait

7. Additions (likely see some of this before v4) If I end up supporting Vista/7 this list will skyrocket

- a. EAP!!! and user credentials.

- b. Add a waitfordisconnect function.

- c. Get diver information on an interface (from registery)

- d. Proper html help documentation (.chm)

- e. Add a script to install\remove Native Wifi Keywords and Calltips for SciTe

Thanks all for your support,

Matt.

Edited by MattyD
Link to comment
Share on other sites

  • 4 weeks later...

Hi all,

For the ones of you that need to use eap profiles but do not want to wait, you can follow these steps:

1. Manually create a valid eap profile

2. Export the profile to an xml file

3. On all of the computers that need to connect to the profile - import the profile.

Just as a quick and dirty example, I've used some of Matt's code to do that.

Matt, I hope you don't mind. Actually, you might want to add support in your functions to export a profile to XML file and to import a profile from an XML profile.

I've used it to create eap profiles that do not require server certificate validation or ones that validate a specific server (requires some specific blob settings).

The examples are below:

Usage: ExportXmlProfile <SSID>

Profile will be exported to <SSID>.xml

#CS
13/08/2009 - Version 3.1b
-----------------------------------------------------------------
----------------------NATIVE WIFI FUNCTIONS----------------------
--------------------------For WinXP SP3--------------------------
----------------------------by MattyD----------------------------
-----------------------------------------------------------------

This is a quick how to...
Check the help for a comprehensive coverage of functions!

The syntax for these functions is used for back compatablity
It is recomended that newcomers use the V3.1a functions

If you are using 3rd party software to configre your connections
this script will give windows control

The connections section is commented out for sake of annoyance

This script assumes you are connected when running
#CE
#Include "Native_Wifi_Func_V3_1b.au3"
#include <array.au3>

;----------------------------------------------------------------
;Setting up the Session...
;----------------------------------------------------------------
$Interfaces = _Wlan_StartSession()  ;Calls Openhandle, EnumInterfaces and SetGlobalConstants
                                    ;If successful it returns output from EnumInterfaces and sets @extended to the client handle
                                    ;SetGlobalConstants is called with the client handle and the pointer to the guid of the first interface
                                    ;
                                    ;Still confused? (Its not essential unless you wish to control a second wifi card)
                                    ;We can manually set up the session by:
                                    ;
                                    ;$Handle = _Wlan_OpenHandle()
                                    ;$Interfaces = ($Handle)
                                    ;_Wlan_SetGlobalConstants($Handle, $Interfaces[0][0]) (this allows -1 to be subsituted for client handle and guid pointer values in subsequent functions)
                                    
;_ArrayDisplay($Interfaces, "Interface Array")  ;$Interfaces[Interface][0] - pointer to a GUID struct 
                                                ;   Used for multiple wifi cards (lets functions know which adaptor to talk to)
                                                ;$Interfaces[Interface][1] - Adaptor name
                                                ;$Interfaces[Interface][2] - Connection state. Connected, Disconnected or Authenticating - Read next section for more info!

;----------------------------------------------------------------
;Error Management
;----------------------------------------------------------------

;ERROR VALUES
;   @error = 0 
;        Success!
;    
;   @error = 1
;        Dll Call Error
;        
;        The function returns a reason for the error
;        
;        @Extended is set to the Dll error code 
;            To interpret the @extended value go to:
;            http://msdn.microsoft.com/en-us/library/ms681381.aspx
;   
;   @error = 2
;        Number of interfaces/available networks/profiles/profile names = 0
;        
;   @error = 3
;       Invalid Profile
;       
;   @error = 4
;       Unable To Use Dll
;       
;   @error = 5
;       Function timed out

;----------------------------------------------------------------
;Adaptor related functions
;----------------------------------------------------------------
_Wlan_SetInterface(-1, -1, 0, "Auto Config Enabled") ;Auto Config Enabled or Auto Config Disabled - Some 3rd party wifi managers will switch this setting off again if it wants control! 
If @error Then ConsoleWrite("_Wlan_SetInterface1: " & $Error)
$QI = _Wlan_QueryInterface(-1, -1, 0) ;The "use Windows to configure my wireless network settings" checkbox - Needs to be enabled for many funtions to work
ConsoleWrite("Query Interface 0: " & $QI & @CRLF)
If @error Then ConsoleWrite("_Wlan_QueryInterface2: " & $Error)
    
If $CmdLine[0] == 0 Then 
    MsgBox(16, "ExportXmlProfile error", "Missing profile SSID argument")
    Exit 1
EndIf   

If $CmdLine[0] > 1 Then 
    MsgBox(16, "ExportXmlProfile error", "Incorrect number of command line arguments")
    Exit 1
EndIf   

; Check that the profile exists
$wlanProfile = _Wlan_GetProfile(-1, -1, $CmdLine[1])
If StringLeft($wlanProfile, 18) == "Element not found." Then
    MsgBox(16, "ExportXmlProfile error", "No profile found for SSID: " & $CmdLine[1])
    Exit 1
EndIf

; Get the profile's XML
$a_iCall = DllCall($WLANAPIDLL, "dword", "WlanGetProfile", "hwnd", $GLOBAL_hClientHandle, "ptr", $Interfaces[0][0], "wstr", "reg73G_rsn_eap_ccmp","ptr", 0, "wstr*", 0, "ptr*", 0, "ptr*", 0)
If @error <> 0 Then
    MsgBox(16, "ExportXmlProfile error", "Error getting the XML profile for SSID: " & $CmdLine[1])
    Exit 1
ElseIf $a_iCall[0] <> 0 Then
    $ErrorMessage = _Wlan_GetErrorMessage($a_iCall[0])
    MsgBox(16, "ExportXmlProfile error", "Error getting the XML profile for SSID: " & $CmdLine[1] & @CRLF & "Error (" & $a_iCall[0] & "): " & $ErrorMessage)
    Exit 1
EndIf
$xmlProfile = $a_iCall[5]

; Write the profile to a file
$fileName = $CmdLine[1] & ".xml"
$fh = FileOpen ( $fileName , 2 )
If $fh == -1 Then
    MsgBox(16, "ExportXmlProfile error", "Could not write to XML file: " & $fileName)
    Exit 1
EndIf
FileWrite($fh, $xmlProfile )
FileClose($fh)

MsgBox(64, "ExportXmlProfile success", "Successfully wrote the profile to: " & $fileName)

_Wlan_EndSession(-1) ;Calls CloseHandle and closes the dll

Usage: ImportXmlProfile <profile.xml>

#CS
13/08/2009 - Version 3.1b
-----------------------------------------------------------------
----------------------NATIVE WIFI FUNCTIONS----------------------
--------------------------For WinXP SP3--------------------------
----------------------------by MattyD----------------------------
-----------------------------------------------------------------

This is a quick how to...
Check the help for a comprehensive coverage of functions!

The syntax for these functions is used for back compatablity
It is recomended that newcomers use the V3.1a functions

If you are using 3rd party software to configre your connections
this script will give windows control

The connections section is commented out for sake of annoyance

This script assumes you are connected when running
#CE
#Include "Native_Wifi_Func_V3_1b.au3"
#include <array.au3>

;----------------------------------------------------------------
;Setting up the Session...
;----------------------------------------------------------------
$Interfaces = _Wlan_StartSession()  ;Calls Openhandle, EnumInterfaces and SetGlobalConstants
                                    ;If successful it returns output from EnumInterfaces and sets @extended to the client handle
                                    ;SetGlobalConstants is called with the client handle and the pointer to the guid of the first interface
                                    ;
                                    ;Still confused? (Its not essential unless you wish to control a second wifi card)
                                    ;We can manually set up the session by:
                                    ;
                                    ;$Handle = _Wlan_OpenHandle()
                                    ;$Interfaces = ($Handle)
                                    ;_Wlan_SetGlobalConstants($Handle, $Interfaces[0][0]) (this allows -1 to be subsituted for client handle and guid pointer values in subsequent functions)
                                    
;_ArrayDisplay($Interfaces, "Interface Array")  ;$Interfaces[Interface][0] - pointer to a GUID struct 
                                                ;   Used for multiple wifi cards (lets functions know which adaptor to talk to)
                                                ;$Interfaces[Interface][1] - Adaptor name
                                                ;$Interfaces[Interface][2] - Connection state. Connected, Disconnected or Authenticating - Read next section for more info!

;----------------------------------------------------------------
;Error Management
;----------------------------------------------------------------

;ERROR VALUES
;   @error = 0 
;        Success!
;    
;   @error = 1
;        Dll Call Error
;        
;        The function returns a reason for the error
;        
;        @Extended is set to the Dll error code 
;            To interpret the @extended value go to:
;            http://msdn.microsoft.com/en-us/library/ms681381.aspx
;   
;   @error = 2
;        Number of interfaces/available networks/profiles/profile names = 0
;        
;   @error = 3
;       Invalid Profile
;       
;   @error = 4
;       Unable To Use Dll
;       
;   @error = 5
;       Function timed out

;----------------------------------------------------------------
;Adaptor related functions
;----------------------------------------------------------------
_Wlan_SetInterface(-1, -1, 0, "Auto Config Enabled") ;Auto Config Enabled or Auto Config Disabled - Some 3rd party wifi managers will switch this setting off again if it wants control! 
If @error Then ConsoleWrite("_Wlan_SetInterface1: " & $Error)
$QI = _Wlan_QueryInterface(-1, -1, 0) ;The "use Windows to configure my wireless network settings" checkbox - Needs to be enabled for many funtions to work
If @error Then ConsoleWrite("_Wlan_QueryInterface2: " & $Error)
    
_Wlan_SetInterface(-1, -1, 1, "Infrastructure Only") ;Infrastructure Only, Ad Hoc Only, or Any Available Network
If @error Then ConsoleWrite("_Wlan_SetInterface2: " & $Error)
$QI = _Wlan_QueryInterface(-1, -1, 1) 
If @error Then ConsoleWrite("_Wlan_QueryInterface2: " & $Error)
    

If $CmdLine[0] == 0 Then 
    ConsoleWrite("Error: No XML file name was supplied.")
    Exit 1
EndIf   

If $CmdLine[0] > 1 Then 
    ConsoleWrite("Error: Incorrect number of command line arguments")
    Exit 1
EndIf   

If StringRegExp(StringRight($CmdLine[1], 4), "(?i)\.xml") <> 1 Then
    ConsoleWrite('Error: Given file name is not of type: ".xml": ' & $CmdLine[1])
    Exit 1
EndIf

; Reading the profile from an XML file
$fh = FileOpen ( $CmdLine[1], 0 )
If $fh == -1 Then
    ConsoleWrite("Error: Could not read from XML file: " & $CmdLine[1])
    Exit 1
EndIf

$profileXml = FileRead($fh)
FileClose($fh)

; Setting the profile
$a_iCall = DllCall($WLANAPIDLL, "dword", "WlanSetProfile", "hwnd", $GLOBAL_hClientHandle, "ptr", $Interfaces[0][0], "dword", 0, "wstr", $profileXml, "ptr", 0, "int", 1, "ptr", 0, "dword*", 0)
If @error <> 0 Then
    ConsoleWrite("Error: Could not set profile from XML file: " & $CmdLine[1])
    Exit 1
Else        
    If $a_iCall[0] <> 0 Then
        $ErrorMessage = _Wlan_GetErrorMessage($a_iCall[0])
        ConsoleWrite("Error: Could not set profile from XML file: " & $CmdLine[1] & @CRLF & "Error (" & $a_iCall[0] & "): " & $ErrorMessage)
        Exit 1
    EndIf
EndIf

ConsoleWrite("Success: Setting a profile from XML file: " & $CmdLine[1])

_Wlan_EndSession(-1) ;Calls CloseHandle and closes the dll
Link to comment
Share on other sites

  • 1 month later...

Hey All,

Here we go again!

Version 3.2 Release

Added

Function _Wlan_WaitForDisconnect()

Function _Wlan_SetProfileXML()

Function _Wlan_GetProfileXML()

Function _Wlan_GenerateXMLProfile()

EAP functionality

Installer

.pdf help file

Extended Vista\7 functionality (kinda. Not supported!)

Changed

Code cleanup (all functions)

Function _Wlan_SetProfile()

Function _Wlan_GetProfile()

Function _Wlan_StringTopGUID()

.au3 sample file

Removed

.au3 help file

Don't forget the update if you're gonna use EAP! (SP3 Only)

http://support.microsoft.com/kb/958071

Cheers,

MattyD

P.S. Tried to include a function to set user credentials but i can't even get the damn sample to work!

Sorry, maybe next time...

Link to comment
Share on other sites

  • 4 weeks later...

Hello, MattyD,

Thank you for your work !

Thanks to you my Open Source project FreeWifi Manager can run on Windows Vista and Seven.

Your new version is more efficient and better documented, cheers ! :mellow:

------------------------------------

Bonjour, MattyD,

Merci pour votre travail !

Grace à vous mon projet Open Source FreeWifi Manager peut fonctionner sous Windows Vista et Seven.

Votre nouvelle version est encore plus performante et mieux documentée, bravos !

Link to comment
Share on other sites

  • 2 months later...

Is there an issue with this UDF in the latest version of autoit? I was using AutoIt v3.3.6.1 with my vistumbler application and noticed I was no longer getting APs when using native wifi. It seems like _Wlan_GetAvailableNetworkList was returning empty arrays (the array looked like it had 6 rows with no information).

I switched back to AutoIt v3.3.0.0 (which was the last version I had used) and now everything seems to be working properly.

Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

Link to comment
Share on other sites

C'est du beau travail.

Cela faisait longtemp que je charcher un utilitaire de ce genre.

Une bonne idée serait de l'associer à Google Maps et un Gps

Merci

LIES!

Beautiful work.

I've been looking for something like this for a long time.

A good idea would be to combine it with Google Maps and GPS.

Thank you

Rough?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...