SuperEnginerd Posted April 28, 2011 Share Posted April 28, 2011 (edited) Hello all. (autoit newbie) I'm having trouble getting the correct return values from my dllcall... thought I'd post and help. Using the example I found So I have a function that looks like this: // function to scan wifi, returns list of APs and number of APs found DWORD scanwifi(BYTE **ppWifiAPs, DWORD*size) and ppWifiAPs is an array of structs, like this: struct { WCHAR ssid[260]; int rssi; int auth; int priv; } so I write my autoit script like this local $wifi_ap_count = 255 local $wifi_ap_list_print ; build array of structs $wifi_ap_struct_type = "WCHAR ssid[260];int rssi;int auth;int priv" $WifiStructDef="" For $i = 0 to 20 $WifiStructDef&=$wifi_ap_struct_type; Next $wifi_ap_list_array= DllStructCreate($WifiStructDef) ; do the actual call $result = DllCall("RemoteExerciserDLL.dll", _ "DWORD:cdecl","scanwifi", _ "ptr", DllStructGetPtr($wifi_ap_list_array), _ "DWORD*", $wifi_ap_count) ; set the count of returned number of found APs $wifi_ap_count = $result[2] ; build the result string For $j = 0 to $wifi_ap_count $wifi_ap_list_print &= _ "SSID: " & DllStructGetData($wifi_ap_list_array, 4*$j+1) & _ " RSSI: " & DllStructGetData($wifi_ap_list_array, 4*$j+2) & _ " Auth: " & DllStructGetData($wifi_ap_list_array, 4*$j+3) & _ " Priv: " & DllStructGetData($wifi_ap_list_array, 4*$j+4) & @CRLF Next MsgBox(0, "ScanWifi", "Finished scanning wifi:" & @CRLF & _ "return status: " & $result[0] & @CRLF & _ "Found Networks count: " & $wifi_ap_count & @CRLF & _ "Found Networks: " & @CRLF & $wifi_ap_list_print ) but this does not seem to work. My "found network count" is always some weird number, and wifi_ap_count seems always to be 0, and the output values are all 0's I have a C program that calls this function and I am able to get the correct results, but AutoIt seems to always return funny numbers, and I can't quite tell if it got any data back at all... any thoughts? (sorry if this seems like a cop out to ask you guys to debug my code, but I am just out of ideas of what else to try?) Edited April 29, 2011 by SuperEnginerd Link to comment Share on other sites More sharing options...
crislivinitup Posted March 18, 2012 Share Posted March 18, 2012 You have a typo in your dllstruct data set.Your variable $wifi_ap_struct_type should end with a seperating semicolon ';' to seperate all the terms in the list. When you join it back to back with your for loop statement, it will look like: WCHAR ssid[260];int rssi;int auth;int privWCHAR ssid[260];int rssi;int auth;int privWCHAR ssid[260];int rssi;int auth;int privYou can see your mistake I assume. Link to comment Share on other sites More sharing options...
JohnOne Posted March 18, 2012 Share Posted March 18, 2012 To be honest, I doubt the OP is still checking this thread after almost a year. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
crislivinitup Posted March 18, 2012 Share Posted March 18, 2012 Ya...... but at least he can't say the autoit community doesn't care. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now