[1/2] ws2_32: negate return value of SIOCATMARK

André Hentschel nerv at dawncrow.de
Wed Nov 4 13:31:26 CST 2009


The Kernel ioctl returns TRUE if the actual socket data is urgent and FALSE if it is not.
Windows ioctl returns TRUE if it is not and FALSE if it is urgent.
So Wine has to negate the value.
---
 dlls/ws2_32/socket.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index df9c37d..5334d62 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -2651,6 +2651,7 @@ int WINAPI WS_ioctlsocket(SOCKET s, LONG cmd, WS_u_long *argp)
 {
     int fd;
     LONG newcmd  = cmd;
+    BOOL negate = FALSE;
 
     TRACE("socket %04lx, cmd %08x, ptr %p\n", s, cmd, argp);
     /* broken apps like defcon pass the argp value directly instead of a pointer to it */
@@ -2681,6 +2682,7 @@ int WINAPI WS_ioctlsocket(SOCKET s, LONG cmd, WS_u_long *argp)
         return 0;
 
     case WS_SIOCATMARK:
+        negate=TRUE;
         newcmd=SIOCATMARK;
         break;
 
@@ -2711,6 +2713,7 @@ int WINAPI WS_ioctlsocket(SOCKET s, LONG cmd, WS_u_long *argp)
         if( ioctl(fd, newcmd, (char*)argp ) == 0 )
         {
             release_sock_fd( s, fd );
+            if( negate ) *argp=!*argp;
             return 0;
         }
         SetLastError((errno == EBADF) ? WSAENOTSOCK : wsaErrno());
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list