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

Bruno Jesus 00cpxxx at gmail.com
Tue Jul 30 19:48:43 CDT 2013


On Tue, Jul 30, 2013 at 9:23 PM, Austin English <austinenglish at gmail.com> wrote:
> You forgot the patch.

There is a first time for everything =)

>
> --
> -Austin

Thanks,
Bruno
-------------- next part --------------
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 1a75ffd..8a063ef 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 paremeters 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;
+    ok(!getsockopt(sock, SOL_SOCKET, SO_TYPE, (char *) &socktype, &size), "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-patches mailing list