Francois Gouget wrote:
> On Fri, 29 Dec 2000, Ulrich Weigand wrote:
> [...]
> > It simply means that we will always have problems when we try to
> > use either OS-dependent or CPU specific features in Windows headers.
> > See e.g. my other mail on the winsock.h problems ...
>
> It seems I missed your other mail. But anyway, 'we' have a plan for
> 'winsock.h'. It's outlined in bug 118:
> "winsock.h should not depend on the native 'socket' headers"
> http://wine.codeweavers.com/bugzilla/show_bug.cgi?id=118
Yes, this is exactly the problem I was talking about in that other mail ;-)
> Basically the is to rewrite 'winsock.h' like we will for all the
> msvcrt headers.
Are you already working on this? This is currently one of the remaining
issues blocking the compile of every single Winelib app on Sparc (because
windows.h includes winsock.h :-(), therefore I'd like to find a
--maybe not perfect-- solution in the short term ...
I've made a quick try at removing the system headers; with the following
patch Wine at least compiles. (Winelib apps actually *using* winsock
will probably not work ...)
Any comments?
Bye,
Ulrich
diff -ur wine-cvs/dlls/wininet/ftp.c wine-uw/dlls/wininet/ftp.c
--- wine-cvs/dlls/wininet/ftp.c Fri Dec 29 14:50:44 2000
+++ wine-uw/dlls/wininet/ftp.c Fri Dec 29 19:29:27 2000
@@ -1275,7 +1275,7 @@
INTERNET_PORT nServerPort, LPCSTR lpszUserName,
LPCSTR lpszPassword, DWORD dwFlags, DWORD dwContext)
{
- struct sockaddr_in socketAddr;
+ struct ws_sockaddr_in socketAddr;
struct hostent *phe = NULL;
INT nsocket = INVALID_SOCKET, sock_namelen;
LPWININETAPPINFOA hIC = NULL;
@@ -1862,7 +1862,7 @@
int i;
char *pAddr, *pPort;
INT nsocket = INVALID_SOCKET;
- struct sockaddr_in dataSocketAddress;
+ struct ws_sockaddr_in dataSocketAddress;
p = lpszResponseBuffer+4; /* skip status code */
diff -ur wine-cvs/dlls/wininet/internet.h wine-uw/dlls/wininet/internet.h
--- wine-cvs/dlls/wininet/internet.h Fri Dec 29 14:50:44 2000
+++ wine-uw/dlls/wininet/internet.h Fri Dec 29 19:28:54 2000
@@ -39,7 +39,7 @@
LPSTR lpszServerName;
LPSTR lpszUserName;
INTERNET_PORT nServerPort;
- struct sockaddr_in socketAddress;
+ struct ws_sockaddr_in socketAddress;
struct hostent *phostent;
} WININETHTTPSESSIONA, *LPWININETHTTPSESSIONA;
@@ -75,8 +75,8 @@
int sndSocket;
int lstnSocket;
int pasvSocket; /* data socket connected by us in case of passive FTP */
- struct sockaddr_in socketAddress;
- struct sockaddr_in lstnSocketAddress;
+ struct ws_sockaddr_in socketAddress;
+ struct ws_sockaddr_in lstnSocketAddress;
struct hostent *phostent;
LPSTR lpszPassword;
LPSTR lpszUserName;
@@ -187,7 +187,7 @@
LPCSTR lpszPassword, DWORD dwFlags, DWORD dwContext);
BOOL GetAddress(LPCSTR lpszServerName, INTERNET_PORT nServerPort,
- struct hostent **phe, struct sockaddr_in *psa);
+ struct hostent **phe, struct ws_sockaddr_in *psa);
int INTERNET_WriteDataToStream(int nDataSocket, LPCVOID Buffer, DWORD BytesToWrite);
int INTERNET_ReadDataFromStream(int nDataSocket, LPVOID Buffer, DWORD BytesToRead);
diff -ur wine-cvs/dlls/wininet/utility.c wine-uw/dlls/wininet/utility.c
--- wine-cvs/dlls/wininet/utility.c Sun Dec 10 15:45:05 2000
+++ wine-uw/dlls/wininet/utility.c Fri Dec 29 19:31:01 2000
@@ -13,6 +13,10 @@
#include <string.h>
#include <time.h>
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif /* HAVE_NETDB_H */
+
#include "windef.h"
#include "winbase.h"
#include "wininet.h"
@@ -112,7 +116,7 @@
BOOL GetAddress(LPCSTR lpszServerName, INTERNET_PORT nServerPort,
- struct hostent **phe, struct sockaddr_in *psa)
+ struct hostent **phe, struct ws_sockaddr_in *psa)
{
TRACE("%s\n", lpszServerName);
diff -ur wine-cvs/dlls/wsock32/socket.c wine-uw/dlls/wsock32/socket.c
--- wine-cvs/dlls/wsock32/socket.c Sun Dec 3 00:46:10 2000
+++ wine-uw/dlls/wsock32/socket.c Fri Dec 29 19:33:01 2000
@@ -18,6 +18,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
#ifdef HAVE_SYS_SOCKIO_H
# include <sys/sockio.h>
#endif
diff -ur wine-cvs/include/wine/winsock16.h wine-uw/include/wine/winsock16.h
--- wine-cvs/include/wine/winsock16.h Wed Sep 27 00:20:53 2000
+++ wine-uw/include/wine/winsock16.h Fri Dec 29 19:14:37 2000
@@ -6,10 +6,12 @@
typedef UINT16 SOCKET16;
+#define WS_FD_SETSIZE 64
+
typedef struct
{
UINT16 fd_count; /* how many are SET? */
- SOCKET16 fd_array[FD_SETSIZE]; /* an array of SOCKETs */
+ SOCKET16 fd_array[WS_FD_SETSIZE]; /* an array of SOCKETs */
} ws_fd_set16;
/* ws_hostent16, ws_protoent16, ws_servent16, ws_netent16
diff -ur wine-cvs/include/winsock.h wine-uw/include/winsock.h
--- wine-cvs/include/winsock.h Sun Dec 10 15:45:27 2000
+++ wine-uw/include/winsock.h Fri Dec 29 19:13:05 2000
@@ -7,37 +7,6 @@
#ifndef _WINSOCKAPI_
#define _WINSOCKAPI_
-#ifndef RC_INVOKED
-#include <sys/types.h>
-
-/* Solaris uses these macro names */
-#undef FSHIFT
-#undef TRANSPARENT
-#include <netinet/in.h>
-/* Restore the Windows values */
-#ifdef _WINUSER_
-#undef FSHIFT
-#define FSHIFT 0x04
-#endif
-#ifdef _WINGDI_
-#undef TRANSPARENT
-#define TRANSPARENT 1
-#endif
-
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif /* HAVE_ARPA_INET_H */
-#include <sys/time.h>
-#include <fcntl.h>
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif /* HAVE_NETDB_H */
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif /* HAVE_SYS_SOCKET_H */
-#include <sys/ioctl.h>
-#endif /* RC_INVOKED */
-
#include "windef.h"
#ifdef __cplusplus
@@ -74,20 +43,26 @@
{
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
short n_addrtype; /* net address type */
- u_long n_net; /* network # */
+ ULONG n_net; /* network # */
} _ws_netent;
#include "pshpack1.h"
typedef UINT SOCKET;
-typedef struct sockaddr ws_sockaddr;
+typedef struct ws_sockaddr
+{
+ USHORT sa_family; /* address family */
+ BYTE sa_data[14]; /* address data */
+} ws_sockaddr;
+
+#define WS_FD_SETSIZE 64
typedef struct ws_fd_set32_struct
{
UINT fd_count; /* how many are SET? */
- SOCKET fd_array[FD_SETSIZE]; /* an array of SOCKETs */
+ SOCKET fd_array[WS_FD_SETSIZE]; /* an array of SOCKETs */
} ws_fd_set32;
@@ -115,7 +90,7 @@
#define WS_FD_CLR(fd, set) __WS_FD_CLR((fd),(set), ws_fd_set32)
#define __WS_FD_SET(fd, set, cast) do { \
- if (((cast*)(set))->fd_count < FD_SETSIZE) \
+ if (((cast*)(set))->fd_count < WS_FD_SETSIZE) \
((cast*)(set))->fd_array[((cast*)(set))->fd_count++]=(fd);\
} while(0)
#define WS_FD_SET(fd, set) __WS_FD_SET((fd),(set), ws_fd_set32)
@@ -226,10 +201,10 @@
* Socket I/O flags (supported by spec 1.1)
*/
-#define WS_FIONREAD WS_IOR('f', 127, u_long)
-#define WS_FIONBIO WS_IOW('f', 126, u_long)
+#define WS_FIONREAD WS_IOR('f', 127, ULONG)
+#define WS_FIONBIO WS_IOW('f', 126, ULONG)
-#define WS_SIOCATMARK WS_IOR('s', 7, u_long)
+#define WS_SIOCATMARK WS_IOR('s', 7, ULONG)
/*
* Maximum queue length specifiable by listen.
diff -ur wine-cvs/include/winsock2.h wine-uw/include/winsock2.h
--- wine-cvs/include/winsock2.h Sun Dec 10 15:45:27 2000
+++ wine-uw/include/winsock2.h Fri Dec 29 18:12:26 2000
@@ -62,7 +62,7 @@
#define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
#define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
#define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_W32,24)
-#define SIO_GET_INTERFACE_LIST WS_IOR ('t', 127, u_long)
+#define SIO_GET_INTERFACE_LIST WS_IOR ('t', 127, ULONG)
/* Unfortunately the sockaddr_in6 structure doesn't
seem to be defined in a standard place, even across
@@ -79,15 +79,15 @@
};
struct ws_sockaddr_in6
{
- short sin6_family; /* AF_INET6 */
- u_short sin6_port; /* Transport level port number */
- u_long sin6_flowinfo; /* IPv6 flow information */
+ SHORT sin6_family; /* AF_INET6 */
+ USHORT sin6_port; /* Transport level port number */
+ ULONG sin6_flowinfo; /* IPv6 flow information */
struct ws_in_addr6 sin6_addr; /* IPv6 address */
};
typedef union sockaddr_gen
{
- struct sockaddr Address;
+ struct ws_sockaddr Address;
struct ws_sockaddr_in AddressIn;
struct ws_sockaddr_in6 AddressIn6;
} sockaddr_gen;
@@ -122,14 +122,14 @@
{
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
short n_addrtype; /* net address type */
- u_long n_net; /* network # */
+ ULONG n_net; /* network # */
} _ws_netent32;
/* Structure to keep interface specific information */
typedef struct _INTERFACE_INFO
{
- u_long iiFlags; /* Interface flags */
+ ULONG iiFlags; /* Interface flags */
sockaddr_gen iiAddress; /* Interface address */
sockaddr_gen iiBroadcastAddress; /* Broadcast address */
sockaddr_gen iiNetmask; /* Network mask */
--
Dr. Ulrich Weigand
[EMAIL PROTECTED]