[PATCH 3/5] ws2_32: Use IOCTL_AFD_WINE_COMPLETE_ASYNC for unimplemented ioctls.

Zebediah Figura z.figura12 at gmail.com
Wed Jun 9 00:04:47 CDT 2021


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/ws2_32/socket.c     | 28 +++++++++++++++++++---------
 dlls/ws2_32/tests/sock.c | 21 ++++++++++++---------
 2 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 6f111e263c2..3b68d2e6336 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -3491,16 +3491,9 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
         return ret ? -1 : 0;
     }
 
-   case WS_SIO_SET_COMPATIBILITY_MODE:
-       TRACE("WS_SIO_SET_COMPATIBILITY_MODE ignored\n");
-       status = WSAEOPNOTSUPP;
-       break;
    case WS_SIO_UDP_CONNRESET:
        FIXME("WS_SIO_UDP_CONNRESET stub\n");
        break;
-    case 0x667e: /* Netscape tries hard to use bogus ioctl 0x667e */
-        SetLastError(WSAEOPNOTSUPP);
-        return SOCKET_ERROR;
 
     case WS_SIO_ADDRESS_LIST_CHANGE:
     {
@@ -3515,8 +3508,25 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
 
     default:
         FIXME( "unimplemented ioctl %s\n", debugstr_wsaioctl( code ) );
-        status = WSAEOPNOTSUPP;
-        break;
+        /* fall through */
+    case LOWORD(WS_FIONBIO): /* Netscape tries to use this */
+    case WS_SIO_SET_COMPATIBILITY_MODE:
+    {
+        NTSTATUS status = STATUS_NOT_SUPPORTED;
+
+        server_ioctl_sock( s, IOCTL_AFD_WINE_COMPLETE_ASYNC, &status, sizeof(status),
+                           NULL, 0, ret_size, overlapped, completion );
+        if (overlapped)
+        {
+            SetLastError( ERROR_IO_PENDING );
+        }
+        else
+        {
+            *ret_size = 0;
+            SetLastError( WSAEOPNOTSUPP );
+        }
+        return -1;
+    }
     }
 
     if (completion)
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 055fdf8feae..5b833ca8ba7 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -4139,7 +4139,7 @@ static void test_unsupported_ioctls(void)
             ok(ret == -1, "expected failure\n");
         todo_wine_if (codes[i] == FIOASYNC || codes[i] == SIO_FLUSH)
             ok(WSAGetLastError() == WSAEOPNOTSUPP, "got error %u\n", WSAGetLastError());
-        todo_wine_if (codes[i] != SIO_FLUSH)
+        todo_wine_if (codes[i] == FIOASYNC)
             ok(!size, "got size %u\n", size);
 
         WSASetLastError(0xdeadbeef);
@@ -4149,24 +4149,25 @@ static void test_unsupported_ioctls(void)
         ret = WSAIoctl(s, codes[i], NULL, 0, NULL, 0, &size, &overlapped, NULL);
         todo_wine_if (codes[i] == SIO_FLUSH)
             ok(ret == -1, "expected failure\n");
-        todo_wine ok(WSAGetLastError() == ERROR_IO_PENDING, "got error %u\n", WSAGetLastError());
+        todo_wine_if (codes[i] == FIOASYNC || codes[i] == SIO_FLUSH)
+            ok(WSAGetLastError() == ERROR_IO_PENDING, "got error %u\n", WSAGetLastError());
         todo_wine_if (codes[i] == SIO_FLUSH)
             ok(size == 0xdeadbeef, "got size %u\n", size);
 
         ret = GetQueuedCompletionStatus(port, &size, &key, &overlapped_ptr, 0);
         todo_wine_if (codes[i] == SIO_FLUSH)
             ok(!ret, "expected failure\n");
-        todo_wine_if (codes[i] != 0xdeadbeef)
+        todo_wine_if (codes[i] == FIOASYNC || codes[i] == SIO_FLUSH)
             ok(GetLastError() == ERROR_NOT_SUPPORTED, "got error %u\n", GetLastError());
-        todo_wine_if (codes[i] == FIOASYNC || codes[i] == 0x667e)
+        todo_wine_if (codes[i] == FIOASYNC)
             ok(!size, "got size %u\n", size);
         ok(key == 123, "got key %Iu\n", key);
-        todo_wine_if (codes[i] == FIOASYNC || codes[i] == 0x667e)
+        todo_wine_if (codes[i] == FIOASYNC)
             ok(overlapped_ptr == &overlapped, "got overlapped %p\n", overlapped_ptr);
-        todo_wine_if (codes[i] != 0xdeadbeef)
+        todo_wine_if (codes[i] == FIOASYNC || codes[i] == SIO_FLUSH)
             ok((NTSTATUS)overlapped.Internal == STATUS_NOT_SUPPORTED,
                     "got status %#x\n", (NTSTATUS)overlapped.Internal);
-        todo_wine_if (codes[i] == FIOASYNC || codes[i] == 0x667e)
+        todo_wine_if (codes[i] == FIOASYNC)
             ok(!overlapped.InternalHigh, "got size %Iu\n", overlapped.InternalHigh);
 
         CloseHandle(port);
@@ -4183,12 +4184,14 @@ static void test_unsupported_ioctls(void)
         ret = WSAIoctl(s, codes[i], NULL, 0, NULL, 0, &size, &overlapped, socket_apc);
         todo_wine_if (codes[i] == SIO_FLUSH)
             ok(ret == -1, "expected failure\n");
-        todo_wine ok(WSAGetLastError() == ERROR_IO_PENDING, "got error %u\n", WSAGetLastError());
+        todo_wine_if (codes[i] == FIOASYNC || codes[i] == SIO_FLUSH)
+            ok(WSAGetLastError() == ERROR_IO_PENDING, "got error %u\n", WSAGetLastError());
         todo_wine_if (codes[i] == SIO_FLUSH)
             ok(size == 0xdeadbeef, "got size %u\n", size);
 
         ret = SleepEx(0, TRUE);
-        todo_wine ok(ret == WAIT_IO_COMPLETION, "got %d\n", ret);
+        todo_wine_if (codes[i] == FIOASYNC || codes[i] == SIO_FLUSH)
+            ok(ret == WAIT_IO_COMPLETION, "got %d\n", ret);
         if (ret == WAIT_IO_COMPLETION)
         {
             ok(apc_count == 1, "APC was called %u times\n", apc_count);
-- 
2.32.0




More information about the wine-devel mailing list