Note that there are some explanatory texts on larger screens.

plurals
  1. POWindows WlanApi and Python Ctypes
    text
    copied!<p>I'm working on a captive portal projet on Windows. I've written this piece of code (similar to <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms706716%28v=VS.85%29.aspx" rel="nofollow">this</a>) :</p> <pre><code>from ctypes import wintypes import ctypes WlanApi = ctypes.windll.wlanapi hClientHandle = wintypes.HANDLE() phClientHandle = ctypes.pointer(hClientHandle) dwNegotiatedVersion = wintypes.DWORD() pdwNegotiatedVersion = ctypes.pointer(dwNegotiatedVersion) dwClientVersion = wintypes.DWORD() dwClientVersion.value = 2L rc = WlanApi.WlanOpenHandle(dwClientVersion, None, pdwNegotiatedVersion, phClientHandle) print rc class GUID(ctypes.Structure): _fields_ = [("Data1", wintypes.DWORD), ("Data2", wintypes.WORD), ("Data3", wintypes.WORD), ("Data4", wintypes.BYTE * 8)] class WLAN_INTERFACE_INFO (ctypes.Structure): _fields_ = [('InterfaceGuid', GUID), ('strInterfaceDescription', wintypes.WCHAR * 256), ('isState', wintypes.????)] class WLAN_INTERFACE_INFO_LIST(ctypes.Structure): _fields_ = [('dwNumberOfItems', wintypes.DWORD), ('dwIndex', wintypes.DWORD), ('InterfaceInfo', WLAN_INTERFACE_INFO * 10)] IfList = WLAN_INTERFACE_INFO_LIST() pIfList = ctypes.pointer(IfList) rc = WlanApi.WlanEnumInterfaces(hClientHandle, None, pIfList) print rc print "Num Entries: %s" % IfList.dwNumberOfItems </code></pre> <p>I can't find how to structure "<a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms706877%28v=VS.85%29.aspx" rel="nofollow">WLAN_INTERFACE_STATE enumeration</a>" and when I try with a <code>WCHAR</code> array or anything else, this script return my 6000000 wireless interfaces !!!</p> <p>Can somebody help me?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload