reactos/rostests/winetests/wlanapi/wlanapi.c
Christoph von Wittich 71362c59fd more precise error descriptions
svn path=/trunk/; revision=40059
2009-03-16 13:39:03 +00:00

83 lines
2.6 KiB
C

/*
* 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 <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "wlanapi.h"
#include "wine/test.h"
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 %d\n", ret);
WlanCloseHandle(hClientHandle, NULL);
/* invalid pdwNegotiatedVersion */
ret = WlanOpenHandle(1, NULL, NULL, &hClientHandle);
ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
/* invalid hClientHandle */
ret = WlanOpenHandle(1, NULL, &dwNegotiatedVersion, NULL);
ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
/* invalid pReserved */
ret = WlanOpenHandle(1, (PVOID) 1, &dwNegotiatedVersion, &hClientHandle);
ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
}
static void WlanCloseHandle_test(void)
{
DWORD ret;
HANDLE hClientHandle = (HANDLE) 0xdeadbeef;
/* 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");
}
START_TEST(wlanapi)
{
WlanOpenHandle_test();
WlanCloseHandle_test();
}