Commit 2034f515 authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

ws2_32: Do not allow socket creation if WSAStartup was not called.

parent 0298165b
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment