WSAStartup fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

This fixes a case of stack corruption in "the bat!" email program. 

Windows WSAStartup() (tested with win98 and win2K') doesn't fill in or
use the WSADATA's lpVendorInfo field, and apparently this program has
cut the field from the structure accordingly

For the changelog:


	dlls/winsock/		: socket.c

	In WSAStartup() don't touch the lpVendorInfo field of the
	WSADATA structure.

Rein.
-- 
Rein Klazes
rklazes@xs4all.nl
--- wine/dlls/winsock/socket.c	Thu Jul  4 09:11:40 2002
+++ mywine/dlls/winsock/socket.c	Tue Jul 16 09:10:36 2002
@@ -698,27 +698,21 @@
  */
 int WINAPI WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData)
 {
-    static const WSADATA data =
-    {
-        0x0202, 0x0202,
-        "WINE Sockets 2.0",
+    static const char *szSysstat =
 #ifdef linux
-        "Linux",
+        "Linux"
 #elif defined(__NetBSD__)
-        "NetBSD",
+        "NetBSD"
 #elif defined(sunos)
-        "SunOS",
+        "SunOS"
 #elif defined(__FreeBSD__)
-        "FreeBSD",
+        "FreeBSD"
 #elif defined(__OpenBSD__)
-        "OpenBSD",
+        "OpenBSD"
 #else
-        "Unknown",
+        "Unknown"
 #endif
-        WS_MAX_SOCKETS_PER_PROCESS,
-        WS_MAX_UDP_DATAGRAM,
-        NULL
-    };
+    ;
 
     TRACE("verReq=%x\n", wVersionRequested);
 
@@ -742,11 +736,16 @@
 
     num_startup++;
 
-    /* return winsock information */
-    memcpy(lpWSAData, &data, sizeof(data));
-
     /* that's the whole of the negotiation for now */
     lpWSAData->wVersion = wVersionRequested;
+    /* return winsock information */
+    lpWSAData->wHighVersion = 0x0202;
+    strcpy(lpWSAData->szDescription, "WINE Sockets 2.0" );
+    strcpy(lpWSAData->szSystemStatus, szSysstat);
+    lpWSAData->iMaxSockets = WS_MAX_SOCKETS_PER_PROCESS;
+    lpWSAData->iMaxUdpDg = WS_MAX_UDP_DATAGRAM;
+    /* don't do anything with lpWSAData->lpVendorInfo */
+    /* (some app's don't allocate the space for this field) */ 
 
     TRACE("succeeded\n");
     return 0;

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux