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

This commit is contained in:
Bruno Jesus 2013-09-17 10:01:07 -03:00 committed by Alexandre Julliard
parent 0298165bea
commit 2034f51598
2 changed files with 6 additions and 1 deletions

View File

@ -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;

View File

@ -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);