Commit 4371e1c5 authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

wlanapi/tests: Add tests for WlanOpenHandle.

Manually tested on XP and Windows 8 with real wireless card. Signed-off-by: 's avatarBruno Jesus <00cpxxx@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 3052c700
......@@ -24,6 +24,76 @@
#include "wine/test.h"
static void test_WlanOpenHandle(void)
{
HANDLE bad_handle = (HANDLE) 0xdeadcafe, handle = bad_handle;
DWORD ret, neg_version = 0xdeadbeef, reserved = 0xdead;
BOOL is_xp;
/* invalid version requested */
ret = WlanOpenHandle(0, NULL, &neg_version, &handle);
is_xp = ret == ERROR_SUCCESS;
if (!is_xp) /* the results in XP differ completely from all other versions */
{
todo_wine
ok(ret == ERROR_NOT_SUPPORTED, "Expected 50, got %d\n", ret);
ok(neg_version == 0xdeadbeef, "neg_vesion changed\n");
ok(handle == bad_handle, "handle changed\n");
ret = WlanOpenHandle(10, NULL, &neg_version, &handle);
todo_wine
ok(ret == ERROR_NOT_SUPPORTED, "Expected 50, got %d\n", ret);
ok(neg_version == 0xdeadbeef, "neg_vesion changed\n");
ok(handle == bad_handle, "handle changed\n");
/* reserved parameter must not be used */
ret = WlanOpenHandle(1, &reserved, &neg_version, &handle);
todo_wine
ok(ret == ERROR_INVALID_PARAMETER, "Expected 87, got %d\n", ret);
ok(neg_version == 0xdeadbeef, "neg_vesion changed\n");
ok(handle == bad_handle, "handle changed\n");
/* invalid parameters */
ret = WlanOpenHandle(1, NULL, NULL, &handle);
todo_wine
ok(ret == ERROR_INVALID_PARAMETER, "Expected 87, got %d\n", ret);
ok(handle == bad_handle, "bad handle\n");
ret = WlanOpenHandle(1, NULL, &neg_version, NULL);
todo_wine
ok(ret == ERROR_INVALID_PARAMETER, "Expected 87, got %d\n", ret);
ok(neg_version == 0xdeadbeef, "neg_vesion changed\n");
}
else
{
ok(neg_version == 1, "Expected 1, got %d\n", neg_version);
ok(handle != bad_handle && handle, "handle changed\n");
ret = WlanCloseHandle(handle, NULL);
ok(ret == 0, "Expected 0, got %d\n", ret);
}
/* good tests */
todo_wine {
ret = WlanOpenHandle(1, NULL, &neg_version, &handle);
ok(ret == ERROR_SUCCESS, "Expected 0, got %d\n", ret);
ok(neg_version == 1, "Expected 1, got %d\n", neg_version);
ok(handle != bad_handle && handle, "handle changed\n");
ret = WlanCloseHandle(handle, NULL);
ok(ret == 0, "Expected 0, got %d\n", ret);
ret = WlanOpenHandle(2, NULL, &neg_version, &handle);
ok(ret == ERROR_SUCCESS, "Expected 0, got %d\n", ret);
if (!is_xp) /* XP does not support client version 2 */
ok(neg_version == 2, "Expected 2, got %d\n", neg_version);
else
ok(neg_version == 1, "Expected 1, got %d\n", neg_version);
ok(handle != bad_handle && handle, "bad handle\n");
ret = WlanCloseHandle(handle, NULL);
ok(ret == 0, "Expected 0, got %d\n", ret);
ret = WlanCloseHandle(NULL, NULL);
ok(ret == ERROR_INVALID_PARAMETER, "Expected 0, got %d\n", ret);
}
}
START_TEST(wlanapi)
{
HANDLE handle;
......@@ -36,4 +106,6 @@ START_TEST(wlanapi)
win_skip("No wireless service running\n");
return;
}
test_WlanOpenHandle();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment