Zebediah Figura : server: Introduce IOCTL_AFD_WINE_GET_SO_ERROR.

Alexandre Julliard julliard at winehq.org
Thu Jun 24 16:16:44 CDT 2021


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu Jun 24 00:00:10 2021 -0500

server: Introduce IOCTL_AFD_WINE_GET_SO_ERROR.

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

---

 include/wine/afd.h |  1 +
 server/sock.c      | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/include/wine/afd.h b/include/wine/afd.h
index 6370e00539f..0ccd248e614 100644
--- a/include/wine/afd.h
+++ b/include/wine/afd.h
@@ -162,6 +162,7 @@ struct afd_get_events_params
 #define IOCTL_AFD_WINE_GET_SO_ACCEPTCONN    CTL_CODE(FILE_DEVICE_NETWORK, 219, METHOD_BUFFERED, FILE_ANY_ACCESS)
 #define IOCTL_AFD_WINE_GET_SO_BROADCAST     CTL_CODE(FILE_DEVICE_NETWORK, 220, METHOD_BUFFERED, FILE_ANY_ACCESS)
 #define IOCTL_AFD_WINE_SET_SO_BROADCAST     CTL_CODE(FILE_DEVICE_NETWORK, 221, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_AFD_WINE_GET_SO_ERROR         CTL_CODE(FILE_DEVICE_NETWORK, 222, METHOD_BUFFERED, FILE_ANY_ACCESS)
 
 struct afd_create_params
 {
diff --git a/server/sock.c b/server/sock.c
index 71f22845827..f614bf5feaa 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -2546,6 +2546,40 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
         return 1;
     }
 
+    case IOCTL_AFD_WINE_GET_SO_ERROR:
+    {
+        int error;
+        socklen_t len = sizeof(error);
+        unsigned int i;
+
+        if (get_reply_max_size() < sizeof(error))
+        {
+            set_error( STATUS_BUFFER_TOO_SMALL );
+            return 0;
+        }
+
+        if (getsockopt( unix_fd, SOL_SOCKET, SO_ERROR, (char *)&error, &len ) < 0)
+        {
+            set_error( sock_get_ntstatus( errno ) );
+            return 0;
+        }
+
+        if (!error)
+        {
+            for (i = 0; i < ARRAY_SIZE( sock->errors ); ++i)
+            {
+                if (sock->errors[i])
+                {
+                    error = sock->errors[i];
+                    break;
+                }
+            }
+        }
+
+        set_reply_data( &error, sizeof(error) );
+        return 1;
+    }
+
     default:
         set_error( STATUS_NOT_SUPPORTED );
         return 0;




More information about the wine-cvs mailing list