Zebediah Figura : server: Implement IOCTL_AFD_GET_EVENTS.

Alexandre Julliard julliard at winehq.org
Tue Jun 15 16:19:27 CDT 2021


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Tue Jun 15 10:39:43 2021 -0500

server: Implement IOCTL_AFD_GET_EVENTS.

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

---

 dlls/ntdll/unix/socket.c |  6 ++++++
 include/wine/afd.h       |  7 +++++++
 server/sock.c            | 22 ++++++++++++++++++++++
 3 files changed, 35 insertions(+)

diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c
index 088f29f85ff..3b8206474f0 100644
--- a/dlls/ntdll/unix/socket.c
+++ b/dlls/ntdll/unix/socket.c
@@ -1181,6 +1181,12 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc
             break;
         }
 
+        case IOCTL_AFD_GET_EVENTS:
+            if (in_size) FIXME( "unexpected input size %u\n", in_size );
+
+            status = STATUS_BAD_DEVICE_TYPE;
+            break;
+
         case IOCTL_AFD_RECV:
         {
             const struct afd_recv_params *params = in_buffer;
diff --git a/include/wine/afd.h b/include/wine/afd.h
index 2eb3e6f12a9..46d242c7582 100644
--- a/include/wine/afd.h
+++ b/include/wine/afd.h
@@ -36,6 +36,7 @@
 #define IOCTL_AFD_RECV                      CTL_CODE(FILE_DEVICE_BEEP, 0x805, METHOD_NEITHER,  FILE_ANY_ACCESS)
 #define IOCTL_AFD_POLL                      CTL_CODE(FILE_DEVICE_BEEP, 0x809, METHOD_BUFFERED, FILE_ANY_ACCESS)
 #define IOCTL_AFD_EVENT_SELECT              CTL_CODE(FILE_DEVICE_BEEP, 0x821, METHOD_NEITHER,  FILE_ANY_ACCESS)
+#define IOCTL_AFD_GET_EVENTS                CTL_CODE(FILE_DEVICE_BEEP, 0x822, METHOD_NEITHER,  FILE_ANY_ACCESS)
 
 enum afd_poll_bit
 {
@@ -125,6 +126,12 @@ struct afd_event_select_params_32
     int mask;
 };
 
+struct afd_get_events_params
+{
+    int flags;
+    NTSTATUS status[13];
+};
+
 #define IOCTL_AFD_WINE_CREATE               CTL_CODE(FILE_DEVICE_NETWORK, 200, METHOD_BUFFERED, FILE_ANY_ACCESS)
 #define IOCTL_AFD_WINE_ACCEPT               CTL_CODE(FILE_DEVICE_NETWORK, 201, METHOD_BUFFERED, FILE_ANY_ACCESS)
 #define IOCTL_AFD_WINE_ACCEPT_INTO          CTL_CODE(FILE_DEVICE_NETWORK, 202, METHOD_BUFFERED, FILE_ANY_ACCESS)
diff --git a/server/sock.c b/server/sock.c
index 3556ee21aa3..1d992d8f9e4 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -2011,6 +2011,28 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
         }
         return 1;
 
+    case IOCTL_AFD_GET_EVENTS:
+    {
+        struct afd_get_events_params params = {0};
+        unsigned int i;
+
+        if (get_reply_max_size() < sizeof(params))
+        {
+            set_error( STATUS_INVALID_PARAMETER );
+            return 0;
+        }
+
+        params.flags = sock->pending_events & sock->mask;
+        for (i = 0; i < ARRAY_SIZE( params.status ); ++i)
+            params.status[i] = sock_get_ntstatus( sock->errors[i] );
+
+        sock->pending_events = 0;
+        sock_reselect( sock );
+
+        set_reply_data( &params, sizeof(params) );
+        return 0;
+    }
+
     case IOCTL_AFD_EVENT_SELECT:
     {
         struct event *event = NULL;




More information about the wine-cvs mailing list