[PATCH 4/6] server: Introduce IOCTL_AFD_ACCEPT_INTO.

Zebediah Figura z.figura12 at gmail.com
Thu Oct 1 23:14:00 CDT 2020


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 include/wine/afd.h |  1 +
 server/sock.c      | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/include/wine/afd.h b/include/wine/afd.h
index 9ca03039f81..5a994084e16 100644
--- a/include/wine/afd.h
+++ b/include/wine/afd.h
@@ -25,6 +25,7 @@
 
 #define IOCTL_AFD_CREATE                    CTL_CODE(FILE_DEVICE_NETWORK, 200, METHOD_BUFFERED, FILE_WRITE_ACCESS)
 #define IOCTL_AFD_ACCEPT                    CTL_CODE(FILE_DEVICE_NETWORK, 201, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+#define IOCTL_AFD_ACCEPT_INTO               CTL_CODE(FILE_DEVICE_NETWORK, 202, METHOD_BUFFERED, FILE_WRITE_ACCESS)
 
 #define IOCTL_AFD_ADDRESS_LIST_CHANGE       CTL_CODE(FILE_DEVICE_NETWORK, 323, METHOD_BUFFERED, 0)
 
diff --git a/server/sock.c b/server/sock.c
index 26a2c4fa668..360bf756f96 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -1108,6 +1108,27 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
         return 0;
     }
 
+    case IOCTL_AFD_ACCEPT_INTO:
+    {
+        static const int access = FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES | FILE_READ_DATA;
+        struct sock *acceptsock;
+        obj_handle_t handle;
+
+        if (get_req_data_size() != sizeof(handle))
+        {
+            set_error( STATUS_BUFFER_TOO_SMALL );
+            return 0;
+        }
+        handle = *(obj_handle_t *)get_req_data();
+
+        if (!(acceptsock = (struct sock *)get_handle_obj( current->process, handle, access, &sock_ops )))
+            return 0;
+        if (accept_into_socket( sock, acceptsock ))
+            acceptsock->wparam = handle;
+        release_object( acceptsock );
+        return 0;
+    }
+
     case IOCTL_AFD_ADDRESS_LIST_CHANGE:
         if ((sock->state & FD_WINE_NONBLOCKING) && async_is_blocking( async ))
         {
-- 
2.28.0




More information about the wine-devel mailing list