From f9c82654bec4ac9b1126a26eab19aee6ed5aacc1 Mon Sep 17 00:00:00 2001 From: Saulius Krasuckas Date: Sat, 5 Nov 2005 10:43:27 +0000 Subject: [PATCH] - Stricten cases for NT in a two tests. - WSAAddressToString[AW] don't fail on Win9x for those. - Modify it to pass new tests. --- dlls/winsock/socket.c | 3 ++- dlls/winsock/tests/sock.c | 14 ++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/dlls/winsock/socket.c b/dlls/winsock/socket.c index df0c70612d..5705957965 100644 --- a/dlls/winsock/socket.c +++ b/dlls/winsock/socket.c @@ -3966,7 +3966,7 @@ INT WINAPI WSAAddressToStringA( LPSOCKADDR sockaddr, DWORD len, CHAR buffer[22]; /* 12 digits + 3 dots + ':' + 5 digits + '\0' */ CHAR *p; - TRACE( "(%p, %lx, %p, %p, %p)\n", sockaddr, len, info, string, lenstr ); + TRACE( "(%p, %ld, %p, %p, %p)\n", sockaddr, len, info, string, lenstr ); if (!sockaddr || len < sizeof(SOCKADDR_IN)) return SOCKET_ERROR; if (!string || !lenstr) return SOCKET_ERROR; @@ -3989,6 +3989,7 @@ INT WINAPI WSAAddressToStringA( LPSOCKADDR sockaddr, DWORD len, if (*lenstr < size) { *lenstr = size; + WSASetLastError(WSAEFAULT); return SOCKET_ERROR; } diff --git a/dlls/winsock/tests/sock.c b/dlls/winsock/tests/sock.c index 6a13a18608..5714c73301 100644 --- a/dlls/winsock/tests/sock.c +++ b/dlls/winsock/tests/sock.c @@ -1044,6 +1044,7 @@ static void test_WSAAddressToStringA(void) { INT ret; DWORD len; + int GLE; SOCKADDR_IN sockaddr; CHAR address[22]; /* 12 digits + 3 dots + ':' + 5 digits + '\0' */ @@ -1059,8 +1060,10 @@ static void test_WSAAddressToStringA(void) sockaddr.sin_addr.s_addr = 0; ret = WSAAddressToStringA( (SOCKADDR*)&sockaddr, sizeof(sockaddr), NULL, address, &len ); - ok( ret == SOCKET_ERROR, "WSAAddressToStringA() succeeded! WSAGetLastError()=%x, ret=%d\n", - WSAGetLastError(), ret ); + GLE = WSAGetLastError(); + ok( (ret == SOCKET_ERROR && GLE == WSAEFAULT) || (ret == 0), + "WSAAddressToStringA() failed unexpectedly: WSAGetLastError()=%d, ret=%d\n", + GLE, ret ); len = sizeof(address); @@ -1111,6 +1114,7 @@ static void test_WSAAddressToStringW(void) { INT ret; DWORD len; + int GLE; SOCKADDR_IN sockaddr; WCHAR address[22]; /* 12 digits + 3 dots + ':' + 5 digits + '\0' */ @@ -1127,8 +1131,10 @@ static void test_WSAAddressToStringW(void) sockaddr.sin_addr.s_addr = 0; ret = WSAAddressToStringW( (SOCKADDR*)&sockaddr, sizeof(sockaddr), NULL, address, &len ); - ok( ret == SOCKET_ERROR, "WSAAddressToStringW() succeeded! WSAGetLastError()=%x, ret=%d\n", - WSAGetLastError(), ret ); + GLE = WSAGetLastError(); + ok( (ret == SOCKET_ERROR && GLE == WSAEFAULT) || (ret == 0), + "WSAAddressToStringW() failed unexpectedly: WSAGetLastError()=%d, ret=%d\n", + GLE, ret ); len = sizeof(address); -- 2.32.0.93.g670b81a890