diff --git a/.gitignore b/.gitignore index 766d4d5125f..05ffba66dd0 100644 --- a/.gitignore +++ b/.gitignore @@ -311,6 +311,7 @@ programs/winetest/psapi_test.exe programs/winetest/qedit_test.exe programs/winetest/qmgr_test.exe programs/winetest/quartz_test.exe +programs/winetest/rasapi32_test.exe programs/winetest/riched20_test.exe programs/winetest/riched32_test.exe programs/winetest/rpcrt4_test.exe diff --git a/Makefile.in b/Makefile.in index 7ad6faa210f..1b35079cd99 100644 --- a/Makefile.in +++ b/Makefile.in @@ -407,6 +407,7 @@ ALL_MAKEFILES = \ dlls/quartz/tests/Makefile \ dlls/query/Makefile \ dlls/rasapi32/Makefile \ + dlls/rasapi32/tests/Makefile \ dlls/resutils/Makefile \ dlls/riched20/Makefile \ dlls/riched20/tests/Makefile \ @@ -835,6 +836,7 @@ dlls/quartz/Makefile: dlls/quartz/Makefile.in dlls/Makedll.rules dlls/quartz/tests/Makefile: dlls/quartz/tests/Makefile.in dlls/Maketest.rules dlls/query/Makefile: dlls/query/Makefile.in dlls/Makedll.rules dlls/rasapi32/Makefile: dlls/rasapi32/Makefile.in dlls/Makedll.rules +dlls/rasapi32/tests/Makefile: dlls/rasapi32/tests/Makefile.in dlls/Maketest.rules dlls/resutils/Makefile: dlls/resutils/Makefile.in dlls/Makedll.rules dlls/riched20/Makefile: dlls/riched20/Makefile.in dlls/Makedll.rules dlls/riched20/tests/Makefile: dlls/riched20/tests/Makefile.in dlls/Maketest.rules diff --git a/configure b/configure index 039597bc0e6..257dfeb662e 100755 --- a/configure +++ b/configure @@ -22183,6 +22183,8 @@ ac_config_files="$ac_config_files dlls/query/Makefile" ac_config_files="$ac_config_files dlls/rasapi32/Makefile" +ac_config_files="$ac_config_files dlls/rasapi32/tests/Makefile" + ac_config_files="$ac_config_files dlls/resutils/Makefile" ac_config_files="$ac_config_files dlls/riched20/Makefile" @@ -23334,6 +23336,7 @@ do "dlls/quartz/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/quartz/tests/Makefile" ;; "dlls/query/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/query/Makefile" ;; "dlls/rasapi32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/rasapi32/Makefile" ;; + "dlls/rasapi32/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/rasapi32/tests/Makefile" ;; "dlls/resutils/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/resutils/Makefile" ;; "dlls/riched20/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/riched20/Makefile" ;; "dlls/riched20/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/riched20/tests/Makefile" ;; diff --git a/configure.ac b/configure.ac index bd764a350d4..fa925b101ef 100644 --- a/configure.ac +++ b/configure.ac @@ -1947,6 +1947,7 @@ AC_CONFIG_FILES([dlls/quartz/Makefile]) AC_CONFIG_FILES([dlls/quartz/tests/Makefile]) AC_CONFIG_FILES([dlls/query/Makefile]) AC_CONFIG_FILES([dlls/rasapi32/Makefile]) +AC_CONFIG_FILES([dlls/rasapi32/tests/Makefile]) AC_CONFIG_FILES([dlls/resutils/Makefile]) AC_CONFIG_FILES([dlls/riched20/Makefile]) AC_CONFIG_FILES([dlls/riched20/tests/Makefile]) diff --git a/dlls/Makefile.in b/dlls/Makefile.in index 92919fa2f94..d130f357778 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -342,6 +342,7 @@ TESTSUBDIRS = \ qedit/tests \ qmgr/tests \ quartz/tests \ + rasapi32/tests \ riched20/tests \ riched32/tests \ rpcrt4/tests \ diff --git a/dlls/rasapi32/rasapi.c b/dlls/rasapi32/rasapi.c index 0977ffe2f4e..2ba62e97cdb 100644 --- a/dlls/rasapi32/rasapi.c +++ b/dlls/rasapi32/rasapi.c @@ -245,6 +245,9 @@ DWORD WINAPI RasEnumAutodialAddressesW(LPWSTR *a, LPDWORD b, LPDWORD c) */ DWORD WINAPI RasEnumDevicesA(LPRASDEVINFOA lpRasDevinfo, LPDWORD lpcb, LPDWORD lpcDevices) { + if (!lpcb || !lpcDevices) + return ERROR_INVALID_PARAMETER; + FIXME("(%p,%p,%p),stub!\n",lpRasDevinfo,lpcb,lpcDevices); if (*lpcb < sizeof(RASDEVINFOA)) { *lpcb = sizeof(RASDEVINFOA); diff --git a/dlls/rasapi32/tests/Makefile.in b/dlls/rasapi32/tests/Makefile.in new file mode 100644 index 00000000000..c6f079acb55 --- /dev/null +++ b/dlls/rasapi32/tests/Makefile.in @@ -0,0 +1,13 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +TESTDLL = rasapi32.dll +IMPORTS = kernel32 + +CTESTS = \ + rasapi.c + +@MAKE_TEST_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/rasapi32/tests/rasapi.c b/dlls/rasapi32/tests/rasapi.c new file mode 100644 index 00000000000..a4351804bc7 --- /dev/null +++ b/dlls/rasapi32/tests/rasapi.c @@ -0,0 +1,71 @@ +/* +* Unit test suite for rasapi32 functions +* +* Copyright 2008 Austin English +* +* 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 +#include +#include +#include +#include +#include "ras.h" + +static HMODULE hmodule; +static DWORD (WINAPI *pRasEnumDevicesA)(LPRASDEVINFOA, LPDWORD, LPDWORD); + +#define RASAPI32_GET_PROC(func) \ + p ## func = (void*)GetProcAddress(hmodule, #func); \ + if(!p ## func) \ + trace("GetProcAddress(%s) failed\n", #func); + +static void InitFunctionPtrs(void) +{ + hmodule = LoadLibraryA("rasapi32.dll"); + + RASAPI32_GET_PROC(RasEnumDevicesA) +} + +static void test_rasenum(void) +{ + DWORD result; + DWORD cDevices = 0; + DWORD cb = 0; + RASDEVINFOA rasDevInfo; + rasDevInfo.dwSize = sizeof(rasDevInfo); + + if(!pRasEnumDevicesA) { + win_skip("Skipping RasEnumDevicesA tests, function not present\n"); + return; + } + + result = pRasEnumDevicesA(NULL, &cb, &cDevices); + trace("RasEnumDevicesA: buffersize %d\n", cb); + ok(result == ERROR_BUFFER_TOO_SMALL, + "Expected ERROR_BUFFER_TOO_SMALL, got %08d\n", result); + + result = pRasEnumDevicesA(&rasDevInfo, NULL, &cDevices); + ok(result == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %08d\n", result); +} + +START_TEST(rasapi) +{ + InitFunctionPtrs(); + + test_rasenum(); +} diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in index 89e0f5d9a41..9431466041f 100644 --- a/programs/winetest/Makefile.in +++ b/programs/winetest/Makefile.in @@ -81,6 +81,7 @@ TESTBINS = \ qedit_test.exe \ qmgr_test.exe \ quartz_test.exe \ + rasapi32_test.exe \ riched20_test.exe \ riched32_test.exe \ rpcrt4_test.exe \ @@ -220,6 +221,8 @@ qmgr_test.exe: $(DLLDIR)/qmgr/tests/qmgr_test.exe$(DLLEXT) cp $(DLLDIR)/qmgr/tests/qmgr_test.exe$(DLLEXT) $@ && $(STRIP) $@ quartz_test.exe: $(DLLDIR)/quartz/tests/quartz_test.exe$(DLLEXT) cp $(DLLDIR)/quartz/tests/quartz_test.exe$(DLLEXT) $@ && $(STRIP) $@ +rasapi32_test.exe: $(DLLDIR)/rasapi32/tests/rasapi32_test.exe$(DLLEXT) + cp $(DLLDIR)/rasapi32/tests/rasapi32_test.exe$(DLLEXT) $@ && $(STRIP) $@ riched20_test.exe: $(DLLDIR)/riched20/tests/riched20_test.exe$(DLLEXT) cp $(DLLDIR)/riched20/tests/riched20_test.exe$(DLLEXT) $@ && $(STRIP) $@ riched32_test.exe: $(DLLDIR)/riched32/tests/riched32_test.exe$(DLLEXT) diff --git a/programs/winetest/winetest.rc b/programs/winetest/winetest.rc index 5c78c8f44d2..8a293a8f0cd 100644 --- a/programs/winetest/winetest.rc +++ b/programs/winetest/winetest.rc @@ -142,6 +142,7 @@ psapi_test.exe TESTRES "psapi_test.exe" qedit_test.exe TESTRES "qedit_test.exe" qmgr_test.exe TESTRES "qmgr_test.exe" quartz_test.exe TESTRES "quartz_test.exe" +rasapi32_test.exe TESTRES "rasapi32_test.exe" riched20_test.exe TESTRES "riched20_test.exe" riched32_test.exe TESTRES "riched32_test.exe" rpcrt4_test.exe TESTRES "rpcrt4_test.exe"