diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-04-16 09:44:12 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-04-16 09:44:12 (GMT) |
commit | 7f0bded35ff4e57468cb618dd14770a60d268195 (patch) | |
tree | a8378e57b9eeb9e337a290adaf5a181c090624fc /win/tclWinInit.c | |
parent | f4ae34e81b29f1fd3addd470eda2f7a42fa7225e (diff) | |
parent | 551367d26fffabaf2176de988521a98184f49ad0 (diff) | |
download | tcl-7f0bded35ff4e57468cb618dd14770a60d268195.zip tcl-7f0bded35ff4e57468cb618dd14770a60d268195.tar.gz tcl-7f0bded35ff4e57468cb618dd14770a60d268195.tar.bz2 |
Upgrade from Winsock 1.1 to Winsock 2.2, which is always available on Win2000+. See: [http://msdn.microsoft.com/en-us/library/windows/desktop/ms742213%28v=vs.85%29.aspx] for details.
Move winsock initialization to TclpInitPlatform(void), so we can be sure everywhere that we have an initialized winsock2.
Stub entries for TclWinGetServByName/TclWinGetSockOpt/TclWinSetSockOpt are no longer necessary (will be removed in 9.0, but are kept in 8.x)
Diffstat (limited to 'win/tclWinInit.c')
-rw-r--r-- | win/tclWinInit.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 2c21d38..d90d57a 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -113,8 +113,8 @@ static int ToUtf(const WCHAR *wSrc, char *dst); * * TclpInitPlatform -- * - * Initialize all the platform-dependant things like signals and - * floating-point error handling. + * Initialize all the platform-dependant things like signals, + * floating-point error handling and sockets. * * Called at process initialization time. * @@ -130,20 +130,16 @@ static int ToUtf(const WCHAR *wSrc, char *dst); void TclpInitPlatform(void) { - tclPlatform = TCL_PLATFORM_WINDOWS; + WSADATA wsaData; + WORD wVersionRequested = MAKEWORD(2, 2); - /* - * The following code stops Windows 3.X and Windows NT 3.51 from - * automatically putting up Sharing Violation dialogs, e.g, when someone - * tries to access a file that is locked or a drive with no disk in it. - * Tcl already returns the appropriate error to the caller, and they can - * decide to put up their own dialog in response to that failure. - * - * Under 95 and NT 4.0, this is a NOOP because the system doesn't - * automatically put up dialogs when the above operations fail. - */ + tclPlatform = TCL_PLATFORM_WINDOWS; - SetErrorMode(SetErrorMode(0) | SEM_FAILCRITICALERRORS); + /* + * Initialize the winsock library. On Windows XP and higher this + * can never fail. + */ + WSAStartup(wVersionRequested, &wsaData); #ifdef STATIC_BUILD /* |