The big winsock patch

Francois Gouget fgouget at free.fr
Sun Oct 21 22:39:43 CDT 2001


   This patch fixes the issues listed in bug #118:
 * winsock.h should not depend on the Unix socket headers. The Unix
socket headers vary quite a bit and may not match what is expected by
WineLib applications, especially wrt. cdecl/stdcall.
 * Because the Unix headers are stored in different files depending on
the platform, #including them requires making use of config.h which is
forbidden.
 * The existing winsock headers were incompatible with the MSVCRT
headers which made it pretty much impossible to use the MSVCRT headers.

Other notes:
 * It also introduces two operating modes, quite like what was done for
the MSVCRT: if USE_WS_PREFIX is defined then all symbols that may
conflict with the Unix ones are prefixed with 'WS_'. In that case one
can include both the winsock headers and the Unix headers. This is used
in Wine. If USE_WS_PREFIX is not defined, then no symbol is prefixed.
This is the mode that WineLib users will most likely want.
 * All that the Unix socket headers used to define is now defined
directly in winsock.h, with the layout/names that Win32 applications
expect. I also moved some symbols to their rightful headers, and added
ws2tcpip.h in the process.
 * It also adds some missing symbols. I believe winsock.h should be
complete (or pretty much so). There are still some symbols missing in
winsock2.h.
 * There is one case where winsock.h can conflict with the Unix headers.
This is related to the select symbols (FD_SETSIZE, FD_CLR, ...). The
problem is that these are not socket related on Unix, and thus defined
in stdlib.h, while they are considered socket specific on Windows. So if
you don't use the MSVCRT headers you may get incompatible definitions.
'winsock.h' tries hard to make sure this won't be the case but if you
include stdlib.h before you include winsock.h, then winsock.h will
'invalidate' all the FD_XXX symbols so that you don't use them by
mistake.
 * I also added a WINE_NOWINSOCK macro that WineLib users can define if
they do not want windows.h to include the winsock2.h header.
 * THe new winsock headers are now compatible with both the standard
Unix headers (with the exception noted above), and with the MSVCRt
headers.


Changelog:

 * dlls/winsock/Makefile.in,
   dlls/winsock/async.c,
   dlls/winsock/socket.c,
   dlls/winsock/winsock.spec,
   dlls/winsock/ws2_32.spec,
   dlls/wsock32/protocol.c,
   dlls/wsock32/socket.c,
   dlls/wsock32/wsock32.spec,
   include/windows.h,
   include/winsock.h,
   include/winsock2.h,
   include/wsipx.h,
   include/wine/winsock16.h,
   server/sock.c,
   include/ws2tcpip.h

   Make winsock.h and winsock2.h independent from the Unix headers
   Make them compatible with both the Unix C headers and the MSVCRT
headers
   Ensure compatibility with the Unix headers via the USE_WS_PREFIX macro
   Add WINE_NOWINSOCK: prevents winsock.h from being included
from windows.h when defined
   Add ws2tcpip.h, move definitions to the right header


--
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
                  Hiroshima '45 - Czernobyl '86 - Windows '95
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p20011021-winsock.diff.gz
Type: application/octet-stream
Size: 24633 bytes
Desc: p20011021-winsock.diff.gz
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20011021/430abbc5/p20011021-winsock.diff.obj


More information about the wine-patches mailing list