Odd return from WlanEnumInterfaces (Windows Native WiFi) in Java -


I'm trying to map Windows Native WiFi APIs in Java, but I'm having problems with the WlanEnumInterfaces function is. In fact, this function contains the WLAN_INTERFACE_INFO_LIST structure with an array of WLAN_INTERFACE_INFO structures. When I say WlanEnumInterfaces in my Java program, the display indicates its return value that succeeds, but when I check the number of items in the WLAN_INTERFACE_INFO array, I think this value should be 1 i just as zodiac as 1,367,280 or 4000000. Incompatible Receive the values ​​on my machine a wireless interface Here it is the mapping of the WlanEnumInterfaces function:

  Public Ink WlanEnum Interface (Handle H Client Handle, PointerBerrancePRSServed, WLAN_INTERFACE_INFO_LIST.ByReference ppInterfaceList); Implementation of WLAN_INTERFACE_INFO_LIST:  
  Expands public static class WLAN_INTERFACE_INFO_LIST structure {Public static class biorerance WLAN_INTERFACE_INFO_LIST is applicable. Beerfront {} Public Int dwNumberOfItems; Public full dwIndex; Public WLAN_INTERFACE_INFO [] InterfaceInfo = New WLAN_INTERFACE_INFO [10]; @Override Protected List getFieldOrder () {Return Arrays.asList (New String [] {"dwNumberOfItems", "dwIndex", "InterfaceInfo"}); }}  

and the part of the code that calls the function:

  handle wlanHandle = getWlanHandle (); WLAN_INTERFACE_INFO_LIST Bivernial PP interfaceslist = newWLAN_INTERFACE_INFO_LIST. Beverage (); Int rate = Wlanapi.INSTANCE.WlanEnum interface (wlanHandle, Null, ppInterfaceList); System.out.println ("Return:" + Rate); System.out.println ("WlanEnumInterfaces-> Number of Items:" + ppInterfaceList.dwNumberOfItems); Do anyone know what's going on? Thanks!  

"itemprop =" text ">

WlanEnumInterfaces fills the area with a address you provide it to a composition Instead of address address, you are passing through the address of struct.

Use PointerByReference to get the address of the struct, for example

  Pointerbearer reference pref = new pointerfire (); Wlanapi.INSTANCE.WlanEnum interface (handle, blank, pref); WLAN_INTERFACE_INFO_LIST list = newWLAN_INTERFACE_INFO_LIST (pref.getValue ());  

You then need a manufacturer based for pointer for the WLAN_INTERFACE_INFO_LIST , i.e.

  WLAN_INTERFACE_INFO_LIST (Pointer P) {Super (P); This.dwNumberOfItems = p.readInt (0); This.InterfaceInfo = New WLAN_INTERFACE_INFO [this.dwNumberOfItems]; Read (); }  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -