The WlanGetAvailableNetworkList function retrieves the list of available networks on an interface.
Syntax
DWORD WINAPI WlanGetAvailableNetworkList(
__in HANDLE hClientHandle,
__in const GUID *pInterfaceGuid,
__in DWORD dwFlags,
__reserved PVOID pReserved,
__out PWLAN_AVAILABLE_NETWORK_LIST *ppAvailableNetworkList
);
Parameters
- hClientHandle [in]
-
The client's session handle, obtained by a previous call to the WlanOpenHandle function.
- pInterfaceGuid [in]
-
The GUID of the interface to be queried.
- dwFlags [in]
-
Controls the type of networks returned in the list.
| Value | Meaning |
- WLAN_AVAILABLE_NETWORK_INCLUDE_ALL_ADHOC_PROFILES
- 0x00000001
| Include all ad-hoc network profiles in the available network list, including profiles that are not visible.
|
- WLAN_AVAILABLE_NETWORK_INCLUDE_ALL_MANUAL_HIDDEN_PROFILES
- 0x00000002
| Include all hidden network profiles in the available network list, including profiles that are not visible.
|
- pReserved
-
Reserved for future use. Must be set to NULL.
- ppAvailableNetworkList [out]
-
Pointer to a WLAN_AVAILABLE_NETWORK_LIST to receive the returned list of visible networks.
Return Value
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value may be one of the following return codes.
| Return code | Description |
- ERROR_INVALID_PARAMETER
| hClientHandle is NULL or invalid, pInterfaceGuid is NULL, pReserved is not NULL, ppAvailableNetworkList is NULL, or the dwFlags parameter value is not set to one of the specified values.
|
- ERROR_INVALID_HANDLE
| The handle hClientHandle was not found in the handle table.
|
- ERROR_NDIS_DOT11_POWER_STATE_INVALID
| The radio for the interface is turned off. There are no available networks when the radio is off.
|
- RPC_STATUS
| Various error codes.
|
- ERROR_NOT_ENOUGH_MEMORY
| Failed to allocate memory for the query results.
|
Remarks
This function will allocate memory for the list of returned interfaces. The caller is responsible for freeing this memory using the WlanFreeMemory function.
There is a hotfix available for Wireless LAN API for Windows XP with Service Pack 2 (SP2) that can help improve the performance of applications that call WlanFreeMemory and WlanGetAvailableNetworkList many times. For more information, see Help and Knowledge Base article 940541, entitled "FIX: The private bytes of the application continuously increase when an application calls the WlanGetAvailableNetworkList function and the WlanFreeMemory function on a Windows XP Service Pack 2-based computer", in the Help and Support Knowledge Base at http://go.microsoft.com/fwlink/?LinkId=102216.
Requirements
| Minimum supported client | Windows Vista, Windows XP with SP3 |
| Minimum supported server | Windows Server 2008 |
| Redistributable | Wireless LAN API for Windows XP with SP2 |
| Header | Wlanapi.h (include Wlanapi.h) |
| Library | Wlanapi.lib |
| DLL | Wlanapi.dll |
Send comments about this topic to Microsoft
Build date: 7/9/2009