From 7dc9ea8950174c2aec67452b8a99531a66ef5db0 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 29 Sep 2009 20:05:26 +0200 Subject: [PATCH] ws2_32: Make winsock.dll into a stand-alone 16-bit module. --- .gitignore | 1 - configure | 9 + configure.ac | 1 + dlls/Makefile.in | 4 - dlls/winsock.dll16/Makefile.in | 14 ++ .../socket16.c => winsock.dll16/socket.c} | 194 ++++++++++++------ .../winsock.dll16.spec} | 16 +- .../wine => dlls/winsock.dll16}/winsock16.h | 5 +- dlls/ws2_32/Makefile.in | 4 - dlls/ws2_32/socket.c | 8 - 10 files changed, 164 insertions(+), 92 deletions(-) create mode 100644 dlls/winsock.dll16/Makefile.in rename dlls/{ws2_32/socket16.c => winsock.dll16/socket.c} (83%) rename dlls/{ws2_32/winsock.spec => winsock.dll16/winsock.dll16.spec} (87%) rename {include/wine => dlls/winsock.dll16}/winsock16.h (97%) diff --git a/.gitignore b/.gitignore index 063b358112e..f69a938eba9 100644 --- a/.gitignore +++ b/.gitignore @@ -122,7 +122,6 @@ dlls/stdole32.tlb/std_ole_v1.tlb dlls/user.exe16 dlls/ver.dll16 dlls/wineps16.drv16 -dlls/winsock.dll16 dlls/wprocs.dll16 include/activaut.h include/activdbg.h diff --git a/configure b/configure index 76d1fdaa6e2..70a62bb6dcf 100755 --- a/configure +++ b/configure @@ -17193,6 +17193,14 @@ ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS dlls/winscard/Makefile: dlls/winscard/Makefile.in dlls/Makedll.rules" ac_config_files="$ac_config_files dlls/winscard/Makefile" +ALL_MAKEFILES="$ALL_MAKEFILES \\ + dlls/winsock.dll16/Makefile" +test "x$enable_win16" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ + winsock.dll16" +ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS +dlls/winsock.dll16/Makefile: dlls/winsock.dll16/Makefile.in dlls/Makedll.rules" +ac_config_files="$ac_config_files dlls/winsock.dll16/Makefile" + ALL_MAKEFILES="$ALL_MAKEFILES \\ dlls/winspool.drv/Makefile" test "x$enable_winspool_drv" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ @@ -19128,6 +19136,7 @@ do "dlls/winnls.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winnls.dll16/Makefile" ;; "dlls/winnls32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winnls32/Makefile" ;; "dlls/winscard/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winscard/Makefile" ;; + "dlls/winsock.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winsock.dll16/Makefile" ;; "dlls/winspool.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winspool.drv/Makefile" ;; "dlls/winspool.drv/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winspool.drv/tests/Makefile" ;; "dlls/wintab.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wintab.dll16/Makefile" ;; diff --git a/configure.ac b/configure.ac index 00011f473a2..0c1c0bfaffa 100644 --- a/configure.ac +++ b/configure.ac @@ -2510,6 +2510,7 @@ WINE_CONFIG_MAKEFILE([dlls/winmm/tests/Makefile],[dlls/Maketest.rules],[dlls],[A WINE_CONFIG_MAKEFILE([dlls/winnls.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) WINE_CONFIG_MAKEFILE([dlls/winnls32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/winscard/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) +WINE_CONFIG_MAKEFILE([dlls/winsock.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) WINE_CONFIG_MAKEFILE([dlls/winspool.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/winspool.drv/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) WINE_CONFIG_MAKEFILE([dlls/wintab.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) diff --git a/dlls/Makefile.in b/dlls/Makefile.in index de9a8230a9e..40b96d0276e 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -26,7 +26,6 @@ WIN16_FILES = \ user.exe16 \ ver.dll16 \ wineps16.drv16 \ - winsock.dll16 \ wprocs.dll16 @MAKE_RULES@ @@ -64,9 +63,6 @@ wineps16.drv16: mmsystem.dll16: echo "winmm.dll" >$@ -winsock.dll16: - echo "ws2_32.dll" >$@ - # Import libraries STATIC_IMPLIBEXT = $(IMPLIBEXT:def=def.a) diff --git a/dlls/winsock.dll16/Makefile.in b/dlls/winsock.dll16/Makefile.in new file mode 100644 index 00000000000..fc90dc4d414 --- /dev/null +++ b/dlls/winsock.dll16/Makefile.in @@ -0,0 +1,14 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = winsock.dll16 +IMPORTS = ws2_32 kernel32 +DELAYIMPORTS = user32 +EXTRADLLFLAGS = -Wb,--subsystem,win16,--main-module,ws2_32.dll + +C_SRCS = socket.c + +@MAKE_DLL_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/ws2_32/socket16.c b/dlls/winsock.dll16/socket.c similarity index 83% rename from dlls/ws2_32/socket16.c rename to dlls/winsock.dll16/socket.c index 92a37e33477..ac325cd67a6 100644 --- a/dlls/ws2_32/socket16.c +++ b/dlls/winsock.dll16/socket.c @@ -20,11 +20,10 @@ */ #include "config.h" -#include "wine/port.h" #include "winsock2.h" #include "wine/winbase16.h" -#include "wine/winsock16.h" +#include "winsock16.h" #include "wownt32.h" #include "winuser.h" #include "wine/debug.h" @@ -91,7 +90,7 @@ static SEGPTR dbuffer_seg; extern int WINAPI WS_gethostname(char *name, int namelen); -static WS_fd_set *ws_fdset_16_to_32( const ws_fd_set16 *set16, WS_fd_set *set32 ) +static fd_set *ws_fdset_16_to_32( const ws_fd_set16 *set16, fd_set *set32 ) { UINT i; set32->fd_count = set16->fd_count; @@ -99,7 +98,7 @@ static WS_fd_set *ws_fdset_16_to_32( const ws_fd_set16 *set16, WS_fd_set *set32 return set32; } -static ws_fd_set16 *ws_fdset_32_to_16( const WS_fd_set *set32, ws_fd_set16 *set16 ) +static ws_fd_set16 *ws_fdset_32_to_16( const fd_set *set32, ws_fd_set16 *set16 ) { UINT i; set16->fd_count = set32->fd_count; @@ -191,7 +190,7 @@ static SEGPTR get_buffer_pe(int size) * and handle all Win16/Win32 dependent things (struct size, ...) *correctly*. * Ditto for protoent and servent. */ -static SEGPTR ws_hostent_32_to_16( const struct WS_hostent* he, SEGPTR base, int *buff_size ) +static SEGPTR ws_hostent_32_to_16( const struct hostent* he, SEGPTR base, int *buff_size ) { char *p; struct ws_hostent16 *p_to; @@ -230,7 +229,7 @@ static SEGPTR ws_hostent_32_to_16( const struct WS_hostent* he, SEGPTR base, int return base; } -static SEGPTR ws_protoent_32_to_16( const struct WS_protoent *pe, SEGPTR base, int *buff_size ) +static SEGPTR ws_protoent_32_to_16( const struct protoent *pe, SEGPTR base, int *buff_size ) { char *p; struct ws_protoent16 *p_to; @@ -264,7 +263,7 @@ static SEGPTR ws_protoent_32_to_16( const struct WS_protoent *pe, SEGPTR base, i return base; } -static SEGPTR ws_servent_32_to_16( const struct WS_servent *se, SEGPTR base, int *buff_size ) +static SEGPTR ws_servent_32_to_16( const struct servent *se, SEGPTR base, int *buff_size ) { char *p; struct ws_servent16 *p_to; @@ -308,9 +307,9 @@ static DWORD WINAPI async_gethostbyname(LPVOID arg) struct async_query_gethostbyname *aq = arg; int size = 0; WORD fail = 0; - struct WS_hostent *he; + struct hostent *he; - if ((he = WS_gethostbyname( aq->host_name ))) + if ((he = gethostbyname( aq->host_name ))) { size = aq->query.sbuflen; if (!ws_hostent_32_to_16( he, aq->query.sbuf, &size )) fail = WSAENOBUFS; @@ -325,9 +324,9 @@ static DWORD WINAPI async_gethostbyaddr(LPVOID arg) struct async_query_gethostbyaddr *aq = arg; int size = 0; WORD fail = 0; - struct WS_hostent *he; + struct hostent *he; - if ((he = WS_gethostbyaddr(aq->host_addr,aq->host_len,aq->host_type))) + if ((he = gethostbyaddr(aq->host_addr,aq->host_len,aq->host_type))) { size = aq->query.sbuflen; if (!ws_hostent_32_to_16( he, aq->query.sbuf, &size )) fail = WSAENOBUFS; @@ -342,9 +341,9 @@ static DWORD WINAPI async_getprotobyname(LPVOID arg) struct async_query_getprotobyname *aq = arg; int size = 0; WORD fail = 0; - struct WS_protoent *pe; + struct protoent *pe; - if ((pe = WS_getprotobyname(aq->proto_name))) + if ((pe = getprotobyname(aq->proto_name))) { size = aq->query.sbuflen; if (!ws_protoent_32_to_16( pe, aq->query.sbuf, &size )) fail = WSAENOBUFS; @@ -359,9 +358,9 @@ static DWORD WINAPI async_getprotobynumber(LPVOID arg) struct async_query_getprotobynumber *aq = arg; int size = 0; WORD fail = 0; - struct WS_protoent *pe; + struct protoent *pe; - if ((pe = WS_getprotobynumber(aq->proto_number))) + if ((pe = getprotobynumber(aq->proto_number))) { size = aq->query.sbuflen; if (!ws_protoent_32_to_16( pe, aq->query.sbuf, &size )) fail = WSAENOBUFS; @@ -376,9 +375,9 @@ static DWORD WINAPI async_getservbyname(LPVOID arg) struct async_query_getservbyname *aq = arg; int size = 0; WORD fail = 0; - struct WS_servent *se; + struct servent *se; - if ((se = WS_getservbyname(aq->serv_name,aq->serv_proto))) + if ((se = getservbyname(aq->serv_name,aq->serv_proto))) { size = aq->query.sbuflen; if (!ws_servent_32_to_16( se, aq->query.sbuf, &size )) fail = WSAENOBUFS; @@ -393,9 +392,9 @@ static DWORD WINAPI async_getservbyport(LPVOID arg) struct async_query_getservbyport *aq = arg; int size = 0; WORD fail = 0; - struct WS_servent *se; + struct servent *se; - if ((se = WS_getservbyport(aq->serv_port,aq->serv_proto))) + if ((se = getservbyport(aq->serv_port,aq->serv_proto))) { size = aq->query.sbuflen; if (!ws_servent_32_to_16( se, aq->query.sbuf, &size )) fail = WSAENOBUFS; @@ -441,10 +440,10 @@ static HANDLE16 run_query( HWND16 hWnd, UINT uMsg, LPTHREAD_START_ROUTINE func, /*********************************************************************** * accept (WINSOCK.1) */ -SOCKET16 WINAPI accept16(SOCKET16 s, struct WS_sockaddr* addr, INT16* addrlen16 ) +SOCKET16 WINAPI accept16(SOCKET16 s, struct sockaddr* addr, INT16* addrlen16 ) { INT addrlen32 = addrlen16 ? *addrlen16 : 0; - SOCKET retSocket = WS_accept( s, addr, &addrlen32 ); + SOCKET retSocket = accept( s, addr, &addrlen32 ); if( addrlen16 ) *addrlen16 = addrlen32; return retSocket; } @@ -452,9 +451,9 @@ SOCKET16 WINAPI accept16(SOCKET16 s, struct WS_sockaddr* addr, INT16* addrlen16 /*********************************************************************** * bind (WINSOCK.2) */ -INT16 WINAPI bind16(SOCKET16 s, struct WS_sockaddr *name, INT16 namelen) +INT16 WINAPI bind16(SOCKET16 s, struct sockaddr *name, INT16 namelen) { - return WS_bind( s, name, namelen ); + return bind( s, name, namelen ); } /*********************************************************************** @@ -462,24 +461,24 @@ INT16 WINAPI bind16(SOCKET16 s, struct WS_sockaddr *name, INT16 namelen) */ INT16 WINAPI closesocket16(SOCKET16 s) { - return WS_closesocket(s); + return closesocket(s); } /*********************************************************************** * connect (WINSOCK.4) */ -INT16 WINAPI connect16(SOCKET16 s, struct WS_sockaddr *name, INT16 namelen) +INT16 WINAPI connect16(SOCKET16 s, struct sockaddr *name, INT16 namelen) { - return WS_connect( s, name, namelen ); + return connect( s, name, namelen ); } /*********************************************************************** * getpeername (WINSOCK.5) */ -INT16 WINAPI getpeername16(SOCKET16 s, struct WS_sockaddr *name, INT16 *namelen16) +INT16 WINAPI getpeername16(SOCKET16 s, struct sockaddr *name, INT16 *namelen16) { INT namelen32 = *namelen16; - INT retVal = WS_getpeername( s, name, &namelen32 ); + INT retVal = getpeername( s, name, &namelen32 ); *namelen16 = namelen32; return retVal; } @@ -487,14 +486,14 @@ INT16 WINAPI getpeername16(SOCKET16 s, struct WS_sockaddr *name, INT16 *namelen1 /*********************************************************************** * getsockname (WINSOCK.6) */ -INT16 WINAPI getsockname16(SOCKET16 s, struct WS_sockaddr *name, INT16 *namelen16) +INT16 WINAPI getsockname16(SOCKET16 s, struct sockaddr *name, INT16 *namelen16) { INT retVal; if( namelen16 ) { INT namelen32 = *namelen16; - retVal = WS_getsockname( s, name, &namelen32 ); + retVal = getsockname( s, name, &namelen32 ); *namelen16 = namelen32; } else retVal = SOCKET_ERROR; @@ -511,18 +510,45 @@ INT16 WINAPI getsockopt16(SOCKET16 s, INT16 level, INT16 optname, char *optval, INT retVal; if( optlen ) optlen32 = *optlen; else p = NULL; - retVal = WS_getsockopt( s, (WORD)level, optname, optval, p ); + retVal = getsockopt( s, (WORD)level, optname, optval, p ); if( optlen ) *optlen = optlen32; return retVal; } +/*********************************************************************** + * htonl (WINSOCK.8) + */ +u_long WINAPI htonl16(u_long hostlong) +{ + return htonl(hostlong); +} + + +/*********************************************************************** + * htons (WINSOCK.9) + */ +u_short WINAPI htons16(u_short hostshort) +{ + return htons(hostshort); +} + +/*********************************************************************** + * inet_addr (WINSOCK.10) + */ +u_long WINAPI inet_addr16(const char *cp) +{ + if (!cp) return INADDR_NONE; + return inet_addr(cp); +} + + /*********************************************************************** * inet_ntoa (WINSOCK.11) */ -SEGPTR WINAPI inet_ntoa16(struct WS_in_addr in) +SEGPTR WINAPI inet_ntoa16(struct in_addr in) { char* retVal; - if (!(retVal = WS_inet_ntoa( in ))) return 0; + if (!(retVal = inet_ntoa( in ))) return 0; if (!dbuffer_seg) dbuffer_seg = MapLS( retVal ); return dbuffer_seg; } @@ -530,9 +556,9 @@ SEGPTR WINAPI inet_ntoa16(struct WS_in_addr in) /*********************************************************************** * ioctlsocket (WINSOCK.12) */ -INT16 WINAPI ioctlsocket16(SOCKET16 s, LONG cmd, ULONG *argp) +INT16 WINAPI ioctlsocket16(SOCKET16 s, LONG cmd, u_long *argp) { - return WS_ioctlsocket( s, cmd, argp ); + return ioctlsocket( s, cmd, argp ); } /*********************************************************************** @@ -540,7 +566,24 @@ INT16 WINAPI ioctlsocket16(SOCKET16 s, LONG cmd, ULONG *argp) */ INT16 WINAPI listen16(SOCKET16 s, INT16 backlog) { - return WS_listen( s, backlog ); + return listen( s, backlog ); +} + +/*********************************************************************** + * ntohl (WINSOCK.14) + */ +u_long WINAPI ntohl16(u_long netlong) +{ + return ntohl(netlong); +} + + +/*********************************************************************** + * ntohs (WINSOCK.15) + */ +u_short WINAPI ntohs16(u_short netshort) +{ + return ntohs(netshort); } /*********************************************************************** @@ -548,23 +591,23 @@ INT16 WINAPI listen16(SOCKET16 s, INT16 backlog) */ INT16 WINAPI recv16(SOCKET16 s, char *buf, INT16 len, INT16 flags) { - return WS_recv( s, buf, len, flags ); + return recv( s, buf, len, flags ); } /*********************************************************************** * recvfrom (WINSOCK.17) */ INT16 WINAPI recvfrom16(SOCKET16 s, char *buf, INT16 len, INT16 flags, - struct WS_sockaddr *from, INT16 *fromlen16) + struct sockaddr *from, INT16 *fromlen16) { if (fromlen16) { INT fromlen32 = *fromlen16; - INT retVal = WS_recvfrom( s, buf, len, flags, from, &fromlen32 ); + INT retVal = recvfrom( s, buf, len, flags, from, &fromlen32 ); *fromlen16 = fromlen32; return retVal; } - else return WS_recvfrom( s, buf, len, flags, from, NULL ); + else return recvfrom( s, buf, len, flags, from, NULL ); } /*********************************************************************** @@ -572,17 +615,17 @@ INT16 WINAPI recvfrom16(SOCKET16 s, char *buf, INT16 len, INT16 flags, */ INT16 WINAPI select16(INT16 nfds, ws_fd_set16 *ws_readfds, ws_fd_set16 *ws_writefds, ws_fd_set16 *ws_exceptfds, - struct WS_timeval* timeout) + struct timeval* timeout) { - WS_fd_set read_set, write_set, except_set; - WS_fd_set *pread_set = NULL, *pwrite_set = NULL, *pexcept_set = NULL; + fd_set read_set, write_set, except_set; + fd_set *pread_set = NULL, *pwrite_set = NULL, *pexcept_set = NULL; int ret; if (ws_readfds) pread_set = ws_fdset_16_to_32( ws_readfds, &read_set ); if (ws_writefds) pwrite_set = ws_fdset_16_to_32( ws_writefds, &write_set ); if (ws_exceptfds) pexcept_set = ws_fdset_16_to_32( ws_exceptfds, &except_set ); /* struct timeval is the same for both 32- and 16-bit code */ - ret = WS_select( nfds, pread_set, pwrite_set, pexcept_set, timeout ); + ret = select( nfds, pread_set, pwrite_set, pexcept_set, timeout ); if (ws_readfds) ws_fdset_32_to_16( &read_set, ws_readfds ); if (ws_writefds) ws_fdset_32_to_16( &write_set, ws_writefds ); if (ws_exceptfds) ws_fdset_32_to_16( &except_set, ws_exceptfds ); @@ -594,16 +637,16 @@ INT16 WINAPI select16(INT16 nfds, ws_fd_set16 *ws_readfds, */ INT16 WINAPI send16(SOCKET16 s, char *buf, INT16 len, INT16 flags) { - return WS_send( s, buf, len, flags ); + return send( s, buf, len, flags ); } /*********************************************************************** * sendto (WINSOCK.20) */ INT16 WINAPI sendto16(SOCKET16 s, char *buf, INT16 len, INT16 flags, - struct WS_sockaddr *to, INT16 tolen) + struct sockaddr *to, INT16 tolen) { - return WS_sendto( s, buf, len, flags, to, tolen ); + return sendto( s, buf, len, flags, to, tolen ); } /*********************************************************************** @@ -613,7 +656,7 @@ INT16 WINAPI setsockopt16(SOCKET16 s, INT16 level, INT16 optname, char *optval, INT16 optlen) { if( !optval ) return SOCKET_ERROR; - return WS_setsockopt( s, (WORD)level, optname, optval, optlen ); + return setsockopt( s, (WORD)level, optname, optval, optlen ); } /*********************************************************************** @@ -621,7 +664,7 @@ INT16 WINAPI setsockopt16(SOCKET16 s, INT16 level, INT16 optname, */ INT16 WINAPI shutdown16(SOCKET16 s, INT16 how) { - return WS_shutdown( s, how ); + return shutdown( s, how ); } /*********************************************************************** @@ -629,7 +672,7 @@ INT16 WINAPI shutdown16(SOCKET16 s, INT16 how) */ SOCKET16 WINAPI socket16(INT16 af, INT16 type, INT16 protocol) { - return WS_socket( af, type, protocol ); + return socket( af, type, protocol ); } /*********************************************************************** @@ -637,9 +680,9 @@ SOCKET16 WINAPI socket16(INT16 af, INT16 type, INT16 protocol) */ SEGPTR WINAPI gethostbyaddr16(const char *addr, INT16 len, INT16 type) { - struct WS_hostent *he; + struct hostent *he; - if (!(he = WS_gethostbyaddr( addr, len, type ))) return 0; + if (!(he = gethostbyaddr( addr, len, type ))) return 0; return ws_hostent_32_to_16( he, 0, NULL ); } @@ -648,9 +691,9 @@ SEGPTR WINAPI gethostbyaddr16(const char *addr, INT16 len, INT16 type) */ SEGPTR WINAPI gethostbyname16(const char *name) { - struct WS_hostent *he; + struct hostent *he; - if (!(he = WS_gethostbyname( name ))) return 0; + if (!(he = gethostbyname( name ))) return 0; return ws_hostent_32_to_16( he, 0, NULL ); } @@ -659,9 +702,9 @@ SEGPTR WINAPI gethostbyname16(const char *name) */ SEGPTR WINAPI getprotobyname16(const char *name) { - struct WS_protoent *pe; + struct protoent *pe; - if (!(pe = WS_getprotobyname( name ))) return 0; + if (!(pe = getprotobyname( name ))) return 0; return ws_protoent_32_to_16( pe, 0, NULL ); } @@ -670,9 +713,9 @@ SEGPTR WINAPI getprotobyname16(const char *name) */ SEGPTR WINAPI getprotobynumber16(INT16 number) { - struct WS_protoent *pe; + struct protoent *pe; - if (!(pe = WS_getprotobynumber( number ))) return 0; + if (!(pe = getprotobynumber( number ))) return 0; return ws_protoent_32_to_16( pe, 0, NULL ); } @@ -681,9 +724,9 @@ SEGPTR WINAPI getprotobynumber16(INT16 number) */ SEGPTR WINAPI getservbyname16(const char *name, const char *proto) { - struct WS_servent *se; + struct servent *se; - if (!(se = WS_getservbyname( name, proto ))) return 0; + if (!(se = getservbyname( name, proto ))) return 0; return ws_servent_32_to_16( se, 0, NULL ); } @@ -692,9 +735,9 @@ SEGPTR WINAPI getservbyname16(const char *name, const char *proto) */ SEGPTR WINAPI getservbyport16(INT16 port, const char *proto) { - struct WS_servent *se; + struct servent *se; - if (!(se = WS_getservbyport( port, proto ))) return 0; + if (!(se = getservbyport( port, proto ))) return 0; return ws_servent_32_to_16( se, 0, NULL ); } @@ -703,7 +746,8 @@ SEGPTR WINAPI getservbyport16(INT16 port, const char *proto) */ INT16 WINAPI gethostname16(char *name, INT16 namelen) { - return WS_gethostname(name, namelen); + extern int WINAPI gethostname(char *name, INT namelen); + return gethostname(name, namelen); } /*********************************************************************** @@ -869,6 +913,14 @@ INT16 WINAPI WSAUnhookBlockingHook16(void) return WSAUnhookBlockingHook(); } +/*********************************************************************** + * WSAGetLastError (WINSOCK.111) + */ +INT WINAPI WSAGetLastError16(void) +{ + return WSAGetLastError(); +} + /*********************************************************************** * WSASetLastError (WINSOCK.112) */ @@ -877,6 +929,22 @@ void WINAPI WSASetLastError16(INT16 iError) WSASetLastError(iError); } +/*********************************************************************** + * WSACancelBlockingCall (WINSOCK.113) + */ +INT WINAPI WSACancelBlockingCall16(void) +{ + return WSACancelBlockingCall(); +} + +/*********************************************************************** + * WSAIsBlocking (WINSOCK.114) + */ +BOOL WINAPI WSAIsBlocking16(void) +{ + return WSAIsBlocking(); +} + /*********************************************************************** * WSAStartup (WINSOCK.115) * diff --git a/dlls/ws2_32/winsock.spec b/dlls/winsock.dll16/winsock.dll16.spec similarity index 87% rename from dlls/ws2_32/winsock.spec rename to dlls/winsock.dll16/winsock.dll16.spec index 94fe71a8cfb..4e99af5f3dd 100644 --- a/dlls/ws2_32/winsock.spec +++ b/dlls/winsock.dll16/winsock.dll16.spec @@ -5,14 +5,14 @@ 5 pascal -ret16 getpeername(word ptr ptr) getpeername16 6 pascal -ret16 getsockname(word ptr ptr) getsockname16 7 pascal -ret16 getsockopt(word word word ptr ptr) getsockopt16 -8 pascal htonl(long) WS_htonl -9 pascal -ret16 htons(word) WS_htons -10 pascal inet_addr(ptr) WS_inet_addr +8 pascal htonl(long) htonl16 +9 pascal -ret16 htons(word) htons16 +10 pascal inet_addr(ptr) inet_addr16 11 pascal inet_ntoa(long) inet_ntoa16 12 pascal -ret16 ioctlsocket(word long ptr) ioctlsocket16 13 pascal -ret16 listen(word word) listen16 -14 pascal ntohl(long) WS_ntohl -15 pascal -ret16 ntohs(word) WS_ntohs +14 pascal ntohl(long) ntohl16 +15 pascal -ret16 ntohs(word) ntohs16 16 pascal -ret16 recv(word ptr word word) recv16 17 pascal -ret16 recvfrom(word ptr word word ptr ptr) recvfrom16 18 pascal -ret16 select(word ptr ptr ptr ptr) select16 @@ -38,10 +38,10 @@ 108 pascal -ret16 WSACancelAsyncRequest(word) WSACancelAsyncRequest16 109 pascal -ret16 WSASetBlockingHook(segptr) WSASetBlockingHook16 110 pascal -ret16 WSAUnhookBlockingHook() WSAUnhookBlockingHook16 -111 pascal -ret16 WSAGetLastError() WSAGetLastError +111 pascal -ret16 WSAGetLastError() WSAGetLastError16 112 pascal WSASetLastError(word) WSASetLastError16 -113 pascal -ret16 WSACancelBlockingCall() WSACancelBlockingCall -114 pascal -ret16 WSAIsBlocking() WSAIsBlocking +113 pascal -ret16 WSACancelBlockingCall() WSACancelBlockingCall16 +114 pascal -ret16 WSAIsBlocking() WSAIsBlocking16 115 pascal WSAStartup(word ptr) WSAStartup16 116 pascal WSACleanup() WSACleanup16 151 pascal -ret16 __WSAFDIsSet(word ptr) __WSAFDIsSet16 diff --git a/include/wine/winsock16.h b/dlls/winsock.dll16/winsock16.h similarity index 97% rename from include/wine/winsock16.h rename to dlls/winsock.dll16/winsock16.h index c803666a385..6cf9def5961 100644 --- a/include/wine/winsock16.h +++ b/dlls/winsock.dll16/winsock16.h @@ -19,9 +19,6 @@ #ifndef __WINE_WINE_WINSOCK16_H #define __WINE_WINE_WINSOCK16_H -#include -#include -#include #include typedef UINT16 SOCKET16; @@ -29,7 +26,7 @@ typedef UINT16 SOCKET16; typedef struct { UINT16 fd_count; /* how many are SET? */ - SOCKET16 fd_array[WS_FD_SETSIZE]; /* an array of SOCKETs */ + SOCKET16 fd_array[FD_SETSIZE]; /* an array of SOCKETs */ } ws_fd_set16; /* ws_hostent16, ws_protoent16, ws_servent16, ws_netent16 diff --git a/dlls/ws2_32/Makefile.in b/dlls/ws2_32/Makefile.in index 9924e2d0875..d858ba5386b 100644 --- a/dlls/ws2_32/Makefile.in +++ b/dlls/ws2_32/Makefile.in @@ -14,10 +14,6 @@ C_SRCS = \ protocol.c \ socket.c -C_SRCS16 = socket16.c - -SPEC_SRCS16 = winsock.spec - RC_SRCS = version.rc @MAKE_DLL_RULES@ diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 6c78210c8b3..fdc7aec58e8 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -822,7 +822,6 @@ INT WINAPI WSACleanup(void) /*********************************************************************** - * WSAGetLastError (WINSOCK.111) * WSAGetLastError (WS2_32.111) */ INT WINAPI WSAGetLastError(void) @@ -2144,7 +2143,6 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level, } /*********************************************************************** - * htonl (WINSOCK.8) * htonl (WS2_32.8) */ WS_u_long WINAPI WS_htonl(WS_u_long hostlong) @@ -2154,7 +2152,6 @@ WS_u_long WINAPI WS_htonl(WS_u_long hostlong) /*********************************************************************** - * htons (WINSOCK.9) * htons (WS2_32.9) */ WS_u_short WINAPI WS_htons(WS_u_short hostshort) @@ -2201,7 +2198,6 @@ int WINAPI WSAHtons(SOCKET s, WS_u_short hostshort, WS_u_short *lpnetshort) /*********************************************************************** - * inet_addr (WINSOCK.10) * inet_addr (WS2_32.11) */ WS_u_long WINAPI WS_inet_addr(const char *cp) @@ -2212,7 +2208,6 @@ WS_u_long WINAPI WS_inet_addr(const char *cp) /*********************************************************************** - * ntohl (WINSOCK.14) * ntohl (WS2_32.14) */ WS_u_long WINAPI WS_ntohl(WS_u_long netlong) @@ -2222,7 +2217,6 @@ WS_u_long WINAPI WS_ntohl(WS_u_long netlong) /*********************************************************************** - * ntohs (WINSOCK.15) * ntohs (WS2_32.15) */ WS_u_short WINAPI WS_ntohs(WS_u_short netshort) @@ -4252,7 +4246,6 @@ int WINAPI __WSAFDIsSet(SOCKET s, WS_fd_set *set) } /*********************************************************************** - * WSAIsBlocking (WINSOCK.114) * WSAIsBlocking (WS2_32.114) */ BOOL WINAPI WSAIsBlocking(void) @@ -4270,7 +4263,6 @@ BOOL WINAPI WSAIsBlocking(void) } /*********************************************************************** - * WSACancelBlockingCall (WINSOCK.113) * WSACancelBlockingCall (WS2_32.113) */ INT WINAPI WSACancelBlockingCall(void)