WlanSetFilterList function (wlanapi.h)
The WlanSetFilterList function sets the permit/deny list.
Syntax
DWORD WlanSetFilterList(
[in] HANDLE hClientHandle,
[in] WLAN_FILTER_LIST_TYPE wlanFilterListType,
[in, optional] const PDOT11_NETWORK_LIST pNetworkList,
PVOID pReserved
);
Parameters
[in] hClientHandle
The client's session handle, obtained by a previous call to the WlanOpenHandle function.
[in] wlanFilterListType
A WLAN_FILTER_LIST_TYPE value that specifies the type of filter list. The value must be either wlan_filter_list_type_user_permit or wlan_filter_list_type_user_deny. Group policy-defined lists cannot be set using this function.
[in, optional] pNetworkList
Pointer to a DOT11_NETWORK_LIST structure that contains the list of networks to permit or deny. The dwIndex member of the structure must have a value less than the value of the dwNumberOfItems member of the structure; otherwise, an access violation may occur.
pReserved
Reserved for future use. Must be set to NULL.
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 |
---|---|
|
The caller does not have sufficient permissions to set the filter list.
When called with wlanFilterListType set to wlan_filter_list_type_user_permit, WlanSetFilterList retrieves the discretionary access control list (DACL) stored with the wlan_secure_permit_list object. When called with wlanFilterListType set to wlan_filter_list_type_user_deny, WlanSetFilterList retrieves the DACL stored with the wlan_secure_deny_list object. In either of these cases, if the DACL does not contain an access control entry (ACE) that grants WLAN_WRITE_ACCESS permission to the access token of the calling thread, then WlanSetFilterList returns ERROR_ACCESS_DENIED. |
|
hClientHandle is NULL or invalid or pReserved is not NULL. |
|
The handle hClientHandle was not found in the handle table. |
|
This function was called from an unsupported platform. This value will be returned if this function was called from a Windows XP with SP3 or Wireless LAN API for Windows XP with SP2 client. |
|
Various error codes. |
Remarks
The group policy permit and deny lists take precedence over the user's permit and deny lists. That means access to a network on the user's permit list will be denied if the network appears on the group policy deny list. Similarly, access to a network on the user's deny list will be permitted if the network appears on the group policy permit list. Networks that are not on a user list or a group policy list will be permitted.
Denied networks cannot be connected by means of auto config and will not be included on the visible networks list. New user permit and deny lists overwrite previous versions of the user lists.
To clear a filter list, set the pNetworkList parameter to NULL, or pass a pointer to a DOT11_NETWORK_LIST structure that has the dwNumberOfItems member set to 0.
To add all SSIDs to a filter list, pass a pointer to a DOT11_NETWORK_LIST structure with an associated DOT11_NETWORK structure that has the uSSIDLength member of its DOT11_SSID structure set to 0.
To add all BSS types to a filter list, pass a pointer to a DOT11_NETWORK_LIST with an associated DOT11_NETWORK structure that has its dot11BssType member set to dot11_BSS_type_any.
The netsh wlan add filter and netsh wlan delete filter commands provide similar functionality at the command line. For more information, see Netsh Commands for Wireless Local Area Network (wlan).
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2008 [desktop apps only] |
Target Platform | Windows |
Header | wlanapi.h (include Wlanapi.h) |
Library | Wlanapi.lib |
DLL | Wlanapi.dll |