Bruno Jesus : ws2_32/tests: Test the precedence of parameters while creating a socket in WSASocket().

Alexandre Julliard julliard at winehq.org
Thu Aug 1 14:25:45 CDT 2013


Module: wine
Branch: master
Commit: d5f7f74f7868667f4257ea251fee74569b162594
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d5f7f74f7868667f4257ea251fee74569b162594

Author: Bruno Jesus <00cpxxx at gmail.com>
Date:   Wed Jul 31 18:32:43 2013 -0300

ws2_32/tests: Test the precedence of parameters while creating a socket in WSASocket().

---

 dlls/ws2_32/tests/sock.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 2ee81ae..7e70449 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -1733,7 +1733,21 @@ todo_wine
                       FROM_PROTOCOL_INFO, &pi[0], 0, 0);
     ok(sock != INVALID_SOCKET, "Failed to create socket: %d\n",
             WSAGetLastError());
+    closesocket(sock);
 
+    /* find what parameters are used first: plain parameters or protocol info struct */
+    pi[0].iProtocol = IPPROTO_UDP;
+    pi[0].iSocketType = SOCK_DGRAM;
+    pi[0].iAddressFamily = AF_INET;
+    sock = WSASocketA(AF_INET, SOCK_STREAM, IPPROTO_TCP, &pi[0], 0, 0);
+    ok(sock != INVALID_SOCKET, "Failed to create socket: %d\n",
+            WSAGetLastError());
+    size = sizeof(socktype);
+    socktype = 0xdead;
+    err = getsockopt(sock, SOL_SOCKET, SO_TYPE, (char *) &socktype, &size);
+    ok(!err,"getsockopt failed with %d\n", WSAGetLastError());
+    ok(socktype == SOCK_STREAM, "Wrong socket type, expected %d received %d\n",
+       SOCK_STREAM, socktype);
     closesocket(sock);
 
     HeapFree(GetProcessHeap(), 0, pi);




More information about the wine-cvs mailing list