Zebediah Figura : server: Return a proper NTSTATUS from IOCTL_AFD_ACCEPT.

Alexandre Julliard julliard at winehq.org
Wed May 5 16:09:00 CDT 2021


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Tue May  4 21:42:31 2021 -0500

server: Return a proper NTSTATUS from IOCTL_AFD_ACCEPT.

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

---

 server/sock.c  | 14 +++++++-------
 server/trace.c |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/server/sock.c b/server/sock.c
index 39f02036da8..05fb737283b 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -462,7 +462,7 @@ static void fill_accept_output( struct accept_req *req )
             return;
         }
 
-        set_win32_error( sock_get_error( errno ) );
+        set_error( sock_get_ntstatus( errno ) );
         free( out_data );
         return;
     }
@@ -481,7 +481,7 @@ static void fill_accept_output( struct accept_req *req )
         if (getsockname( fd, &unix_addr.addr, &unix_len ) < 0 ||
             (win_len = sockaddr_from_unix( &unix_addr, win_addr, req->local_len - sizeof(int) )) < 0)
         {
-            set_win32_error( sock_get_error( errno ) );
+            set_error( sock_get_ntstatus( errno ) );
             free( out_data );
             return;
         }
@@ -494,7 +494,7 @@ static void fill_accept_output( struct accept_req *req )
     if (getpeername( fd, &unix_addr.addr, &unix_len ) < 0 ||
         (win_len = sockaddr_from_unix( &unix_addr, win_addr, remote_len - sizeof(int) )) < 0)
     {
-        set_win32_error( sock_get_error( errno ) );
+        set_error( sock_get_ntstatus( errno ) );
         free( out_data );
         return;
     }
@@ -1105,7 +1105,7 @@ static int accept_new_fd( struct sock *sock )
     if (acceptfd != -1)
         fcntl( acceptfd, F_SETFL, O_NONBLOCK );
     else
-        set_win32_error( sock_get_error( errno ));
+        set_error( sock_get_ntstatus( errno ));
     return acceptfd;
 }
 
@@ -1290,7 +1290,7 @@ static int sock_get_ntstatus( int err )
         case EINVAL:            return STATUS_INVALID_PARAMETER;
         case ENFILE:
         case EMFILE:            return STATUS_TOO_MANY_OPENED_FILES;
-        case EWOULDBLOCK:       return STATUS_CANT_WAIT;
+        case EWOULDBLOCK:       return STATUS_DEVICE_NOT_READY;
         case EINPROGRESS:       return STATUS_PENDING;
         case EALREADY:          return STATUS_NETWORK_BUSY;
         case ENOTSOCK:          return STATUS_OBJECT_TYPE_MISMATCH;
@@ -1387,7 +1387,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
             struct accept_req *req;
 
             if (sock->state & FD_WINE_NONBLOCKING) return 0;
-            if (get_error() != (0xc0010000 | WSAEWOULDBLOCK)) return 0;
+            if (get_error() != STATUS_DEVICE_NOT_READY) return 0;
 
             if (!(req = alloc_accept_req( sock, NULL, async, NULL ))) return 0;
             list_add_tail( &sock->accept_list, &req->entry );
@@ -1435,7 +1435,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
         if (acceptsock->accept_recv_req)
         {
             release_object( acceptsock );
-            set_win32_error( WSAEINVAL );
+            set_error( STATUS_INVALID_PARAMETER );
             return 0;
         }
 
diff --git a/server/trace.c b/server/trace.c
index 5dfb40bb2ac..394effabf0e 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -5299,7 +5299,6 @@ static const struct
     { "CANCELLED",                   STATUS_CANCELLED },
     { "CANNOT_DELETE",               STATUS_CANNOT_DELETE },
     { "CANT_OPEN_ANONYMOUS",         STATUS_CANT_OPEN_ANONYMOUS },
-    { "CANT_WAIT",                   STATUS_CANT_WAIT },
     { "CHILD_MUST_BE_VOLATILE",      STATUS_CHILD_MUST_BE_VOLATILE },
     { "CONNECTION_ABORTED",          STATUS_CONNECTION_ABORTED },
     { "CONNECTION_DISCONNECTED",     STATUS_CONNECTION_DISCONNECTED },
@@ -5307,6 +5306,7 @@ static const struct
     { "CONNECTION_RESET",            STATUS_CONNECTION_RESET },
     { "DEBUGGER_INACTIVE",           STATUS_DEBUGGER_INACTIVE },
     { "DEVICE_BUSY",                 STATUS_DEVICE_BUSY },
+    { "DEVICE_NOT_READY",            STATUS_DEVICE_NOT_READY },
     { "DIRECTORY_NOT_EMPTY",         STATUS_DIRECTORY_NOT_EMPTY },
     { "DISK_FULL",                   STATUS_DISK_FULL },
     { "DLL_NOT_FOUND",               STATUS_DLL_NOT_FOUND },




More information about the wine-cvs mailing list