ReactOS  0.4.14-dev-833-g5f692ed
wlanapi.c File Reference
#include <apitest.h>
#include <wlanapi.h>
Include dependency graph for wlanapi.c:

Go to the source code of this file.

Functions

static void WlanOpenHandle_test (void)
 
static void WlanCloseHandle_test (void)
 
static void WlanConnect_test (void)
 
static void WlanDisconnect_test (void)
 
static void WlanScan_test (void)
 
static void WlanRenameProfile_test (void)
 
static void WlanDeleteProfile_test (void)
 
static void WlanGetProfile_test (void)
 
static void WlanEnumInterfaces_test (void)
 
static void WlanGetInterfaceCapability_test (void)
 
 START_TEST (wlanapi)
 

Variables

static const GUID InterfaceGuid = {0x439b20af, 0x8955, 0x405b, {0x99, 0xf0, 0xa6, 0x2a, 0xf0, 0xc6, 0x8d, 0x43}}
 

Function Documentation

◆ START_TEST()

START_TEST ( wlanapi  )

Definition at line 221 of file wlanapi.c.

222 {
227  WlanScan_test();
233 }
static void WlanCloseHandle_test(void)
Definition: wlanapi.c:56
static void WlanGetInterfaceCapability_test(void)
Definition: wlanapi.c:202
static void WlanEnumInterfaces_test(void)
Definition: wlanapi.c:188
static void WlanRenameProfile_test(void)
Definition: wlanapi.c:132
static void WlanDisconnect_test(void)
Definition: wlanapi.c:96
static void WlanDeleteProfile_test(void)
Definition: wlanapi.c:153
static void WlanScan_test(void)
Definition: wlanapi.c:113
static void WlanGetProfile_test(void)
Definition: wlanapi.c:170
static void WlanConnect_test(void)
Definition: wlanapi.c:74
static void WlanOpenHandle_test(void)
Definition: wlanapi.c:27

◆ WlanCloseHandle_test()

static void WlanCloseHandle_test ( void  )
static

Definition at line 56 of file wlanapi.c.

57 {
58  DWORD ret;
59  HANDLE hClientHandle = (HANDLE)(ULONG_PTR)0xdeadbeefdeadbeef;
60 
61  /* invalid pReserved */
62  ret = WlanCloseHandle(hClientHandle, (PVOID) 1);
63  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
64 
65  /* invalid hClientHandle */
67  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
68 
69  /* invalid hClientHandle */
70  ret = WlanCloseHandle(hClientHandle, NULL);
71  ok(ret == ERROR_INVALID_HANDLE, "expected failure\n");
72 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
uint32_t ULONG_PTR
Definition: typedefs.h:63
smooth NULL
Definition: ftsmooth.c:416
PVOID HANDLE
Definition: typedefs.h:71
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define ok(value,...)
Definition: atltest.h:57
DWORD WINAPI WlanCloseHandle(IN HANDLE hClientHandle, PVOID pReserved)
Definition: main.c:203

Referenced by START_TEST().

◆ WlanConnect_test()

static void WlanConnect_test ( void  )
static

Definition at line 74 of file wlanapi.c.

75 {
76  DWORD ret;
77  WLAN_CONNECTION_PARAMETERS pConnectParams;
78 
79  /* invalid pReserved */
80  ret = WlanConnect((HANDLE) -1, &InterfaceGuid, &pConnectParams, (PVOID) 1);
81  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
82 
83  /* invalid InterfaceGuid */
84  ret = WlanConnect((HANDLE) -1, NULL, &pConnectParams, NULL);
85  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
86 
87  /* invalid hClientHandle */
88  ret = WlanConnect(NULL, &InterfaceGuid, &pConnectParams, NULL);
89  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
90 
91  /* invalid connection parameters */
93  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
94 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
smooth NULL
Definition: ftsmooth.c:416
BOOL WlanConnect(HANDLE hAdapter)
Definition: wlanconf.c:530
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static const GUID InterfaceGuid
Definition: wlanapi.c:25
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ WlanDeleteProfile_test()

static void WlanDeleteProfile_test ( void  )
static

Definition at line 153 of file wlanapi.c.

154 {
155  DWORD ret;
156 
157  /* invalid pReserved */
158  ret = WlanDeleteProfile((HANDLE) -1, &InterfaceGuid, L"test", (PVOID) 1);
159  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
160 
161  /* invalid InterfaceGuid */
162  ret = WlanDeleteProfile((HANDLE) -1, NULL, L"test", NULL);
163  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
164 
165  /* invalid strProfileName */
167  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
168 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static const GUID InterfaceGuid
Definition: wlanapi.c:25
static const WCHAR L[]
Definition: oid.c:1250
#define ok(value,...)
Definition: atltest.h:57
DWORD WINAPI WlanDeleteProfile(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN LPCWSTR strProfileName, PVOID pReserved)
Definition: profile.c:37

Referenced by START_TEST().

◆ WlanDisconnect_test()

static void WlanDisconnect_test ( void  )
static

Definition at line 96 of file wlanapi.c.

97 {
98  DWORD ret;
99 
100  /* invalid pReserved */
102  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
103 
104  /* invalid InterfaceGuid */
105  ret = WlanDisconnect((HANDLE) -1, NULL, NULL);
106  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
107 
108  /* invalid hClientHandle */
110  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
111 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
BOOL WlanDisconnect(HANDLE hAdapter, PIP_ADAPTER_INDEX_MAP IpInfo)
Definition: wlanconf.c:227
static const GUID InterfaceGuid
Definition: wlanapi.c:25
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ WlanEnumInterfaces_test()

static void WlanEnumInterfaces_test ( void  )
static

Definition at line 188 of file wlanapi.c.

189 {
190  DWORD ret;
191  PWLAN_INTERFACE_INFO_LIST pInterfaceList;
192 
193  /* invalid pReserved */
194  ret = WlanEnumInterfaces((HANDLE) -1, (PVOID) 1, &pInterfaceList);
195  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
196 
197  /* invalid pInterfaceList */
199  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
200 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define ok(value,...)
Definition: atltest.h:57
DWORD WINAPI WlanEnumInterfaces(IN HANDLE hClientHandle, PVOID pReserved, OUT PWLAN_INTERFACE_INFO_LIST *ppInterfaceList)
Definition: main.c:226

Referenced by START_TEST().

◆ WlanGetInterfaceCapability_test()

static void WlanGetInterfaceCapability_test ( void  )
static

Definition at line 202 of file wlanapi.c.

203 {
204  DWORD ret;
205  PWLAN_INTERFACE_CAPABILITY pInterfaceCapability;
206 
207  /* invalid pReserved */
208  ret = WlanGetInterfaceCapability((HANDLE) -1, &InterfaceGuid, (PVOID) 1, &pInterfaceCapability);
209  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
210 
211  /* invalid InterfaceGuid */
212  ret = WlanGetInterfaceCapability((HANDLE) -1, NULL, NULL, &pInterfaceCapability);
213  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
214 
215  /* invalid pInterfaceCapability */
217  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
218 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI WlanGetInterfaceCapability(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, PVOID pReserved, OUT PWLAN_INTERFACE_CAPABILITY *ppCapability)
Definition: main.c:293
int ret
static const GUID InterfaceGuid
Definition: wlanapi.c:25
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ WlanGetProfile_test()

static void WlanGetProfile_test ( void  )
static

Definition at line 170 of file wlanapi.c.

171 {
172  DWORD ret;
173  WCHAR *strProfileXml;
174 
175  /* invalid pReserved */
176  ret = WlanGetProfile((HANDLE) -1, &InterfaceGuid, L"", (PVOID) 1, &strProfileXml, NULL, NULL);
177  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
178 
179  /* invalid InterfaceGuid */
180  ret = WlanGetProfile((HANDLE) -1, NULL, L"test", NULL, &strProfileXml, NULL, NULL);
181  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
182 
183  /* invalid pstrProfileXml */
184  ret = WlanGetProfile((HANDLE) -1, &InterfaceGuid, L"test", NULL, NULL, NULL, NULL);
185  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
186 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
DWORD WINAPI WlanGetProfile(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN LPCWSTR strProfileName, PVOID pReserved, OUT LPWSTR *pstrProfileXml, DWORD *pdwFlags, PDWORD pdwGrantedAccess)
Definition: profile.c:88
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static const GUID InterfaceGuid
Definition: wlanapi.c:25
static const WCHAR L[]
Definition: oid.c:1250
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ WlanOpenHandle_test()

static void WlanOpenHandle_test ( void  )
static

Definition at line 27 of file wlanapi.c.

28 {
29  DWORD ret;
30  DWORD dwNegotiatedVersion;
31  HANDLE hClientHandle;
32 
33  /* correct call to determine if WlanSvc is running */
34  ret = WlanOpenHandle(1, NULL, &dwNegotiatedVersion, &hClientHandle);
36  {
37  skip("Skipping wlanapi tests, WlanSvc is not running\n");
38  return;
39  }
40  ok(ret == ERROR_SUCCESS, "WlanOpenHandle failed, error %ld\n", ret);
41  WlanCloseHandle(hClientHandle, NULL);
42 
43  /* invalid pdwNegotiatedVersion */
44  ret = WlanOpenHandle(1, NULL, NULL, &hClientHandle);
45  ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
46 
47  /* invalid hClientHandle */
48  ret = WlanOpenHandle(1, NULL, &dwNegotiatedVersion, NULL);
49  ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
50 
51  /* invalid pReserved */
52  ret = WlanOpenHandle(1, (PVOID) 1, &dwNegotiatedVersion, &hClientHandle);
53  ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
54 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define ERROR_SERVICE_EXISTS
Definition: winerror.h:624
#define ok(value,...)
Definition: atltest.h:57
DWORD WINAPI WlanCloseHandle(IN HANDLE hClientHandle, PVOID pReserved)
Definition: main.c:203
#define skip(...)
Definition: atltest.h:64
DWORD WINAPI WlanOpenHandle(IN DWORD dwClientVersion, PVOID pReserved, OUT DWORD *pdwNegotiatedVersion, OUT HANDLE *phClientHandle)
Definition: main.c:174

Referenced by START_TEST().

◆ WlanRenameProfile_test()

static void WlanRenameProfile_test ( void  )
static

Definition at line 132 of file wlanapi.c.

133 {
134  DWORD ret;
135 
136  /* invalid pReserved */
137  ret = WlanRenameProfile((HANDLE) -1, &InterfaceGuid, L"test", L"test1", (PVOID) 1);
138  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
139 
140  /* invalid InterfaceGuid */
141  ret = WlanRenameProfile((HANDLE) -1, NULL, L"test", L"test1", NULL);
142  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
143 
144  /* invalid strOldProfileName */
145  ret = WlanRenameProfile((HANDLE) -1, &InterfaceGuid, NULL, L"test1", NULL);
146  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
147 
148  /* invalid strNewProfileName */
149  ret = WlanRenameProfile((HANDLE) -1, &InterfaceGuid, L"test", NULL, NULL);
150  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
151 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static const GUID InterfaceGuid
Definition: wlanapi.c:25
static const WCHAR L[]
Definition: oid.c:1250
#define ok(value,...)
Definition: atltest.h:57
DWORD WINAPI WlanRenameProfile(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN LPCWSTR strOldProfileName, IN LPCWSTR strNewProfileName, PVOID pReserved)
Definition: profile.c:62

Referenced by START_TEST().

◆ WlanScan_test()

static void WlanScan_test ( void  )
static

Definition at line 113 of file wlanapi.c.

114 {
115  DWORD ret;
116  DOT11_SSID Ssid;
117  WLAN_RAW_DATA RawData;
118 
119  /* invalid pReserved */
120  ret = WlanScan((HANDLE) -1, &InterfaceGuid, &Ssid, &RawData, (PVOID) 1);
121  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
122 
123  /* invalid InterfaceGuid */
124  ret = WlanScan((HANDLE) -1, NULL, &Ssid, &RawData, NULL);
125  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
126 
127  /* invalid hClientHandle */
128  ret = WlanScan(NULL, &InterfaceGuid, &Ssid, &RawData, NULL);
129  ok(ret == ERROR_INVALID_PARAMETER, "expected failure\n");
130 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
BOOL WlanScan(HANDLE hAdapter)
Definition: wlanconf.c:700
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static const GUID InterfaceGuid
Definition: wlanapi.c:25
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

Variable Documentation

◆ InterfaceGuid