[PATCH] Implemented FIONBIO and FIONREAD in WSAIoctl

Marcus Meissner marcus at jet.franken.de
Mon Oct 2 07:08:25 CDT 2006


Hi,

FIOBIO and FIONREAD implemented by forwarding to WS_ioctlsocket().

Ciao, Marcus

---

 dlls/ws2_32/socket.c |   33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)

c1eec530ee69146cc877e3a6225f8fced85f977e
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index c752b39..7570f0a 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -2102,8 +2102,6 @@ char* WINAPI WS_inet_ntoa(struct WS_in_a
 /**********************************************************************
  *              WSAIoctl                (WS2_32.50)
  *
- *
- *   FIXME:  Only SIO_GET_INTERFACE_LIST option implemented.
  */
 INT WINAPI WSAIoctl(SOCKET s,
                     DWORD   dwIoControlCode,
@@ -2116,6 +2114,7 @@ INT WINAPI WSAIoctl(SOCKET s,
                     LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
 {
    int fd = get_sock_fd( s, 0, NULL );
+   INT ret;
 
    if (fd == -1) return SOCKET_ERROR;
 
@@ -2125,6 +2124,32 @@ INT WINAPI WSAIoctl(SOCKET s,
 
    switch( dwIoControlCode )
    {
+   case WS_FIONBIO:
+	if (cbInBuffer != 4) {
+            release_sock_fd( s, fd );
+            WSASetLastError(WSAEFAULT);
+            return SOCKET_ERROR;
+        }
+        ret = WS_ioctlsocket( s, WS_FIONBIO, lpvInBuffer);
+        if (ret == SOCKET_ERROR) {
+            release_sock_fd( s, fd );
+            /* last error already set by WS_ioctlsocket */
+            return ret;
+        }
+	break;
+   case WS_FIONREAD:
+	if (cbOutBuffer != 4) {
+            release_sock_fd( s, fd );
+            WSASetLastError(WSAEFAULT);
+            return SOCKET_ERROR;
+        }
+        ret = WS_ioctlsocket( s, WS_FIONREAD, lpbOutBuffer);
+        if (ret == SOCKET_ERROR) {
+            release_sock_fd( s, fd );
+            /* last error already set by WS_ioctlsocket */
+            return ret;
+        }
+	break;
    case SIO_GET_INTERFACE_LIST:
        {
            INTERFACE_INFO* intArray = (INTERFACE_INFO*)lpbOutBuffer;
@@ -2257,6 +2282,10 @@ INT WINAPI WSAIoctl(SOCKET s,
         * with WSA_FLAG_OVERLAPPED, but there is no easy way to get this */
        break;
 
+   case SIO_FLUSH:
+	FIXME("SIO_FLUSH: stub.\n");
+	break;
+
    default:
        FIXME("unsupported WS_IOCTL cmd (%08lx)\n", dwIoControlCode);
        release_sock_fd( s, fd );
-- 
1.2.4



More information about the wine-patches mailing list