Jump to content

Recommended Posts

Posted

My problem is that I don't know too much about how to objcreate or dllcalls.

this is my script, It is writing to a log for the return values but it isn't outputting to the vars.

API Can be found here: http://www.nicomsoft.com/wifiman/ Download

If anyone could help that would be great, Thanks

$obj = ObjCreate( "WiFiMan.WiFi.1" )

$free = $obj.FreeAllResources()
ConsoleWrite($free & @CRLF)

$adapters = $obj.EnumerateAdapters()
ConsoleWrite( $adapters & @CRLF )

$name = 0
$adaptername = $obj.GetAdapterName(0, $name, 64)
ConsoleWrite( Hex($adaptername) & @CRLF )
ConsoleWrite( $name & @CRLF )

Log Output:

13:59:18:754 ----------

13:59:18:774 EnumerateAdapters

13:59:19:255 DoInit

13:59:19:255 WinVer = 5.1 Service Pack 2

13:59:19:255 DoInit Finished

13:59:19:265 Adapters: 1

13:59:19:265 EnumerateAdapters Finished, result=1

13:59:19:265 GetAdapterName

13:59:19:265 Adapter name: IntelĀ® PRO/Wireless 2200BG Network Connection

13:59:19:265 GetAdapterName Finished, result=47

API List:

WiFi-Manager API Reference

EnableLog

DisableLog

EnumerateAdapters

GetAdapterGUID

GetAdapterName

FreeAllResources

EnumerateAvailableNetworks

GetAvailableNetworkName

GetAvailableNetworkSignalQuality

GetAvailableNetworkType

IsAvailableNetworkSecure

GetAvailableNetworkAuthMode

GetAvailableNetworkCipherMode

EnumerateProfiles

GetProfileName

GetCurrentNetworkName

GetCurrentNetworkChannel

GetCurrentNetworkSpeed

ConnectToNetwork

DisconnectFromNetwork

MoveProfile

DeleteProfile

OpenProfilesUI

Check out ConsultingJoe.com
Posted (edited)

At first thanks for info about this lib.

What do you want to do especially?

Cause I'm working at the moment also on some WiFi realizing (with wlanapi.dll) but also this dll seems very clear/easy to use.

Greets

Holger

Edited by Holger
Posted

At first thanks for info about this lib.

What do you want to do especially?

Cause I'm working at the moment also on some WiFi realizing (with wlanapi.dll) but also this dll seems very clear/easy to use.

Greets

Holger

Thanks a lot for the reply, I want to first make a basic netstumbler.

I just want to display all the stats about the available APs.

The API list is here: http://www.nicomsoft.com/wifiman/help/api.htm

And this code may show you more of what I want to start by doing:

When I use the objcreate to "EnumerateAdapters", it works and returns 1 but, with the dllcalls it doesn't work.

$dll = DllOpen( "WiFiMan.dll" )

$return = DllCall( $dll, "long", "EnumerateAdapters" )  ;Gets number of adapters
ConsoleWrite( "Adapters: " & $return & @CRLF)
;~ Public Declare Function EnumerateAdapters Lib "WiFiMan.dll" () As Long
$rBuffer   = DllStructCreate("char[256]")  ;This may not be right
$pBuffer   = DllStructGetPtr($rBuffer)       ;This may not be right
$return = DllCall( $dll, "long", "GetAdapterName", "long", 0, "str", $pBuffer, "long", 256 ) ;Gets adapter names (Needs buffer)
ConsoleWrite( "Adapter Name: " & DllStructGetData($rBuffer, 1) & @TAB & "Error: " & $return)
;~ Public Declare Function GetAdapterName Lib "WiFiMan.dll" (ByVal AdapterInd As Long, ByVal Name As String, ByVal MaxCount As Long) As Long
DllClose( $dll )
Check out ConsultingJoe.com
Posted

Small sample:

$Dll    = DllOpen("WiFiMan.dll")
$nCount = DllCall($Dll, "dword", "EnumerateAdapters")
ConsoleWrite("Adapters: " & $nCount[0] & @LF)

$stBuffer   = DllStructCreate("char[256]")

For $i = 0 To $nCount[0] - 1
    $nResult    = DllCall($Dll, "dword", "GetAdapterName", "int", $i, "ptr", DllStructGetPtr($stBuffer), "int", 256)
    ConsoleWrite("Adaptername: " & DllStructGetData($stBuffer, 1) & ";Result: " & $nResult[0])
Next

DllClose($Dll)

Greets

Holger

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
  • Recently Browsing   0 members

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