Commit bec06ad7 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

Fill WSAPROTOCOL_INFO structures instead of PROTOCOL_INFO structures.

Implement WSCEnumProtocols(). Add some tests.
parent d3eb0550
Makefile
protocol.ok
sock.ok
testlist.c
......@@ -6,6 +6,7 @@ TESTDLL = ws2_32.dll
IMPORTS = ws2_32
CTESTS = \
protocol.c \
sock.c
@MAKE_TEST_RULES@
......
/*
* Unit test suite for protocol functions
*
* Copyright 2004 Hans Leidekker
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winsock2.h>
#include "wine/test.h"
#include "wine/debug.h"
static void test_WSAEnumProtocolsA()
{
INT ret;
DWORD len = 0;
WSAPROTOCOL_INFOA info, *buffer;
ret = WSAEnumProtocolsA( NULL, NULL, &len );
ok( ret == SOCKET_ERROR, "WSAEnumProtocolsA() succeeded unexpectedly: %d\n",
WSAGetLastError() );
len = 0;
ret = WSAEnumProtocolsA( NULL, &info, &len );
ok( ret == SOCKET_ERROR, "WSAEnumProtocolsA() succeeded unexpectedly: %d\n",
WSAGetLastError() );
buffer = HeapAlloc( GetProcessHeap(), 0, len );
if (buffer)
{
INT i;
ret = WSAEnumProtocolsA( NULL, buffer, &len );
ok( ret != SOCKET_ERROR, "WSAEnumProtocolsA() failed unexpectedly: %d\n",
WSAGetLastError() );
for (i = 0; i < ret; i++)
{
ok( strlen( buffer[i].szProtocol ), "No protocol name found\n" );
}
HeapFree( GetProcessHeap(), 0, buffer );
}
}
static void test_WSAEnumProtocolsW()
{
INT ret;
DWORD len = 0;
WSAPROTOCOL_INFOW info, *buffer;
ret = WSAEnumProtocolsW( NULL, NULL, &len );
ok( ret == SOCKET_ERROR, "WSAEnumProtocolsW() succeeded unexpectedly: %d\n",
WSAGetLastError() );
len = 0;
ret = WSAEnumProtocolsW( NULL, &info, &len );
ok( ret == SOCKET_ERROR, "WSAEnumProtocolsW() succeeded unexpectedly: %d\n",
WSAGetLastError() );
buffer = HeapAlloc( GetProcessHeap(), 0, len );
if (buffer)
{
INT i;
ret = WSAEnumProtocolsW( NULL, buffer, &len );
ok( ret != SOCKET_ERROR, "WSAEnumProtocolsW() failed unexpectedly: %d\n",
WSAGetLastError() );
for (i = 0; i < ret; i++)
{
ok( lstrlenW( buffer[i].szProtocol ), "No protocol name found\n" );
}
HeapFree( GetProcessHeap(), 0, buffer );
}
}
START_TEST( protocol )
{
WSADATA data;
WORD version = MAKEWORD( 2, 2 );
if (WSAStartup( version, &data )) return;
test_WSAEnumProtocolsA();
test_WSAEnumProtocolsW();
}
......@@ -86,7 +86,7 @@
82 stdcall WSAWaitForMultipleEvents(long ptr long long long) kernel32.WaitForMultipleObjectsEx
83 stdcall WSCDeinstallProvider(ptr ptr)
84 stub WSCEnableNSProvider
85 stub WSCEnumProtocols
85 stdcall WSCEnumProtocols(ptr ptr ptr ptr)
86 stub WSCGetProviderPath
87 stub WSCInstallNameSpace
88 stdcall WSCInstallProvider(ptr wstr ptr long ptr)
......
......@@ -176,6 +176,31 @@ typedef struct _WSAPROTOCOLCHAIN
DWORD ChainEntries[MAX_PROTOCOL_CHAIN]; /* a list of dwCatalogEntryIds */
} WSAPROTOCOLCHAIN, * LPWSAPROTOCOLCHAIN;
#define XP1_CONNECTIONLESS 0x00000001
#define XP1_GUARANTEED_DELIVERY 0x00000002
#define XP1_GUARANTEED_ORDER 0x00000004
#define XP1_MESSAGE_ORIENTED 0x00000008
#define XP1_PSEUDO_STREAM 0x00000010
#define XP1_GRACEFUL_CLOSE 0x00000020
#define XP1_EXPEDITED_DATA 0x00000040
#define XP1_CONNECT_DATA 0x00000080
#define XP1_DISCONNECT_DATA 0x00000100
#define XP1_SUPPORT_BROADCAST 0x00000200
#define XP1_SUPPORT_MULTIPOINT 0x00000400
#define XP1_MULTIPOINT_CONTROL_PLANE 0x00000800
#define XP1_MULTIPOINT_DATA_PLANE 0x00001000
#define XP1_QOS_SUPPORTED 0x00002000
#define XP1_INTERRUPT 0x00004000
#define XP1_UNI_SEND 0x00008000
#define XP1_UNI_RECV 0x00010000
#define XP1_IFS_HANDLES 0x00020000
#define XP1_PARTIAL_MESSAGE 0x00040000
#define BIGENDIAN 0x0000
#define LITTLEENDIAN 0x0001
#define SECURITY_PROTOCOL_NONE 0x0000
#define WSAPROTOCOL_LEN 255
typedef struct _WSAPROTOCOL_INFOA
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment