2 * Unit test suite for protocol functions
4 * Copyright 2004 Hans Leidekker
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "wine/test.h"
30 static void test_WSAEnumProtocolsA(void)
34 WSAPROTOCOL_INFOA info, *buffer;
36 ret = WSAEnumProtocolsA( NULL, NULL, &len );
37 ok( ret == SOCKET_ERROR, "WSAEnumProtocolsA() succeeded unexpectedly: %d\n",
42 ret = WSAEnumProtocolsA( NULL, &info, &len );
43 ok( ret == SOCKET_ERROR, "WSAEnumProtocolsA() succeeded unexpectedly: %d\n",
46 buffer = HeapAlloc( GetProcessHeap(), 0, len );
52 ret = WSAEnumProtocolsA( NULL, buffer, &len );
53 ok( ret != SOCKET_ERROR, "WSAEnumProtocolsA() failed unexpectedly: %d\n",
56 for (i = 0; i < ret; i++)
58 ok( strlen( buffer[i].szProtocol ), "No protocol name found\n" );
61 HeapFree( GetProcessHeap(), 0, buffer );
65 static void test_WSAEnumProtocolsW(void)
69 WSAPROTOCOL_INFOW info, *buffer;
71 ret = WSAEnumProtocolsW( NULL, NULL, &len );
72 ok( ret == SOCKET_ERROR, "WSAEnumProtocolsW() succeeded unexpectedly: %d\n",
77 ret = WSAEnumProtocolsW( NULL, &info, &len );
78 ok( ret == SOCKET_ERROR, "WSAEnumProtocolsW() succeeded unexpectedly: %d\n",
81 buffer = HeapAlloc( GetProcessHeap(), 0, len );
87 ret = WSAEnumProtocolsW( NULL, buffer, &len );
88 ok( ret != SOCKET_ERROR, "WSAEnumProtocolsW() failed unexpectedly: %d\n",
91 for (i = 0; i < ret; i++)
93 ok( lstrlenW( buffer[i].szProtocol ), "No protocol name found\n" );
96 HeapFree( GetProcessHeap(), 0, buffer );
100 START_TEST( protocol )
103 WORD version = MAKEWORD( 2, 2 );
105 if (WSAStartup( version, &data )) return;
107 test_WSAEnumProtocolsA();
108 test_WSAEnumProtocolsW();