[ws2_32]
authorChristoph von Wittich <christoph_vw@reactos.org>
Sun, 16 Feb 2014 10:24:08 +0000 (10:24 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Sun, 16 Feb 2014 10:24:08 +0000 (10:24 +0000)
-do not initialize in case of error
-don't touch vendor info

svn path=/trunk/; revision=62210

reactos/dll/win32/ws2_32/misc/dllmain.c
reactos/dll/win32/ws2_32/misc/ns.c

index b0d657e..e86e4f1 100644 (file)
@@ -116,7 +116,6 @@ WSAStartup(IN  WORD wVersionRequested,
     lpWSAData->wHighVersion = MAKEWORD(2,2);
     lstrcpyA(lpWSAData->szDescription, "WinSock 2.0");
     lstrcpyA(lpWSAData->szSystemStatus, "Running");
-    lpWSAData->lpVendorInfo = NULL;
 
     if (LOBYTE(wVersionRequested) == 1)
     {
@@ -131,7 +130,8 @@ WSAStartup(IN  WORD wVersionRequested,
     
     /*FIXME: increment internal counter */
 
-    WSASETINITIALIZED;
+    if (ErrorCode == ERROR_SUCCESS)
+        WSASETINITIALIZED;
 
     return ErrorCode;
 }
index 7d18341..9c37bbc 100644 (file)
@@ -861,7 +861,7 @@ gethostbyname(IN  CONST CHAR FAR* name)
 
     p = NtCurrentTeb()->WinSockData;
 
-    if( !p )
+    if (!p || !WSAINITIALIZED)
     {
         WSASetLastError( WSANOTINITIALISED );
         return NULL;
@@ -1130,7 +1130,7 @@ getservbyname(IN  CONST CHAR FAR* name,
     DWORD ReadSize = 0;
     PWINSOCK_THREAD_BLOCK p = NtCurrentTeb()->WinSockData;
 
-    if( !p )
+    if (!p || !WSAINITIALIZED)
     {
         WSASetLastError( WSANOTINITIALISED );
         return NULL;
@@ -1314,7 +1314,7 @@ getservbyport(IN  INT port,
     DWORD ReadSize = 0, ValidData = 0;
     PWINSOCK_THREAD_BLOCK p = NtCurrentTeb()->WinSockData;
 
-    if( !p )
+    if( !p || !WSAINITIALIZED)
     {
         WSASetLastError( WSANOTINITIALISED );
         return NULL;
@@ -1496,7 +1496,7 @@ inet_addr(IN  CONST CHAR FAR* cp)
 
     p = (PCHAR)cp;
 
-    if (!p)
+    if (!p || !WSAINITIALIZED)
     {
         WSASetLastError(WSAEFAULT);
         return INADDR_NONE;