diff --git a/rostests/apitests/ws2_32/CMakeLists.txt b/rostests/apitests/ws2_32/CMakeLists.txt index 0235f56e319..13ef03bd221 100644 --- a/rostests/apitests/ws2_32/CMakeLists.txt +++ b/rostests/apitests/ws2_32/CMakeLists.txt @@ -3,6 +3,7 @@ list(APPEND SOURCE getaddrinfo.c helpers.c ioctlsocket.c + nostartup.c recv.c WSAStartup.c testlist.c) diff --git a/rostests/apitests/ws2_32/nostartup.c b/rostests/apitests/ws2_32/nostartup.c new file mode 100644 index 00000000000..83e654b98d0 --- /dev/null +++ b/rostests/apitests/ws2_32/nostartup.c @@ -0,0 +1,40 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Test for WSAStartup + * PROGRAMMER: Sylvain Petreolle + */ + +#include + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H +#include +#include +#include +#include + +// This test depends on WSAStartup not having been called +START_TEST(nostartup) +{ + int Error=0; + ok(WSASocketA(0, 0, 0, NULL, 0, 0) == INVALID_SOCKET, "WSASocketA should have failed\n"); + + WSASetLastError(0xdeadbeef); + getservbyname(NULL,NULL); + Error = WSAGetLastError(); + ok_dec(Error, WSANOTINITIALISED); + + WSASetLastError(0xdeadbeef); + getservbyport(0,NULL); + Error = WSAGetLastError(); + ok_dec(Error, WSANOTINITIALISED); + + WSASetLastError(0xdeadbeef); + gethostbyname(NULL); + Error = WSAGetLastError(); + ok_dec(Error, WSANOTINITIALISED); + + ok_dec(inet_addr("127.0.0.1"), 0x100007f); +} diff --git a/rostests/apitests/ws2_32/testlist.c b/rostests/apitests/ws2_32/testlist.c index fdd6f3d6c4f..7b0660f9bc9 100644 --- a/rostests/apitests/ws2_32/testlist.c +++ b/rostests/apitests/ws2_32/testlist.c @@ -7,14 +7,15 @@ extern void func_getaddrinfo(void); extern void func_ioctlsocket(void); extern void func_recv(void); extern void func_WSAStartup(void); +extern void func_nostartup(void); const struct test winetest_testlist[] = { { "getaddrinfo", func_getaddrinfo }, { "ioctlsocket", func_ioctlsocket }, + { "nostartup", func_nostartup }, { "recv", func_recv }, { "WSAStartup", func_WSAStartup }, - { 0, 0 } };