[MSAFD]
authorCameron Gutman <aicommander@gmail.com>
Fri, 28 May 2010 04:07:39 +0000 (04:07 +0000)
committerCameron Gutman <aicommander@gmail.com>
Fri, 28 May 2010 04:07:39 +0000 (04:07 +0000)
- Pass a valid pointer for lpErrno to WSPBind when performing an implicit bind
- Remove the hack in MsafdReturnWithErrno for dealing with stupid callers that provide don't provide a valid Errno pointer

svn path=/trunk/; revision=47378

reactos/dll/win32/msafd/misc/dllmain.c
reactos/dll/win32/msafd/misc/sndrcv.c

index d3165a5..f501eb0 100644 (file)
@@ -384,20 +384,17 @@ DWORD MsafdReturnWithErrno(NTSTATUS Status,
                            DWORD Received,
                            LPDWORD ReturnedBytes)
 {
-    if (Errno)
-    {
-        *Errno = TranslateNtStatusError(Status);
+    *Errno = TranslateNtStatusError(Status);
 
-        if (ReturnedBytes)
-        {
-            if (!*Errno)
-                *ReturnedBytes = Received;
-            else
-                *ReturnedBytes = 0;
-        }
+    if (ReturnedBytes)
+    {
+        if (!*Errno)
+            *ReturnedBytes = Received;
+        else
+            *ReturnedBytes = 0;
     }
 
-    return Status ? SOCKET_ERROR : 0;
+    return *Errno ? SOCKET_ERROR : 0;
 }
 
 /*
index 212b4fc..3c5b2d5 100644 (file)
@@ -540,7 +540,8 @@ WSPSendTo(SOCKET Handle,
                                                    BindAddress,
                                                    &BindAddressLength);
         /* Bind it */
-        WSPBind(Handle, BindAddress, BindAddressLength, NULL);
+        if (WSPBind(Handle, BindAddress, BindAddressLength, lpErrno) == SOCKET_ERROR)
+            return SOCKET_ERROR;
     }
 
     RemoteAddress = HeapAlloc(GlobalHeap, 0, 0x6 + SocketAddressLength);