Commit 062067d8 authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

wlanapi: Implement WlanCloseHandle.

parent 8b3c6943
......@@ -35,6 +35,16 @@ static struct wine_wlan
DWORD magic, cli_version;
} handle_table[16];
static struct wine_wlan* handle_index(HANDLE handle)
{
ULONG_PTR i = (ULONG_PTR)handle - 1;
if (i < sizeof(handle_table) / sizeof(handle_table[0]) && handle_table[i].magic == WLAN_MAGIC)
return &handle_table[i];
return NULL;
}
static HANDLE handle_new(struct wine_wlan **entry)
{
ULONG_PTR i;
......@@ -59,8 +69,19 @@ DWORD WINAPI WlanEnumInterfaces(HANDLE handle, void *reserved, WLAN_INTERFACE_IN
DWORD WINAPI WlanCloseHandle(HANDLE handle, void *reserved)
{
FIXME("(%p, %p) stub\n", handle, reserved);
return ERROR_CALL_NOT_IMPLEMENTED;
struct wine_wlan *wlan;
TRACE("(%p, %p)\n", handle, reserved);
if (!handle || reserved)
return ERROR_INVALID_PARAMETER;
wlan = handle_index(handle);
if (!wlan)
return ERROR_INVALID_HANDLE;
wlan->magic = 0;
return ERROR_SUCCESS;
}
DWORD WINAPI WlanOpenHandle(DWORD client_version, void *reserved, DWORD *negotiated_version, HANDLE *handle)
......
......@@ -71,7 +71,6 @@ static void test_WlanOpenHandle(void)
ok(neg_version == 1, "Expected 1, got %d\n", neg_version);
ok(handle != bad_handle && handle, "handle changed\n");
ret = WlanCloseHandle(handle, NULL);
todo_wine
ok(ret == 0, "Expected 0, got %d\n", ret);
ret = WlanOpenHandle(2, NULL, &neg_version, &handle);
......@@ -82,7 +81,6 @@ todo_wine
ok(neg_version == 1, "Expected 1, got %d\n", neg_version);
ok(handle != bad_handle && handle, "bad handle\n");
ret = WlanCloseHandle(handle, NULL);
todo_wine
ok(ret == 0, "Expected 0, got %d\n", ret);
/* open twice */
......@@ -91,15 +89,19 @@ todo_wine
ret = WlanOpenHandle(1, NULL, &neg_version, &handle2);
ok(ret == ERROR_SUCCESS, "Expected 0, got %d\n", ret);
todo_wine {
ret = WlanCloseHandle(handle, &reserved);
ok(ret == ERROR_INVALID_PARAMETER, "Expected 87, got %d\n", ret);
ret = WlanCloseHandle(handle, NULL);
ok(ret == ERROR_SUCCESS, "Expected 0, got %d\n", ret);
ret = WlanCloseHandle(handle2, NULL);
ok(ret == ERROR_SUCCESS, "Expected 0, got %d\n", ret);
ret = WlanCloseHandle(bad_handle, NULL);
ok(ret == ERROR_INVALID_HANDLE, "Expected 6, got %d\n", ret);
ret = WlanCloseHandle(NULL, NULL);
ok(ret == ERROR_INVALID_PARAMETER, "Expected 0, got %d\n", ret);
}
ok(ret == ERROR_INVALID_PARAMETER, "Expected 87, got %d\n", ret);
}
static void test_WlanAllocateFreeMemory(void)
......
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