Bruno Jesus : ws2_32: Do not allow socket creation if WSAStartup was not called.
Alexandre Julliard
julliard at winehq.org
Tue Sep 17 15:25:54 CDT 2013
Module: wine
Branch: master
Commit: 2034f515981ead985c4c24fac7b6935326cdb490
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2034f515981ead985c4c24fac7b6935326cdb490
Author: Bruno Jesus <00cpxxx at gmail.com>
Date: Tue Sep 17 10:01:07 2013 -0300
ws2_32: Do not allow socket creation if WSAStartup was not called.
---
dlls/ws2_32/socket.c | 6 ++++++
dlls/ws2_32/tests/sock.c | 1 -
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index e8d87da..8a790f3 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -5878,6 +5878,12 @@ SOCKET WINAPI WSASocketW(int af, int type, int protocol,
TRACE("af=%d type=%d protocol=%d protocol_info=%p group=%d flags=0x%x\n",
af, type, protocol, lpProtocolInfo, g, dwFlags );
+ if (!num_startup)
+ {
+ err = WSANOTINITIALISED;
+ goto done;
+ }
+
/* hack for WSADuplicateSocket */
if (lpProtocolInfo && lpProtocolInfo->dwServiceFlags4 == 0xff00ff00) {
ret = lpProtocolInfo->dwServiceFlags3;
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 3921262..b77bb3c 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -975,7 +975,6 @@ static void test_WithoutWSAStartup(void)
WSASetLastError(0xdeadbeef);
ok(WSASocketA(0, 0, 0, NULL, 0, 0) == INVALID_SOCKET, "WSASocketA should have failed\n");
err = WSAGetLastError();
-todo_wine
ok(err == WSANOTINITIALISED, "Expected 10093, received %d\n", err);
WSASetLastError(0xdeadbeef);
More information about the wine-cvs
mailing list