Improvement of WSAIoctl

Axel Petzold contributions at petzi-net.de
Tue Mar 27 13:59:55 CDT 2007


Hi,

some days ago, I tried to run the retail management software, we are developing in our
company now for over 15 years, with Wine on Linux. Unfortunatly it didn't work.

The reason was not our product itself, but the ODBC driver form MS for MS-SQL-Server. It
uses a command for WSAIoctl in ws2_32.dll, wich isn't implemented in Wine yet. Because
of the lack of this command, the driver fails and our software does not work.

With other databases it works great, but unfortunatly most of our customers prefer using
MS-SQL-Server, so this piece of MS-Software is a must for us.

Searching through MSDN I noticed, that this missing command is a part of Windows from
Win2k on. Although it is declared as "vendor specific", if it is missing on Win2k or
later, the ODBC driver does not work.

But due to the needs of our product, I cannot change the windows version to WinNT or
something like that. So, I need that command implemented in Wine and created the
attached patch.

Changelog:
- Include file mstcpip.h added:
- WSAIoctl in ws2_32.dll extended by the following commands:
      WS_SIO_KEEPALIVE_VALS - partly implemented
      WS_SIO_RCVALL - stub
      WS_SIO_RCVALL_MCAST - stub
      WS_SIO_RCVALL_IGMPMCAST - stub

Cheers,
Axel


diff -u -r -N a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
--- a/dlls/ws2_32/socket.c	2007-03-16 17:40:46.000000000 +0100
+++ b/dlls/ws2_32/socket.c	2007-03-24 17:22:20.000000000 +0100
@@ -130,6 +130,7 @@
  #include "winnls.h"
  #include "winsock2.h"
  #include "mswsock.h"
+#include "mstcpip.h"
  #include "ws2tcpip.h"
  #include "ws2spi.h"
  #include "wsipx.h"
@@ -2468,6 +2469,36 @@
  	FIXME("SIO_FLUSH: stub.\n");
  	break;

+   case WS_SIO_RCVALL:
+        FIXME("SIO_RCVALL: not supported.\n");
+        WSASetLastError(WSAEOPNOTSUPP);
+        return SOCKET_ERROR;
+
+   case WS_SIO_RCVALL_MCAST:
+        FIXME("SIO_RCVALL_MCAST: not supported.\n");
+        WSASetLastError(WSAEOPNOTSUPP);
+        return SOCKET_ERROR;
+
+   case WS_SIO_RCVALL_IGMPMCAST:
+        FIXME("SIO_RCVALL_IGMPMCAST: not supported.\n");
+        WSASetLastError(WSAEOPNOTSUPP);
+        return SOCKET_ERROR;
+
+   case WS_SIO_KEEPALIVE_VALS:
+   {
+        /* FIXME: not fully implemented */
+        BOOL value;
+
+        if (cbInBuffer < sizeof(struct tcp_keepalive) || !lpvInBuffer)
+        {
+            WSASetLastError(WSAEFAULT);
+            return SOCKET_ERROR;
+        }
+
+        value = ((struct tcp_keepalive *)lpvInBuffer)->onoff;
+        return WS_setsockopt(s, WS_SOL_SOCKET, WS_SO_KEEPALIVE, (char *)&value, sizeof(BOOL));
+   }
+
     default:
         FIXME("unsupported WS_IOCTL cmd (%08x)\n", dwIoControlCode);
         WSASetLastError(WSAEOPNOTSUPP);
diff -u -r -N a/include/mstcpip.h b/include/mstcpip.h
--- a/include/mstcpip.h	1970-01-01 01:00:00.000000000 +0100
+++ b/include/mstcpip.h	2007-03-24 20:39:26.000000000 +0100
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) the Wine project
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+#ifndef _MSTCPIP_
+#define _MSTCPIP_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef USE_WS_PREFIX
+#define SIO_RCVALL            _WSAIOW(IOC_VENDOR,1)
+#define SIO_RCVALL_MCAST      _WSAIOW(IOC_VENDOR,2)
+#define SIO_RCVALL_IGMPMCAST  _WSAIOW(IOC_VENDOR,3)
+#define SIO_KEEPALIVE_VALS    _WSAIOW(IOC_VENDOR,4)
+#define SIO_ABSORB_RTRALERT   _WSAIOW(IOC_VENDOR,5)
+#define SIO_UCAST_IF          _WSAIOW(IOC_VENDOR,6)
+#define SIO_LIMIT_BROADCASTS  _WSAIOW(IOC_VENDOR,7)
+#define SIO_INDEX_BIND        _WSAIOW(IOC_VENDOR,8)
+#define SIO_INDEX_MCASTIF     _WSAIOW(IOC_VENDOR,9)
+#define SIO_INDEX_ADD_MCAST   _WSAIOW(IOC_VENDOR,10)
+#define SIO_INDEX_DEL_MCAST   _WSAIOW(IOC_VENDOR,11)
+#else
+#define WS_SIO_RCVALL            _WSAIOW(WS_IOC_VENDOR,1)
+#define WS_SIO_RCVALL_MCAST      _WSAIOW(WS_IOC_VENDOR,2)
+#define WS_SIO_RCVALL_IGMPMCAST  _WSAIOW(WS_IOC_VENDOR,3)
+#define WS_SIO_KEEPALIVE_VALS    _WSAIOW(WS_IOC_VENDOR,4)
+#define WS_SIO_ABSORB_RTRALERT   _WSAIOW(WS_IOC_VENDOR,5)
+#define WS_SIO_UCAST_IF          _WSAIOW(WS_IOC_VENDOR,6)
+#define WS_SIO_LIMIT_BROADCASTS  _WSAIOW(WS_IOC_VENDOR,7)
+#define WS_SIO_INDEX_BIND        _WSAIOW(WS_IOC_VENDOR,8)
+#define WS_SIO_INDEX_MCASTIF     _WSAIOW(WS_IOC_VENDOR,9)
+#define WS_SIO_INDEX_ADD_MCAST   _WSAIOW(WS_IOC_VENDOR,10)
+#define WS_SIO_INDEX_DEL_MCAST   _WSAIOW(WS_IOC_VENDOR,11)
+#endif
+
+struct tcp_keepalive {
+    u_long  onoff;
+    u_long  keepalivetime;
+    u_long  keepaliveinterval;
+};
+
+#ifndef USE_WS_PREFIX
+#define RCVALL_OFF             0
+#define RCVALL_ON              1
+#define RCVALL_SOCKETLEVELONLY 2
+#else
+#define WS_RCVALL_OFF             0
+#define WS_RCVALL_ON              1
+#define WS_RCVALL_SOCKETLEVELONLY 2
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif



More information about the wine-patches mailing list