Commit 864bef4f authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ws2_32: Always fill the WSADATA structure in WSAStartup().

parent 155449c5
...@@ -572,29 +572,28 @@ BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved ) ...@@ -572,29 +572,28 @@ BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved )
/*********************************************************************** /***********************************************************************
* WSAStartup (WS2_32.115) * WSAStartup (WS2_32.115)
*/ */
int WINAPI WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData) int WINAPI WSAStartup( WORD version, WSADATA *data )
{ {
TRACE("verReq=%x\n", wVersionRequested); TRACE( "version %#x\n", version );
if (LOBYTE(wVersionRequested) < 1) if (data)
{
data->wVersion = version;
data->wHighVersion = MAKEWORD(2, 2);
strcpy( data->szDescription, "WinSock 2.0" );
strcpy( data->szSystemStatus, "Running" );
data->iMaxSockets = MAX_SOCKETS_PER_PROCESS;
data->iMaxUdpDg = MAX_UDP_DATAGRAM;
/* don't fill lpVendorInfo */
}
if (!LOBYTE(version))
return WSAVERNOTSUPPORTED; return WSAVERNOTSUPPORTED;
if (!lpWSAData) return WSAEINVAL; if (!data) return WSAEINVAL;
num_startup++; num_startup++;
TRACE( "increasing startup count to %d\n", num_startup );
/* that's the whole of the negotiation for now */
lpWSAData->wVersion = wVersionRequested;
/* return winsock information */
lpWSAData->wHighVersion = 0x0202;
strcpy(lpWSAData->szDescription, "WinSock 2.0" );
strcpy(lpWSAData->szSystemStatus, "Running" );
lpWSAData->iMaxSockets = MAX_SOCKETS_PER_PROCESS;
lpWSAData->iMaxUdpDg = MAX_UDP_DATAGRAM;
/* don't do anything with lpWSAData->lpVendorInfo */
/* (some apps don't allocate the space for this field) */
TRACE("succeeded starts: %d\n", num_startup);
return 0; return 0;
} }
......
...@@ -2869,12 +2869,9 @@ static void test_startup(void) ...@@ -2869,12 +2869,9 @@ static void test_startup(void)
todo_wine ok(!WSAGetLastError(), "got error %u\n", WSAGetLastError()); todo_wine ok(!WSAGetLastError(), "got error %u\n", WSAGetLastError());
} }
ok(data.lpVendorInfo == (void *)0xdeadbeef, "got vendor info %p\n", data.lpVendorInfo); ok(data.lpVendorInfo == (void *)0xdeadbeef, "got vendor info %p\n", data.lpVendorInfo);
todo_wine_if (ret) ok(data.wHighVersion == 0x202, "got maximum version %#x\n", data.wHighVersion);
{ ok(!strcmp(data.szDescription, "WinSock 2.0"), "got description %s\n", debugstr_a(data.szDescription));
ok(data.wHighVersion == 0x202, "got maximum version %#x\n", data.wHighVersion); ok(!strcmp(data.szSystemStatus, "Running"), "got status %s\n", debugstr_a(data.szSystemStatus));
ok(!strcmp(data.szDescription, "WinSock 2.0"), "got description %s\n", debugstr_a(data.szDescription));
ok(!strcmp(data.szSystemStatus, "Running"), "got status %s\n", debugstr_a(data.szSystemStatus));
}
todo_wine ok(data.iMaxSockets == (LOBYTE(tests[i].version) == 1 ? 32767 : 0), "got maximum sockets %u\n", data.iMaxSockets); todo_wine ok(data.iMaxSockets == (LOBYTE(tests[i].version) == 1 ? 32767 : 0), "got maximum sockets %u\n", data.iMaxSockets);
todo_wine ok(data.iMaxUdpDg == (LOBYTE(tests[i].version) == 1 ? 65467 : 0), "got maximum datagram size %u\n", data.iMaxUdpDg); todo_wine ok(data.iMaxUdpDg == (LOBYTE(tests[i].version) == 1 ? 65467 : 0), "got maximum datagram size %u\n", data.iMaxUdpDg);
......
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