Something went wrong. Try again.
Reactos
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234/* * Wlanapi - tests * * Copyright 2009 Christoph von Wittich * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
#include <apitest.h>
#include <wlanapi.h>
static const GUID InterfaceGuid = {0x439b20af, 0x8955, 0x405b, {0x99, 0xf0, 0xa6, 0x2a, 0xf0, 0xc6, 0x8d, 0x43}};
static void WlanOpenHandle_test(void){ DWORD ret; DWORD dwNegotiatedVersion; HANDLE hClientHandle;
/* correct call to determine if WlanSvc is running */ ret = WlanOpenHandle(1, NULL, &dwNegotiatedVersion, &hClientHandle); if (ret == ERROR_SERVICE_EXISTS) { skip("Skipping wlanapi tests, WlanSvc is not running\n"); return; } ok(ret == ERROR_SUCCESS, "WlanOpenHandle failed, error %ld\n", ret); WlanCloseHandle(hClientHandle, NULL);
/* invalid pdwNegotiatedVersion */ ret = WlanOpenHandle(1, NULL, NULL, &hClientHandle); ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
/* invalid hClientHandle */ ret = WlanOpenHandle(1, NULL, &dwNegotiatedVersion, NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
/* invalid pReserved */ ret = WlanOpenHandle(1, (PVOID) 1, &dwNegotiatedVersion, &hClientHandle); ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());}
static void WlanCloseHandle_test(void){ DWORD ret; HANDLE hClientHandle = (HANDLE)(ULONG_PTR)0xdeadbeefdeadbeef;
/* invalid pReserved */ ret = WlanCloseHandle(hClientHandle, (PVOID) 1); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid hClientHandle */ ret = WlanCloseHandle(NULL, NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid hClientHandle */ ret = WlanCloseHandle(hClientHandle, NULL); ok(ret == ERROR_INVALID_HANDLE, "expected failure\n");}
static void WlanConnect_test(void){ DWORD ret; WLAN_CONNECTION_PARAMETERS pConnectParams;
/* invalid pReserved */ ret = WlanConnect((HANDLE) -1, &InterfaceGuid, &pConnectParams, (PVOID) 1); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid InterfaceGuid */ ret = WlanConnect((HANDLE) -1, NULL, &pConnectParams, NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid hClientHandle */ ret = WlanConnect(NULL, &InterfaceGuid, &pConnectParams, NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid connection parameters */ ret = WlanConnect((HANDLE) -1, &InterfaceGuid, NULL, NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");}
static void WlanDisconnect_test(void){ DWORD ret;
/* invalid pReserved */ ret = WlanDisconnect((HANDLE) -1, &InterfaceGuid, (PVOID) 1); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid InterfaceGuid */ ret = WlanDisconnect((HANDLE) -1, NULL, NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid hClientHandle */ ret = WlanDisconnect(NULL, &InterfaceGuid, NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");}
static void WlanScan_test(void){ DWORD ret; DOT11_SSID Ssid; WLAN_RAW_DATA RawData;
/* invalid pReserved */ ret = WlanScan((HANDLE) -1, &InterfaceGuid, &Ssid, &RawData, (PVOID) 1); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid InterfaceGuid */ ret = WlanScan((HANDLE) -1, NULL, &Ssid, &RawData, NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid hClientHandle */ ret = WlanScan(NULL, &InterfaceGuid, &Ssid, &RawData, NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");}
static void WlanRenameProfile_test(void){ DWORD ret;
/* invalid pReserved */ ret = WlanRenameProfile((HANDLE) -1, &InterfaceGuid, L"test", L"test1", (PVOID) 1); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid InterfaceGuid */ ret = WlanRenameProfile((HANDLE) -1, NULL, L"test", L"test1", NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid strOldProfileName */ ret = WlanRenameProfile((HANDLE) -1, &InterfaceGuid, NULL, L"test1", NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid strNewProfileName */ ret = WlanRenameProfile((HANDLE) -1, &InterfaceGuid, L"test", NULL, NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");}
static void WlanDeleteProfile_test(void){ DWORD ret;
/* invalid pReserved */ ret = WlanDeleteProfile((HANDLE) -1, &InterfaceGuid, L"test", (PVOID) 1); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid InterfaceGuid */ ret = WlanDeleteProfile((HANDLE) -1, NULL, L"test", NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid strProfileName */ ret = WlanDeleteProfile((HANDLE) -1, &InterfaceGuid, NULL, NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");}
static void WlanGetProfile_test(void){ DWORD ret; WCHAR *strProfileXml;
/* invalid pReserved */ ret = WlanGetProfile((HANDLE) -1, &InterfaceGuid, L"", (PVOID) 1, &strProfileXml, NULL, NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid InterfaceGuid */ ret = WlanGetProfile((HANDLE) -1, NULL, L"test", NULL, &strProfileXml, NULL, NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid pstrProfileXml */ ret = WlanGetProfile((HANDLE) -1, &InterfaceGuid, L"test", NULL, NULL, NULL, NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");}
static void WlanEnumInterfaces_test(void){ DWORD ret; PWLAN_INTERFACE_INFO_LIST pInterfaceList;
/* invalid pReserved */ ret = WlanEnumInterfaces((HANDLE) -1, (PVOID) 1, &pInterfaceList); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid pInterfaceList */ ret = WlanEnumInterfaces((HANDLE) -1, NULL, NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");}
static void WlanGetInterfaceCapability_test(void){ DWORD ret; PWLAN_INTERFACE_CAPABILITY pInterfaceCapability;
/* invalid pReserved */ ret = WlanGetInterfaceCapability((HANDLE) -1, &InterfaceGuid, (PVOID) 1, &pInterfaceCapability); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid InterfaceGuid */ ret = WlanGetInterfaceCapability((HANDLE) -1, NULL, NULL, &pInterfaceCapability); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
/* invalid pInterfaceCapability */ ret = WlanGetInterfaceCapability((HANDLE) -1, &InterfaceGuid, NULL, NULL); ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");}
START_TEST(wlanapi){ WlanOpenHandle_test(); WlanCloseHandle_test(); WlanConnect_test(); WlanDisconnect_test(); WlanScan_test(); WlanRenameProfile_test(); WlanDeleteProfile_test(); WlanGetProfile_test(); WlanEnumInterfaces_test(); WlanGetInterfaceCapability_test();}