ws2_32: Fix service flags returned from TCP and UDP protocols.
This commit is contained in:
parent
7944ca4855
commit
63fb7a798c
|
@ -96,7 +96,7 @@ static INT WINSOCK_EnterSingleProtocolW( INT protocol, WSAPROTOCOL_INFOW* info )
|
|||
switch (protocol)
|
||||
{
|
||||
case WS_IPPROTO_TCP:
|
||||
info->dwServiceFlags1 = XP1_PARTIAL_MESSAGE | XP1_EXPEDITED_DATA |
|
||||
info->dwServiceFlags1 = XP1_IFS_HANDLES | XP1_EXPEDITED_DATA |
|
||||
XP1_GRACEFUL_CLOSE | XP1_GUARANTEED_ORDER |
|
||||
XP1_GUARANTEED_DELIVERY;
|
||||
info->ProviderId = ProviderIdIP;
|
||||
|
@ -111,7 +111,7 @@ static INT WINSOCK_EnterSingleProtocolW( INT protocol, WSAPROTOCOL_INFOW* info )
|
|||
break;
|
||||
|
||||
case WS_IPPROTO_UDP:
|
||||
info->dwServiceFlags1 = XP1_PARTIAL_MESSAGE | XP1_SUPPORT_BROADCAST |
|
||||
info->dwServiceFlags1 = XP1_IFS_HANDLES | XP1_SUPPORT_BROADCAST |
|
||||
XP1_SUPPORT_MULTIPOINT | XP1_MESSAGE_ORIENTED |
|
||||
XP1_CONNECTIONLESS;
|
||||
info->ProviderId = ProviderIdIP;
|
||||
|
|
|
@ -26,22 +26,55 @@
|
|||
|
||||
#include "wine/test.h"
|
||||
|
||||
/* TCP and UDP over IP fixed set of service flags */
|
||||
#define TCPIP_SERVICE_FLAGS (XP1_GUARANTEED_DELIVERY \
|
||||
| XP1_GUARANTEED_ORDER \
|
||||
| XP1_GRACEFUL_CLOSE \
|
||||
| XP1_EXPEDITED_DATA \
|
||||
| XP1_IFS_HANDLES)
|
||||
|
||||
#define UDPIP_SERVICE_FLAGS (XP1_CONNECTIONLESS \
|
||||
| XP1_MESSAGE_ORIENTED \
|
||||
| XP1_SUPPORT_BROADCAST \
|
||||
| XP1_SUPPORT_MULTIPOINT \
|
||||
| XP1_IFS_HANDLES)
|
||||
|
||||
static void test_service_flags(int family, int version, int socktype, int protocol, DWORD testflags)
|
||||
{
|
||||
DWORD expectedflags = 0;
|
||||
if (socktype == SOCK_STREAM && protocol == IPPROTO_TCP)
|
||||
expectedflags = TCPIP_SERVICE_FLAGS;
|
||||
if (socktype == SOCK_DGRAM && protocol == IPPROTO_UDP)
|
||||
expectedflags = UDPIP_SERVICE_FLAGS;
|
||||
|
||||
/* check if standard TCP and UDP protocols are offering the correct service flags */
|
||||
if ((family == AF_INET || family == AF_INET6) && version == 2 && expectedflags)
|
||||
{
|
||||
/* QOS may or may not be installed */
|
||||
testflags &= ~XP1_QOS_SUPPORTED;
|
||||
ok(expectedflags == testflags,
|
||||
"Incorrect flags, expected 0x%x, received 0x%x\n",
|
||||
expectedflags, testflags);
|
||||
}
|
||||
}
|
||||
|
||||
static void test_WSAEnumProtocolsA(void)
|
||||
{
|
||||
INT ret;
|
||||
DWORD len = 0;
|
||||
DWORD len = 0, error;
|
||||
WSAPROTOCOL_INFOA info, *buffer;
|
||||
|
||||
ret = WSAEnumProtocolsA( NULL, NULL, &len );
|
||||
ok( ret == SOCKET_ERROR, "WSAEnumProtocolsA() succeeded unexpectedly: %d\n",
|
||||
WSAGetLastError() );
|
||||
ok( ret == SOCKET_ERROR, "WSAEnumProtocolsA() succeeded unexpectedly\n");
|
||||
error = WSAGetLastError();
|
||||
ok( error == WSAENOBUFS, "Expected 10055, received %d\n", error);
|
||||
|
||||
len = 0;
|
||||
|
||||
ret = WSAEnumProtocolsA( NULL, &info, &len );
|
||||
ok( ret == SOCKET_ERROR, "WSAEnumProtocolsA() succeeded unexpectedly: %d\n",
|
||||
WSAGetLastError() );
|
||||
ok( ret == SOCKET_ERROR, "WSAEnumProtocolsA() succeeded unexpectedly\n");
|
||||
error = WSAGetLastError();
|
||||
ok( error == WSAENOBUFS, "Expected 10055, received %d\n", error);
|
||||
|
||||
buffer = HeapAlloc( GetProcessHeap(), 0, len );
|
||||
|
||||
|
@ -56,6 +89,9 @@ static void test_WSAEnumProtocolsA(void)
|
|||
for (i = 0; i < ret; i++)
|
||||
{
|
||||
ok( strlen( buffer[i].szProtocol ), "No protocol name found\n" );
|
||||
test_service_flags( buffer[i].iAddressFamily, buffer[i].iVersion,
|
||||
buffer[i].iSocketType, buffer[i].iProtocol,
|
||||
buffer[i].dwServiceFlags1);
|
||||
}
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, buffer );
|
||||
|
@ -65,18 +101,20 @@ static void test_WSAEnumProtocolsA(void)
|
|||
static void test_WSAEnumProtocolsW(void)
|
||||
{
|
||||
INT ret;
|
||||
DWORD len = 0;
|
||||
DWORD len = 0, error;
|
||||
WSAPROTOCOL_INFOW info, *buffer;
|
||||
|
||||
ret = WSAEnumProtocolsW( NULL, NULL, &len );
|
||||
ok( ret == SOCKET_ERROR, "WSAEnumProtocolsW() succeeded unexpectedly: %d\n",
|
||||
WSAGetLastError() );
|
||||
ok( ret == SOCKET_ERROR, "WSAEnumProtocolsW() succeeded unexpectedly\n");
|
||||
error = WSAGetLastError();
|
||||
ok( error == WSAENOBUFS, "Expected 10055, received %d\n", error);
|
||||
|
||||
len = 0;
|
||||
|
||||
ret = WSAEnumProtocolsW( NULL, &info, &len );
|
||||
ok( ret == SOCKET_ERROR, "WSAEnumProtocolsW() succeeded unexpectedly: %d\n",
|
||||
WSAGetLastError() );
|
||||
ok( ret == SOCKET_ERROR, "WSAEnumProtocolsW() succeeded unexpectedly\n");
|
||||
error = WSAGetLastError();
|
||||
ok( error == WSAENOBUFS, "Expected 10055, received %d\n", error);
|
||||
|
||||
buffer = HeapAlloc( GetProcessHeap(), 0, len );
|
||||
|
||||
|
@ -91,6 +129,9 @@ static void test_WSAEnumProtocolsW(void)
|
|||
for (i = 0; i < ret; i++)
|
||||
{
|
||||
ok( lstrlenW( buffer[i].szProtocol ), "No protocol name found\n" );
|
||||
test_service_flags( buffer[i].iAddressFamily, buffer[i].iVersion,
|
||||
buffer[i].iSocketType, buffer[i].iProtocol,
|
||||
buffer[i].dwServiceFlags1);
|
||||
}
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, buffer );
|
||||
|
|
Loading…
Reference in New Issue