Zebediah Figura : ws2_32: Use IOCTL_WINE_AFD_COMPLETE_ASYNC in SIO_GET_EXTENSION_FUNCTION_POINTER.

Alexandre Julliard julliard at winehq.org
Wed Jun 2 16:27:43 CDT 2021


Module: wine
Branch: master
Commit: 135ae49ff40685271f1992d55fafd7987373fefb
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=135ae49ff40685271f1992d55fafd7987373fefb

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed Jun  2 10:30:19 2021 -0500

ws2_32: Use IOCTL_WINE_AFD_COMPLETE_ASYNC in SIO_GET_EXTENSION_FUNCTION_POINTER.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ws2_32/socket.c     | 26 +++++++++++++-------------
 dlls/ws2_32/tests/sock.c | 27 ++++++++++++---------------
 2 files changed, 25 insertions(+), 28 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 0fc13344ee2..79085cf0c2a 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -3515,29 +3515,29 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
             EXTENSION_FUNCTION(WSAID_WSASENDMSG, WSASendMsg)
         };
 #undef EXTENSION_FUNCTION
-        BOOL found = FALSE;
         unsigned int i;
 
         for (i = 0; i < ARRAY_SIZE(guid_funcs); i++)
         {
             if (IsEqualGUID(&guid_funcs[i].guid, in_buff))
             {
-                found = TRUE;
-                break;
-            }
-        }
+                NTSTATUS status = STATUS_SUCCESS;
+                DWORD ret = 0;
 
-        if (found)
-        {
-            TRACE("-> got %s\n", guid_funcs[i].name);
-            *(void **)out_buff = guid_funcs[i].func_ptr;
-            total = sizeof(void *);
-            break;
+                TRACE( "returning %s\n", guid_funcs[i].name );
+                *(void **)out_buff = guid_funcs[i].func_ptr;
+
+                ret = server_ioctl_sock( s, IOCTL_AFD_WINE_COMPLETE_ASYNC, &status, sizeof(status),
+                                         NULL, 0, ret_size, overlapped, completion );
+                *ret_size = sizeof(void *);
+                SetLastError( ret );
+                return ret ? -1 : 0;
+            }
         }
 
         FIXME("SIO_GET_EXTENSION_FUNCTION_POINTER %s: stub\n", debugstr_guid(in_buff));
-        status = WSAEOPNOTSUPP;
-        break;
+        SetLastError( WSAEOPNOTSUPP );
+        return -1;
     }
     case WS_SIO_KEEPALIVE_VALS:
     {
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index fe7f155a8d8..c0b1abcaaa5 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -4231,7 +4231,7 @@ static void test_get_extension_func(void)
     ret = WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, &acceptex_guid, sizeof(GUID),
             &func, sizeof(func), &size, NULL, NULL);
     ok(!ret, "expected success\n");
-    todo_wine ok(!WSAGetLastError(), "got error %u\n", WSAGetLastError());
+    ok(!WSAGetLastError(), "got error %u\n", WSAGetLastError());
     ok(size == sizeof(func), "got size %u\n", size);
 
     WSASetLastError(0xdeadbeef);
@@ -4241,16 +4241,16 @@ static void test_get_extension_func(void)
     ret = WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, &acceptex_guid, sizeof(GUID),
             &func, sizeof(func), &size, &overlapped, NULL);
     ok(!ret, "expected success\n");
-    todo_wine ok(!WSAGetLastError(), "got error %u\n", WSAGetLastError());
+    ok(!WSAGetLastError(), "got error %u\n", WSAGetLastError());
     ok(size == sizeof(func), "got size %u\n", size);
 
     ret = GetQueuedCompletionStatus(port, &size, &key, &overlapped_ptr, 0);
     ok(ret, "got error %u\n", GetLastError());
-    todo_wine ok(!size, "got size %u\n", size);
+    ok(!size, "got size %u\n", size);
     ok(key == 123, "got key %Iu\n", key);
     ok(overlapped_ptr == &overlapped, "got overlapped %p\n", overlapped_ptr);
     ok(!overlapped.Internal, "got status %#x\n", (NTSTATUS)overlapped.Internal);
-    todo_wine ok(!overlapped.InternalHigh, "got size %Iu\n", overlapped.InternalHigh);
+    ok(!overlapped.InternalHigh, "got size %Iu\n", overlapped.InternalHigh);
 
     size = 0xdeadbeef;
     overlapped.Internal = 0xdeadbeef;
@@ -4260,12 +4260,12 @@ static void test_get_extension_func(void)
     ok(ret == -1, "expected failure\n");
     todo_wine ok(WSAGetLastError() == WSAEINVAL, "got error %u\n", WSAGetLastError());
     ok(size == 0xdeadbeef, "got size %u\n", size);
-    todo_wine ok(overlapped.Internal == 0xdeadbeef, "got status %#x\n", (NTSTATUS)overlapped.Internal);
-    todo_wine ok(overlapped.InternalHigh == 0xdeadbeef, "got size %Iu\n", overlapped.InternalHigh);
+    ok(overlapped.Internal == 0xdeadbeef, "got status %#x\n", (NTSTATUS)overlapped.Internal);
+    ok(overlapped.InternalHigh == 0xdeadbeef, "got size %Iu\n", overlapped.InternalHigh);
 
     ret = GetQueuedCompletionStatus(port, &size, &key, &overlapped_ptr, 0);
     ok(!ret, "expected failure\n");
-    todo_wine ok(GetLastError() == WAIT_TIMEOUT, "got error %u\n", WSAGetLastError());
+    ok(GetLastError() == WAIT_TIMEOUT, "got error %u\n", WSAGetLastError());
 
     CloseHandle(port);
     closesocket(s);
@@ -4285,14 +4285,11 @@ static void test_get_extension_func(void)
     ok(size == sizeof(func), "got size %u\n", size);
 
     ret = SleepEx(0, TRUE);
-    todo_wine 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);
-        ok(!apc_error, "got APC error %u\n", apc_error);
-        ok(!apc_size, "got APC size %u\n", apc_size);
-        ok(apc_overlapped == &overlapped, "got APC overlapped %p\n", apc_overlapped);
-    }
+    ok(ret == WAIT_IO_COMPLETION, "got %d\n", ret);
+    ok(apc_count == 1, "APC was called %u times\n", apc_count);
+    ok(!apc_error, "got APC error %u\n", apc_error);
+    ok(!apc_size, "got APC size %u\n", apc_size);
+    ok(apc_overlapped == &overlapped, "got APC overlapped %p\n", apc_overlapped);
 
     closesocket(s);
 }




More information about the wine-cvs mailing list