From: Vibhav Pant vibhavp@gmail.com
--- dlls/wlanapi/tests/wlanapi.c | 77 ++++++++++++++++++++++++++++++++++++ include/wlanapi.h | 32 +++++++++++++++ 2 files changed, 109 insertions(+)
diff --git a/dlls/wlanapi/tests/wlanapi.c b/dlls/wlanapi/tests/wlanapi.c index 647a0a8ea10..6d8d7808a26 100644 --- a/dlls/wlanapi/tests/wlanapi.c +++ b/dlls/wlanapi/tests/wlanapi.c @@ -263,6 +263,82 @@ static void test_WlanGetAvailableNetworkList( void ) ok( ret == 0, "Expected 0, got %ld\n", ret ); }
+static void test_WlanGetNetworkBssList( void ) +{ + HANDLE handle; + DWORD neg_version, i, ret, reserved = 0xdeadbeef; + WLAN_INTERFACE_INFO_LIST *ifaces; + + ret = WlanOpenHandle(1, NULL, &neg_version, &handle); + ok(ret == 0, "Expected 0, got %ld\n", ret); + + ret = WlanEnumInterfaces( handle, NULL, &ifaces ); + ok( ret == ERROR_SUCCESS, "Expected 0, got %ld\n", ret); + if (!ifaces || !ifaces->dwNumberOfItems) + { + skip( "No wireless interfaces\n" ); + WlanCloseHandle( handle, NULL ); + WlanFreeMemory( ifaces ); + return; + } + + trace("Wireless interfaces: %ld\n", ifaces->dwNumberOfItems); + + for (i = 0; i < ifaces->dwNumberOfItems; i++) + { + WLAN_INTERFACE_INFO *info; + WLAN_BSS_LIST *bad_list = (WLAN_BSS_LIST *)0xdeadbeef, *list = bad_list; + DWORD j; + + info = &ifaces->InterfaceInfo[i]; + trace( " Index[%ld] GUID: %s\n", i, debugstr_guid( &info->InterfaceGuid ) ); + + /* invalid parameters */ + ret = WlanGetNetworkBssList( NULL, NULL, NULL, 0, FALSE, NULL, NULL ); + todo_wine ok( ret == ERROR_INVALID_PARAMETER, "Expected 87, got %ld\n", ret ); + todo_wine ok( list == bad_list, "list changed\n" ); + ret = WlanGetNetworkBssList( handle, &info->InterfaceGuid, NULL, 0, FALSE, NULL, NULL ); + todo_wine ok( ret == ERROR_INVALID_PARAMETER, "Expected 87, got %ld\n", ret ); + todo_wine ok( list == bad_list, "list changed\n" ); + ret = WlanGetNetworkBssList( handle, &info->InterfaceGuid, NULL, 0, FALSE, NULL, NULL ); + todo_wine ok( ret == ERROR_INVALID_PARAMETER, "Expected 87, got %ld\n", ret ); + todo_wine ok( list == bad_list, "list changed\n" ); + ret = + WlanGetNetworkBssList( handle, &info->InterfaceGuid, NULL, 0, FALSE, &reserved, &list ); + todo_wine ok( ret == ERROR_INVALID_PARAMETER, "Expected 87, got %ld\n", ret ); + todo_wine ok( list == bad_list, "list changed\n" ); + + /* valid paramters */ + ret = WlanGetNetworkBssList( handle, &info->InterfaceGuid, NULL, 0, FALSE, NULL, &list ); + todo_wine ok( ret == ERROR_SUCCESS, "Expected 0, got %ld\n", ret); + if (!list || !list->dwNumberOfItems) + { + skip( "No wireless networks\n" ); + WlanFreeMemory( list ); + continue; + } + + for (j = 0; j < list->dwNumberOfItems; j++) + { + WLAN_BSS_ENTRY *entry = &list->wlanBssEntries[j]; + + todo_wine ok( entry->dot11Ssid.uSSIDLength <= sizeof( entry->dot11Ssid.ucSSID ), + "Unexpected length for uSSID, should be <= 32: %ld\n", + entry->dot11Ssid.uSSIDLength ); + + trace( + " Index[%ld] SSID: %s\n", j, + debugstr_an( (char *)entry->dot11Ssid.ucSSID, entry->dot11Ssid.uSSIDLength ) ); + } + + WlanFreeMemory( list ); + } + + WlanFreeMemory( ifaces ); + ret = WlanCloseHandle( handle, NULL ); + ok( ret == 0, "Expected 0, got %ld\n", ret ); +} + START_TEST(wlanapi) { HANDLE handle; @@ -280,4 +356,5 @@ START_TEST(wlanapi) test_WlanAllocateFreeMemory(); test_WlanEnumInterfaces(); test_WlanGetAvailableNetworkList(); + test_WlanGetNetworkBssList(); } diff --git a/include/wlanapi.h b/include/wlanapi.h index 0db5c5e8899..5a738f05730 100644 --- a/include/wlanapi.h +++ b/include/wlanapi.h @@ -135,6 +135,38 @@ typedef struct _WLAN_AVAILABLE_NETWORK DWORD dwReserved; } WLAN_AVAILABLE_NETWORK, *PWLAN_AVAILABLE_NETWORK;
+typedef struct _WLAN_RATE_SET { + ULONG uRateSetLength; + USHORT usRateSet[DOT11_RATE_SET_MAX_LENGTH]; +} WLAN_RATE_SET, *PWLAN_RATE_SET; + +typedef struct _WLAN_BSS_ENTRY +{ + DOT11_SSID dot11Ssid; + ULONG uPhyId; + DOT11_MAC_ADDRESS dot11Bssid; + DOT11_BSS_TYPE dot11BssType; + DOT11_PHY_TYPE dot11BssPhyType; + LONG lRssi; + ULONG uLinkQuality; + BOOLEAN bInRegDomain; + USHORT usBeaconPeriod; + ULONGLONG ullTimestamp; + ULONGLONG ullHostTimestamp; + USHORT usCapabilityInformation; + ULONG ulChCenterFrequency; + WLAN_RATE_SET wlanRateSet; + ULONG ulIeOffset; + ULONG ulIeSize; +} WLAN_BSS_ENTRY, *PWLAN_BSS_ENTRY; + +typedef struct _WLAN_BSS_LIST +{ + DWORD dwTotalSize; + DWORD dwNumberOfItems; + WLAN_BSS_ENTRY wlanBssEntries[1]; +} WLAN_BSS_LIST, *PWLAN_BSS_LIST; + typedef enum _WLAN_INTF_OPCODE { wlan_intf_opcode_autoconf_start = 0x000000000,