WlanGetAvailableNetworkList2 function

Retrieves the list of available networks on a wireless LAN interface.

Syntax

DWORD WINAPI WlanGetAvailableNetworkList2(
  _In_             HANDLE                          hClientHandle,
  _In_       const GUID                            *pInterfaceGuid,
  _In_             DWORD                           dwFlags,
  _Reserved_       PVOID                           pReserved,
  _Out_            PWLAN_AVAILABLE_NETWORK_LIST_V2 *ppAvailableNetworkList
);

Parameters

  • hClientHandle [in]
    The client's session handle, obtained by a previous call to the WlanOpenHandle function.

  • pInterfaceGuid [in]
    A pointer to the GUID of the wireless LAN interface to be queried.

    The GUID of each wireless LAN interface enabled on a local computer can be determined using the WlanEnumInterfaces function.

  • dwFlags [in]
    A set of flags that control the type of networks returned in the list. This parameter can be a combination of these possible values.

    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. This parameter must be set to NULL.

  • ppAvailableNetworkList [out]
    A pointer to storage for a pointer to receive the returned list of visible networks in a WLAN_AVAILABLE_NETWORK_LIST_V2 structure.

    The buffer for the WLAN_AVAILABLE_NETWORK_LIST_V2 returned is allocated by the WlanGetAvailableNetworkList2 function if the call succeeds.

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

A parameter is incorrect. This error is returned if the hClientHandle, pInterfaceGuid, or ppAvailableNetworkList parameter is NULL. This error is returned if the pReserved is not NULL. This error is also returned if the dwFlags parameter value is set to value that is not valid or the hClientHandle parameter is not valid.

ERROR_INVALID_HANDLE

The handle hClientHandle was not found in the handle table.

ERROR_NDIS_DOT11_POWER_STATE_INVALID

The radio associated with the interface is turned off. There are no available networks when the radio is off.

RPC_STATUS

Various error codes.

ERROR_NOT_ENOUGH_MEMORY

Not enough memory is available to process this request and allocate memory for the query results.

 

Remarks

The WlanGetAvailableNetworkList2 function allocates memory for the list of available networks returned in the buffer pointed to by the ppAvailableNetworkList parameter when the function succeeds. The memory used for the buffer pointed to by ppAvailableNetworkList parameter should be released by calling the WlanFreeMemory function after the buffer is no longer needed.

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 WlanGetAvailableNetworkList2 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 https://go.microsoft.com/fwlink/p/?linkid=102216.

Requirements

Minimum supported client

Windows 10

Minimum supported server

Windows Server 2016 Technical Preview [desktop apps only]

Header

Wlanapi.h (include Wlanapi.h)

Library

Wlanapi.lib

DLL

Wlanapi.dll

See also

WLAN_AVAILABLE_NETWORK_V2

WLAN_AVAILABLE_NETWORK_LIST_V2

WLAN_BSS_ENTRY

WLAN_BSS_LIST

WlanEnumInterfaces

WlanFreeMemory

WlanGetNetworkBssList

WlanScan

WlanGetAvailableNetworkList