help needed on WlanGetAvailableNetworkList''s attribute

int ScanAPs()
{
cout << "<- In ScanAPs() Function ->" << "\n";

PDOT11_SSID pDot11Ssid = NULL;
WlanScan(phClientHandle, &ppInterfaceList->InterfaceInfo[0].InterfaceGuid, NULL, NULL, NULL );

PWLAN_AVAILABLE_NETWORK_LIST pNetworkList = NULL;
WlanGetAvailableNetworkList(phClientHandle, &ppInterfaceList->InterfaceInfo[ 0 ].InterfaceGuid, 0, NULL, &pNetworkList);

cout << " Num of Networks : " << pNetworkList->dwNumberOfItems << "\n";

cout << " 0 : " << pNetworkList->Network[0].dot11Ssid.ucSSID << "\n";
cout << " 1 : " << pNetworkList->Network[1].dot11Ssid.ucSSID << "\n";
cout << " 2 : " << pNetworkList->Network[2].dot11Ssid.ucSSID << "\n";

return (0);
}

i got a scan for 4 wireless network in the " Num of Networks : 4"... but i only can get the essid for the 1st array that is " pNetworkList->Network[0].dot11Ssid.ucSSID ", and i cannot get any information for the second array information that is " pNetworkList->Network[1].dot11Ssid.ucSSID " ... can someone pls help me ?

Thanks in Advance ....

[1497 byte] By [xiukeong] at [2008-2-14]
# 1

hi i have sample which is working fine but code is in c#

[StructLayout(LayoutKind.Sequential)]

public struct WLAN_AVAILABLE_NETWORK_LIST

{

public UInt32 dwNumberOfItems;

public UInt32 dwIndex;

public WLAN_AVAILABLE_NETWORK[] Networks;

public WLAN_AVAILABLE_NETWORK_LIST(IntPtr list)

{

dwNumberOfItems = (UInt32)Marshal.ReadInt32(list, 0);

dwIndex = (UInt32)Marshal.ReadInt32(list, 4);

Networks = new WLAN_AVAILABLE_NETWORK[dwNumberOfItems];

try

{

for (int index = 0; index < dwNumberOfItems; index++)

{

Networks[index].dot11PhyTypes = new DOT11_PHY_TYPEMusic;

Networks[index].strProfileNmae = Marshal.PtrToStringUni(new IntPtr(list.ToInt32() + 8));

Networks[index].dit1Ssid = new DOT11_SSID(new IntPtr(list.ToInt32() + 520));

Networks[index].dot1BssType = (DOT11_BSS_TYPE)Marshal.ReadInt32(list, 556);

Networks[index].uNumberOfBSSID = (UInt32)Marshal.ReadInt32(list, 560);

Networks[index].bNetworkConnectable = (Marshal.ReadByte(list, 564) == 1 ? true : false);

Networks[index].WlanNotConnectableReason = (UInt32)Marshal.ReadInt32(list, 568);

Networks[index].uNumberofPhyTypes = (UInt32)Marshal.ReadInt32(list, 572);

Networks[index].dot11PhyTypes[0] = (DOT11_PHY_TYPE)Marshal.ReadInt32(list, 576);

Networks[index].dot11PhyTypes[1] = (DOT11_PHY_TYPE)Marshal.ReadInt32(list, 580);

Networks[index].dot11PhyTypes[2] = (DOT11_PHY_TYPE)Marshal.ReadInt32(list, 584);

Networks[index].dot11PhyTypes[3] = (DOT11_PHY_TYPE)Marshal.ReadInt32(list, 588);

Networks[index].dot11PhyTypes[4] = (DOT11_PHY_TYPE)Marshal.ReadInt32(list, 592);

Networks[index].dot11PhyTypes[5] = (DOT11_PHY_TYPE)Marshal.ReadInt32(list, 596);

Networks[index].dot11PhyTypesDevil = (DOT11_PHY_TYPE)Marshal.ReadInt32(list, 600);

Networks[index].dot11PhyTypes[7] = (DOT11_PHY_TYPE)Marshal.ReadInt32(list, 604);

Networks[index].bMorePhyType = (Marshal.ReadByte(list, 608) == 1 ? true : false);

Networks[index].wlanSignalQuality = (Wifi_Signal_Quality)Marshal.ReadInt32(list, 612);

Networks[index].bSecurityEnabled = (Marshal.ReadByte(list, 616) == 1 ? true : false);

Networks[index].dot11DefaultAuthAlgorithm = (DOT11_AUTH_ALGORITHM)Marshal.ReadInt32(list, 620);

Networks[index].dot11DefaultCipherAlgorithm = (DOT11_CIPHER_ALGORITHM)Marshal.ReadInt32(list, 624);

Networks[index].dwFlags = (UInt32)Marshal.ReadInt32(list, 628);

Networks[index].dwReserved = (UInt32)Marshal.ReadInt32(list, 632);

UInt32 kk = (UInt32)Marshal.ReadInt32(list, 636);

list = new IntPtr(list.ToInt32() + 632 - 4);

}

}

catch (Exception e)

{

Console.WriteLine(e.ToString());

}

}

}

hope this is helpfull to you...

sudheer1250 at 2007-10-3 > top of Msdn Tech,Windows Networking Development,Windows Vista Wireless SDK...
# 2
hey , thanks for the fast reply ...

i use the coding and methology that u provided but i still can manage to get the problem solved ...

isit the problem cause by the operating system platfrom that i use ? i am currently developing the program at Windows home

edition Service pack 2 ...

looking forward for rely ,,,, thanks iin advance ...

xiukeong at 2007-10-3 > top of Msdn Tech,Windows Networking Development,Windows Vista Wireless SDK...