- Fix the crash in ws2_32_winetest during the ioctlsocket test
authorCameron Gutman <aicommander@gmail.com>
Sat, 3 Oct 2009 18:21:14 +0000 (18:21 +0000)
committerCameron Gutman <aicommander@gmail.com>
Sat, 3 Oct 2009 18:21:14 +0000 (18:21 +0000)
 - Pass the blocking mode down to AFD
 - Dedicated to encoded

svn path=/trunk/; revision=43270

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

index f654bb5..fd204fd 100644 (file)
@@ -1735,12 +1735,18 @@ WSPIoctl(IN  SOCKET Handle,
     switch( dwIoControlCode )
     {
         case FIONBIO:
-            if( cbInBuffer < sizeof(INT) )
+            if( cbInBuffer < sizeof(INT) || IS_INTRESOURCE(lpvInBuffer) )
+            {
+                *lpErrno = WSAEFAULT;
                 return SOCKET_ERROR;
-            Socket->SharedData.NonBlocking = *((PINT)lpvInBuffer) ? 1 : 0;
-            AFD_DbgPrint(MID_TRACE,("[%x] Set nonblocking %d\n", Handle, Socket->SharedData.NonBlocking));
-            return 0;
+            }
+            return SetSocketInformation(Socket, AFD_INFO_BLOCKING_MODE, (PULONG)lpvInBuffer, NULL);
         case FIONREAD:
+            if( cbOutBuffer < sizeof(INT) || IS_INTRESOURCE(lpvOutBuffer) )
+            {
+                *lpErrno = WSAEFAULT;
+                return SOCKET_ERROR;
+            }
             return GetSocketInformation(Socket, AFD_INFO_RECEIVE_CONTENT_SIZE, (PULONG)lpvOutBuffer, NULL);
         default:
             *lpErrno = WSAEINVAL;