2014-10-03 09:00:15 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS api tests
|
|
|
|
* LICENSE: GPLv2+ - See COPYING in the top level directory
|
|
|
|
* PURPOSE: Test for WSAStartup
|
|
|
|
* PROGRAMMER: Sylvain Petreolle <sylvain.petreolle@reactos.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <apitest.h>
|
|
|
|
|
|
|
|
#define WIN32_NO_STATUS
|
|
|
|
#define _INC_WINDOWS
|
|
|
|
#define COM_NO_WINDOWS_H
|
2014-10-03 10:25:20 +00:00
|
|
|
|
2014-10-03 09:00:15 +00:00
|
|
|
#include <windef.h>
|
|
|
|
#include <winsock2.h>
|
|
|
|
#include <ndk/rtlfuncs.h>
|
|
|
|
#include <ndk/mmfuncs.h>
|
|
|
|
|
|
|
|
// This test depends on WSAStartup not having been called
|
|
|
|
START_TEST(nostartup)
|
|
|
|
{
|
2014-10-03 10:25:20 +00:00
|
|
|
int Error = 0;
|
2014-10-03 09:00:15 +00:00
|
|
|
ok(WSASocketA(0, 0, 0, NULL, 0, 0) == INVALID_SOCKET, "WSASocketA should have failed\n");
|
|
|
|
|
|
|
|
WSASetLastError(0xdeadbeef);
|
2014-10-03 10:25:20 +00:00
|
|
|
getservbyname(NULL, NULL);
|
2014-10-03 09:00:15 +00:00
|
|
|
Error = WSAGetLastError();
|
|
|
|
ok_dec(Error, WSANOTINITIALISED);
|
|
|
|
|
|
|
|
WSASetLastError(0xdeadbeef);
|
2014-10-03 10:25:20 +00:00
|
|
|
getservbyport(0, NULL);
|
2014-10-03 09:00:15 +00:00
|
|
|
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);
|
|
|
|
}
|